Skip to content

Reorganize scripts modules to drop the try/except ImportError import shim #148

Description

@toufali

Several scripts (e.g. sweep.py) use a try/except ImportError shim to import shared modules under both scripts.<mod> (package) and <mod> (flat) runtimes:

```python
try:
from scripts.github_utils import SEVERITY_RANK, has_codeowner_approval, is_bot
except ImportError:
from github_utils import ... # type: ignore[no-redef]
```

This gets more cumbersome as shared modules grow. Reorganize the package layout / invocation so shared modules import cleanly in every runtime (workflow, CLI, tests) and the shim can be removed.

Raised by @groovecoder in review of #147.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions