Skip to content

Packagify cheetahclaws#146

Merged
chauncygu merged 2 commits into
mainfrom
packagify-cheetahclaws
Jun 16, 2026
Merged

Packagify cheetahclaws#146
chauncygu merged 2 commits into
mainfrom
packagify-cheetahclaws

Conversation

@chauncygu

Copy link
Copy Markdown
Contributor

No description provided.

chauncygu and others added 2 commits June 16, 2026 11:34
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>
@chauncygu chauncygu merged commit e562878 into main Jun 16, 2026
4 of 6 checks passed
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.

1 participant