Repository navigation
packaging: wheel ships tg_agent package; tg-agent --version prints correct name (#1448, #1447) - #1582
Conversation
The distribution is named tg-agent but shipped a top-level `src` package: the wheel collided with any other project's `src`, and `tg-agent --version` printed "src 0.2.3" because the version label echoed the import name (#1448). A regular non-editable install is also the fix class for #1447 (stale editable installs from deleted worktrees shadowing the CLI). Purely mechanical: git mv src tg_agent plus rewrite of imports, string patch/setattr targets, logger names, argv/module references ("python -m src.main"), entry point, packaging config keys, .importlinter, CI path args, and live docs. Zero logic changes. Historical records (.github/release-metadata/, docs/superpowers/plans/) intentionally keep the old paths. Closes #1448, part of #1447 (env cleanup documented on the issue). Co-Authored-By: Claude Code <noreply@anthropic.com>
Builds a wheel through the declared PEP 517 path and asserts the archive ships tg_agent/__init__.py, no top-level src/, dist-info Name: tg-agent, entry point tg-agent = tg_agent.main:main, and the declared package-data (web templates). Guards the #1448 fix against silent drift back to a generic top-level package name. Co-Authored-By: Claude Code <noreply@anthropic.com>
Segmented path constants (ROOT / "src" / ...), version-output assertions
(f"src {__version__}"), mkdocstrings identifiers (::: src.*) in
docs/reference, and docstring prose that the mechanical import sweep
could not anchor on. Quality-scoring failure in the same suite run is
the known external-provider flake (GLM 429), unrelated.
Co-Authored-By: Claude Code <noreply@anthropic.com>
1db7949 to
658171f
Compare
axisrow
left a comment
There was a problem hiding this comment.
Requested changes. The rename itself is verified clean at head 658171f: tree-wide grep shows zero functional src references left (imports, string patch/setattr/import_module targets, argv module refs incl. the daemon-autorestart matcher and Codex/ADK subprocesses), entry point, [tool.setuptools], [tool.mutmut], .importlinter, CI path args (forced only, no structure changes), Dockerfile and the agent-facing docs are all consistent, and the wheel-content guard is a good regression net. Three findings need changes: (1) one src file survived the rename - re-created by commits merged from main after the delete and mechanically rewritten instead of removed; (2) the new wheel-build test auto-classifies as unit and lacks mutmut_skip; (3) docstring/comment references to the old name were not swept (34 dead mkdocstrings autorefs + 44 files with stale src/ path comments). Optional, summary-only: the pip-wheel build adds a one-off isolated-build cost (~10-40s) to the suite run - acceptable for the guarantee it buys.
axisrow
left a comment
There was a problem hiding this comment.
Requested changes (sweep tail only). All three findings from the previous round are verified fixed at 91eecb2: git ls-files src is empty (ghost package gone), the wheel test carries @pytest.mark.integration + @pytest.mark.mutmut_skip, and .py docstrings under tg_agent/ are clean (0 mkdocstrings autorefs with src.* left; fix hunks are comment/docstring-only, no logic drift). What remains is the same required sweep, incompletely executed outside .py files: two live published docs (docs.yml deploys them) still state wrong module/package facts and one operational script docstring points at a nonexistent module. Each is a mechanical one-liner; inline comments below (the in-package template leftover is folded into the first one because its line is an unchanged rename line and cannot carry an inline anchor). Optional, not blocking: stale src/ path comments in tests/cli_real_tg_integration (conftest.py:489/652/707 and heavy tests), docs/plans/zai-provider-support.md (historical plan), the display label print() в src/cli/ in scripts/code_health.py:193 (the scan itself is path-agnostic via the /cli/ marker and works), and the src_root parameter name in tg_agent/cli/daemon_autorestart.py:42 (cosmetic).
axisrow
left a comment
There was a problem hiding this comment.
Requested changes - one line left. Verified fixed at f3c36b8: docs/design/plugin-system.md:55 now names tg_agent.plugin_api and tg_agent/agent/tools/_registry.py, docs/testing/real-telegram.md:159 now walks tg_agent.cli.typer_commands.app, scripts/restart_daemon_if_stale.py docstring says tg_agent/ and tg_agent/cli/daemon_autorestart.py, and the optional tests/cli_real_tg_integration comment sweep from the summary was done too - thank you. The one remaining item from the previous round is the folded one: tg_agent/web/templates/agent/_threads.html:86 still says see src/agent/models.py. That file is a pure rename in this diff (no commentable lines, confirmed via the files API), so the finding is anchored on the closest patched template instead. Fix that one line (tg_agent/agent/models.py) and this PR is ready; everything else about the rename remains verified clean (zero functional src references, wheel guard green, packaging config consistent).
axisrow
left a comment
There was a problem hiding this comment.
Approving. The last remaining item is fixed at 22b7a35: tg_agent/web/templates/agent/_threads.html:86 now points to tg_agent/agent/models.py (single-line commit, nothing else touched). Final residual sweep at this head confirms the rename is complete: zero functional src references tree-wide (imports, string patch/setattr/import_module targets, argv module refs), zero mkdocstrings autorefs with old paths under tg_agent/, the only in-package match left is an unrelated JS variable named src in pipelines/create.html. All findings across the five review rounds are resolved: the ghost src/services/task_handlers/init.py removal, wheel-guard markers (integration + mutmut_skip), the docstring/comment sweep in package code, live docs (plugin-system.md, real-telegram.md), the operational script docstring, and this template pointer. Packaging config, CI path args, Dockerfile, .importlinter and agent-facing docs were verified consistent in the first round; the wheel-content guard covers the regression the task required. Branch is mergeable against main (CI run still in flight at review time - verify conclusion before merge as usual).
|
Closing per owner decision: the full The rename work is preserved on this branch ( A minimal metadata-only PR (path B: |
…) (#1650) * test(env): detect stale editable installs with one clear failure (#1649) An editable install that predates the #1582 src/ -> tg_agent/ rename keeps its dist metadata pointing at src.main:main, so the console-entrypoint tests in test_cli_exit_codes.py fail on every local run with a cryptic "ModuleNotFoundError: No module named 'src'" while CI (fresh install each job) stays green. - editable_install_staleness() in tests/helpers.py compares the installed dist (console script target, version, top_level) against pyproject in an isolated `python -I` subprocess: the pytest process puts rootdir on sys.path, so a stray tg_agent.egg-info build artifact in the repo root shadows the site-packages dist-info and hides the divergence from an in-process check. - tests/test_local_install_consistency.py fails once with the diagnosis and the reinstall recipe in the message. - test_cli_exit_codes.py skips its console variants with the same recipe while the install is stale; the module variants still run. Co-Authored-By: Claude Code <noreply@anthropic.com> * docs(env): local venv policy and the stale-editable repair recipe (#1649) - CONTRIBUTING.md: local venv policy — any Python within requires-python (3.11+) works, no local version pin (the #1649 "py3.13 failures" were a stale install plus a test-helper leak, not a version behavior difference); the reinstall recipe; where the editable install lives for AO worktrees. - CLAUDE.md: point at tests/test_local_install_consistency.py from the Commands block so a ModuleNotFoundError: 'src' diagnosis is one lookup. Co-Authored-By: Claude Code <noreply@anthropic.com> --------- Co-authored-by: axisrow <axisrow@users.noreply.github.com> Co-authored-by: Claude Code <noreply@anthropic.com>
Fixes #1448, closes #1447 (package side; machine-local env cleanup documented in an issue comment).
What
git mv src tg_agent+ mechanical rewrite of every reference to the old import name — zero logic changes:from src./import src.) and string patch/setattr/import_moduletargetspython -m src.main, Codex/ADK backend subprocesses, daemon autorestart process matching)tg-agent = tg_agent.main:main,[tool.setuptools]package discovery/package-data keys,[tool.mutmut] source_paths,.importlinterroot/contractsci.yml(ruff/jscpd/bandit targets — forced by the rename, no job/structure changes), Dockerfile CMDtg-agent --versionnow printstg-agent <ver>(wassrc <ver>).github/release-metadata/,docs/superpowers/plans/) deliberately keep old pathstests/test_packaging_release.py: asserts flipped to the new layout + new regression guardWhy
The dist is named
tg-agentbut shipped a top-levelsrcpackage: wheel collides with any other project'ssrc, version metadata/CLI reported the wrong name (tg-agent --version→src 0.2.3), and a non-editable install couldn't serve as the self-contained fix for the stale-editable-install breakage in #1447.Regression guard (required by the task)
tests/test_packaging_release.py::test_wheel_ships_tg_agent_package_not_srcbuilds a wheel through the declared PEP 517 path and asserts:tg_agent/__init__.pypresent, no top-levelsrc/,Name: tg-agentin dist-info,tg-agent = tg_agent.main:mainin entry_points, web templates (package-data) present.Verification
ruff check tg_agent tests conftest.py— cleanlint-imports --config .importlinter— 1 contract KEPT.venv(rebased on current main):smoke 7 passed / 24 skipped; parallel 9907 passed, 151 skipped, 9 failed; serial 1014 passed
tests/test_cli_agent_commands.py— proven pre-existing on main (identical 9 failures running the same file on detached main in the same venv; Python 3.13 GC of the tests' abandoned_fake_streamasync generators →PytestUnraisableExceptionWarningunderfilterwarnings=error). Zero new failures from this diff..venv/bin/tg-agent --version→tg-agent 0.2.4.1;python -m tg_agent.main --version— samepip install tg_agent-0.2.4.1-py3-none-any.whlwith deps →tg-agent --versionprintstg-agent 0.2.4.1,--helpexits 0 (PATH: system tg-agent resolves to editable install from a deleted AO worktree (ModuleNotFoundError: src) #1447 end-state)tests/test_packaging_release.py::test_wheel_ships_tg_agent_package_not_src— builds a real PEP 517 wheel, asserts contentsNotes / risks
src.*must switch totg_agent.*. CLI users of thetg-agententry point are unaffected (same command, now resolving to a correctly named package).test_packaging_deps.pyuntouched and green.srcincompatibility that required thestrip_src_prefixfork disappears with the rename; fork stays until the upstream PR lands (comment updated in pyproject).🤖 Generated with Claude Code