Skip to content

Five scripts repeat the same try/except import of ghcall #1283

Open

Description

@yakew7

Where: scripts/check_contributors.py, check_traction.py, check_issue_refs.py, draft_metrics_row.py, update_weekly_issue.py.

Current gap: Each begins with try: from scripts.ghcall import ... except ImportError: from ghcall import ... so it works both imported by tests and run as a script, and tests/test_declared_dependencies.py needed a special case to treat scripts and every scripts/*.py stem as local.

Suggested approach: Pick one mechanism (for example putting the repository root on sys.path in one shared line, or making scripts runnable with python -m) and remove the repetition and the test special case.

Done when: no script has the try/except and the dependency test no longer lists scripts as local.

Activity

  1. added
    enhancementNew feature or request
    toolingScripts, Makefile and contributor tooling
    on Nov 6, 2026
  2. yakew7 commented on Nov 8, 2026

    @yakew7
    OwnerAuthor

    Left open on purpose. The repeated block is now the package-aware one (relative import when imported as scripts.<name>, a path insert plus a plain import when run directly) after the first version cached a stray scripts package from site-packages. Removing the repetition needs one mechanism that also works for runpy.run_path (used by a test), python3 scripts/<name>.py (the workflows, the Makefile and the pre-commit hooks) and imports by the tests; the only candidate that does is switching every invocation to python3 -m scripts.<name> (about fifteen call sites plus the test), which is a change of its own. Happy to do it as a separate change if that is the direction.

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

    enhancementNew feature or requestgood first issueGood for newcomerstoolingScripts, Makefile and contributor tooling

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions