arch: turn ita into a proper Python package (#256)#336
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Promotes ita from a sibling-of-
_*.py-modules script into a proper Python package. Drops thesys.path.inserthack. Standard packaging end-to-end.Closes #256. Part of meta-issue #334. Refs CONTRACT §15.
Layout change
What changes
from _foo import X→from ._foo import Xeverywhere (top-level + in-function).from _core import X→from ita._core import Xin 4 test files; in-function imports likewise.src/ita.py): switched topython -m ita. Canonical viatests/helpers.py(ITA_CMDlist); a back-compatITA = ['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 asuv tool install --force --from . ita. uv manages the launcher in~/.local/binand rebuilds when re-run. No more symlinks..gitignore: adddist/andbuild/.Verification
uv build --wheel→dist/ita-0.7.0-py3-none-any.whl✓python -m ita --version→0.7.0✓-m "not integration and not stress and not perf and not fault_injection"):@regressionmarkers for open issues Phase 3 will fix (bug:broadcast addreplaces all existing domains instead of merging #220 bug:on prompttimeout silently exits 0 with no output #247 bug: broadcast on reports success but broadcast list shows empty #249 bug:ita newreturns before shell metadata is stable #250 CRITICAL: bulkclear --where/--allbypasses protection check #283 bug:broadcast sendcan duplicate delivery when session is in multiple domains #285 proposal: formal prompt-detection contract #288 bug: timeout exit code is mode-dependent — JSON says 124, process exits 1 #290 + broadcast suite +test_cwd_then_run_order).Behavioural change for users
itacommand is now installed viauv tool install, not symlinked. After re-pulling, you must re-run./install.shto update the launcher (uv tool installs are wheel snapshots, not editable). For dev work, useuv run python -m ita ...directly from the repo.Test plan
python -m ita --versionworks./install.shend-to-end on a clean clone (user-side)🤖 Generated with Claude Code