Packagify cheetahclaws#146
Merged
Merged
Conversation
Drop the flat top-level layout (config.py, daemon/, kernel/, …) and nest
all 41 importable modules/packages under one `cheetahclaws` package, so
they are only ever imported as `cheetahclaws.<name>`.
Why: dropping the cc_ prefix re-exposed the namespace collision the prefix
was added to prevent. Generic top-level names (config, daemon, …) get
shadowed by other things on sys.path once the app is *installed* and run
from its entry point rather than the repo dir — another project's
`config/` dir, the `python-daemon` package — breaking `cheetahclaws` at
startup (`ImportError: ... from 'config' (unknown location)`). Owning one
`cheetahclaws.*` namespace removes that entire class of bug, which is a
prerequisite for shipping the app as a broadly-installable package.
Layout:
- cheetahclaws.py -> cheetahclaws/cli.py (the entry module)
- cheetahclaws/__init__.py -> light package root: defines VERSION and
lazily proxies CLI entry symbols via PEP
562 __getattr__ (submodule-import first to
avoid recursing through cli's own imports)
- cheetahclaws/__main__.py -> `python -m cheetahclaws`
- all 21 single-file modules + 20 sub-packages -> cheetahclaws/*
- agent_templates/ -> cheetahclaws/agent_templates/ (loaded by path)
Imports rewritten across all 448 .py files: 1269 `from NAME` + 126
`import NAME` + 41 dotted `import NAME.sub` absolute imports, 118 string
patch/mock/import_module targets, plus subprocess `-m` argv paths, the
modular plugin f-string loaders, voice/video shim submodule registration,
and embedded driver-script imports — all prefixed with `cheetahclaws.`.
Whole-word matching left RPC names / filenames / unrelated tokens alone.
pyproject: single `cheetahclaws*` package (no py-modules), entry point
`cheetahclaws.cli:main`, package-data repointed under cheetahclaws.*.
Verified: `python -m cheetahclaws --version` and `from cheetahclaws import
config` both work from outside the repo (the original failure); a built
wheel ships cheetahclaws/* with all data files and no bare top-level
modules; full suite 2449 passed, 3 skipped.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The earlier entry described dropping the cc_ prefix to bare names (config/daemon/kernel/mcp_client); that approach re-introduced the install-time namespace collision and was superseded by moving everything under a single cheetahclaws package. Update both the README brief and the docs/news.md detail to describe the package layout, the why, the breaking change for direct importers, and the wheel/full-suite verification. Co-Authored-By: Claude Opus 4.8 (1M context) <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.
No description provided.