fix(cli): include models package in wheel#325
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Welcome @mrinalchaturvedi27! It looks like this is your first PR to volcano-sh/agentcube 🎉 |
There was a problem hiding this comment.
Code Review
This pull request updates the packaging configuration in pyproject.toml to use automatic package discovery and introduces the agentcube.models package. A new test was added to verify that the models package is correctly included. Feedback from the reviewer suggests adding setuptools to the test dependencies for environment consistency and expanding the packaging test to verify all expected sub-packages to prevent future regressions.
There was a problem hiding this comment.
Pull request overview
Fixes the Python CLI wheel packaging so the agentcube.models subpackage is included in built wheels, preventing runtime ModuleNotFoundError failures when the CLI imports agentcube.models.pack_models.
Changes:
- Add
agentcube/models/__init__.pysoagentcube.modelsis a proper package for setuptools discovery. - Switch
cmd/cli/pyproject.tomlto setuptools package auto-discovery ([tool.setuptools.packages.find]) instead of a hand-maintained package list. - Add a packaging discovery unit test and CI smoke checks that install the built wheel and run
kubectl-agentcube --help.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| cmd/cli/tests/test_packaging.py | Adds a unit test to validate package discovery includes agentcube.models. |
| cmd/cli/pyproject.toml | Updates setuptools configuration to use package auto-discovery for agentcube*. |
| cmd/cli/agentcube/models/init.py | Introduces agentcube.models as an importable package. |
| .github/workflows/python-cli-tests.yml | Adds PR/merge-queue workflow to test/build/install the CLI wheel and smoke-run the entrypoint. |
| .github/workflows/python-cli-publish.yml | Adds a pre-publish wheel-install smoke check. |
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #325 +/- ##
==========================================
+ Coverage 47.57% 47.74% +0.17%
==========================================
Files 30 30
Lines 2819 2855 +36
==========================================
+ Hits 1341 1363 +22
- Misses 1338 1344 +6
- Partials 140 148 +8
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Signed-off-by: Mrinal Chaturvedi <mrinal.chaturvedi27@gmail.com>
Signed-off-by: Mrinal Chaturvedi <mrinal.chaturvedi27@gmail.com>
ddcfb55 to
ffcac52
Compare
| cli: | ||
| - "cmd/cli/**" | ||
| - "Makefile" | ||
| - ".github/workflows/python-cli-tests.yml" |
There was a problem hiding this comment.
Can we include .github/workflows/python-cli-publish.yml in this filter too? Changes to the release workflow are otherwise allowed to skip the CLI build/install smoke path, so a publish-only workflow edit would not be exercised until tag time.
There was a problem hiding this comment.
Thank you for the review @acsoto. I have made the described fix. Please let me know if you want any other specific change :)
Signed-off-by: Mrinal Chaturvedi <mrinal.chaturvedi27@gmail.com>
ffcac52 to
673905f
Compare
|
/lgtm |
hzxuzhonghu
left a comment
There was a problem hiding this comment.
Good fix for the missing models package.
cmd/cli/pyproject.toml
- Lines 64-67: Switching from an explicit package list to
find_packageswithinclude = ["agentcube*"]is the right call - it prevents future packages from being silently excluded from the wheel.
cmd/cli/agentcube/models/__init__.py
- Needed for package discovery. Good.
.github/workflows/python-cli-publish.yml
- Lines 34-38: The smoke-test step (install wheel into a clean venv and run
--help) is a useful gate. Note that it only verifies the CLI entrypoint loads, not that all subpackages are importable. Consider adding animport agentcube.modelscheck to catch the specific regression this PR fixes.
cmd/cli/tests/test_packaging.py
- Line 21-32: Good regression test using
find_packagesto verify all expected packages are discovered.
LGTM.
Description
What type of PR is this?
/kind bug
What I fixed
I fixed the Python CLI wheel packaging so
agentcube.modelsis included after a normal wheel install. The CLI entry point can now importagentcube.models.pack_modelsinstead of crashing withModuleNotFoundError.How I found it
I started from the reported importers in
cmd/cli/agentcube/cli/main.py,cmd/cli/agentcube/runtime/pack_runtime.py, andcmd/cli/agentcube/runtime/__init__.py. The source tree hadagentcube/models/pack_models.py, but there was noagentcube/models/__init__.py, andcmd/cli/pyproject.tomllisted packages manually withoutagentcube.models.What I changed
cmd/cli/agentcube/models/__init__.py.setuptools.packages.find, matching the Python SDK style.agentcube.models.kubectl-agentcube --help.Why this is legit
This keeps the package layout aligned with the existing
agentcube*Python package structure instead of maintaining a fragile hand-written package list. The added CI checks the actual installed-wheel path that broke for users, so source-tree imports will not hide this class of issue again.Tests
.venv/bin/python -m ruff check . --config pyproject.toml- Passed.git diff --check- Passed.Notes
I did not run Go or Kubernetes codegen because this change only touches the Python CLI packaging and CI workflow.