Skip to content

arch: turn ita into a proper Python package (#256)#336

Merged
voidfreud merged 1 commit intomainfrom
arch/proper-package
Apr 13, 2026
Merged

arch: turn ita into a proper Python package (#256)#336
voidfreud merged 1 commit intomainfrom
arch/proper-package

Conversation

@voidfreud
Copy link
Copy Markdown
Owner

Summary

Promotes ita from a sibling-of-_*.py-modules script into a proper Python package. Drops the sys.path.insert hack. Standard packaging end-to-end.

Closes #256. Part of meta-issue #334. Refs CONTRACT §15.

Layout change

src/ita.py        (deleted — was the inline-script launcher)
src/__init__.py   → src/ita/__init__.py    (exposes `cli`, imports all command modules)
src/__main__.py   → src/ita/__main__.py    (enables `python -m ita`)
src/_*.py         → src/ita/_*.py          (21 modules)

What changes

  • Internal imports: from _foo import Xfrom ._foo import X everywhere (top-level + in-function).
  • Test imports of internals: from _core import Xfrom ita._core import X in 4 test files; in-function imports likewise.
  • Subprocess invocations (~10 test files hardcoded src/ita.py): switched to python -m ita. Canonical via tests/helpers.py (ITA_CMD list); a back-compat ITA = ['python', '-m', 'ita'] list stays for tests that splat their own argv.
  • pyproject.toml: adds [build-system] (hatchling) and [tool.hatch.build.targets.wheel] packages = ["src/ita"]. [project.scripts] ita = "ita:cli" now resolves to the package. mutmut path updated.
  • install.sh: rewritten as uv tool install --force --from . ita. uv manages the launcher in ~/.local/bin and rebuilds when re-run. No more symlinks.
  • README: install + dev sections updated.
  • .gitignore: add dist/ and build/.

Verification

Behavioural change for users

  • The ita command is now installed via uv tool install, not symlinked. After re-pulling, you must re-run ./install.sh to update the launcher (uv tool installs are wheel snapshots, not editable). For dev work, use uv run python -m ita ... directly from the repo.

Test plan

  • Wheel builds clean
  • python -m ita --version works
  • Fast-lane test delta vs main: 0
  • Post-merge: ./install.sh end-to-end on a clean clone (user-side)
  • Post-merge: SKILL.md update is now safe to plan (deferred per project rule until everything else lands)

🤖 Generated with Claude Code

Phase 2 follow-up. Promotes src/_*.py to src/ita/_*.py, drops the
sys.path.insert hack, and uses standard Python packaging end-to-end.

Layout change:
  src/ita.py       (deleted — was the inline-script launcher)
  src/__init__.py  → src/ita/__init__.py  (now exposes `cli` + imports
                                           every command module)
  src/__main__.py  → src/ita/__main__.py  (enables `python -m ita`)
  src/_*.py        → src/ita/_*.py        (21 modules)

Imports rewritten:
  - All internal `from _foo import X` → `from ._foo import X`
  - All in-function bare imports likewise updated
  - Test imports of internals: `from _core import X` → `from ita._core import X`
  - Subprocess invocations using `src/ita.py` path → `python -m ita`
    (canonical via tests/helpers.py ITA_CMD list; back-compat ITA list
    kept for tests that splat their own argv)

pyproject.toml:
  - Add [build-system] hatchling + [tool.hatch.build.targets.wheel]
    packages = ["src/ita"] so `uv tool install`, `uv build`, and
    `pip install .` all work cleanly
  - [project.scripts] ita = "ita:cli" now resolves to the package
  - mutmut paths_to_mutate updated to src/ita/
  - pytest pythonpath = ["src", "tests"] retained — tests import the
    package without requiring an editable install

install.sh: rewritten as `uv tool install --force --from . ita`.
Drops the symlink-to-script approach; uv manages the launcher in
~/.local/bin and rebuilds when re-run.

README.md: install + dev sections updated to the new commands.
.gitignore: add dist/ and build/ for wheel artefacts.

Verification:
  - `uv build --wheel` → dist/ita-0.7.0-py3-none-any.whl ✓
  - `python -m ita --version` → 0.7.0 ✓
  - Fast-lane pytest: 14 fail / 118 pass — IDENTICAL to main baseline.
    All 14 failures are pre-existing @regression markers for open
    issues (#220 #247 #249 #250 #283 #285 #288 #290 broadcast suite,
    cwd_then_run_order). No new regression introduced.

Closes #256. Refs CONTRACT §15. Part of meta-issue #334.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@voidfreud voidfreud merged commit 342ded8 into main Apr 13, 2026
@voidfreud voidfreud deleted the arch/proper-package branch April 13, 2026 12:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

arch: package is not really a package — sys.path rewrites in ita.py/main.py

1 participant