Skip to content

fix(cli): include models package in wheel#325

Open
mrinalchaturvedi27 wants to merge 3 commits into
volcano-sh:mainfrom
mrinalchaturvedi27:fix-cli-models-package
Open

fix(cli): include models package in wheel#325
mrinalchaturvedi27 wants to merge 3 commits into
volcano-sh:mainfrom
mrinalchaturvedi27:fix-cli-models-package

Conversation

@mrinalchaturvedi27
Copy link
Copy Markdown
Contributor

@mrinalchaturvedi27 mrinalchaturvedi27 commented May 12, 2026

Description

What type of PR is this?

/kind bug

What I fixed

I fixed the Python CLI wheel packaging so agentcube.models is included after a normal wheel install. The CLI entry point can now import agentcube.models.pack_models instead of crashing with ModuleNotFoundError.

How I found it

I started from the reported importers in cmd/cli/agentcube/cli/main.py, cmd/cli/agentcube/runtime/pack_runtime.py, and cmd/cli/agentcube/runtime/__init__.py. The source tree had agentcube/models/pack_models.py, but there was no agentcube/models/__init__.py, and cmd/cli/pyproject.toml listed packages manually without agentcube.models.

What I changed

  • I added cmd/cli/agentcube/models/__init__.py.
  • I switched the CLI pyproject to setuptools.packages.find, matching the Python SDK style.
  • I added a focused packaging discovery test for agentcube.models.
  • I added PR and publish workflow smoke tests that install the built CLI wheel and run 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

  • Screenshot 2026-05-12 at 3 38 10 PM
  • Screenshot 2026-05-12 at 3 38 31 PM
  • Screenshot 2026-05-12 at 3 39 06 PM
  • Screenshot 2026-05-12 at 3 39 30 PM
  • .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.

Copilot AI review requested due to automatic review settings May 12, 2026 10:12
@volcano-sh-bot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign hzxuzhonghu for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@volcano-sh-bot
Copy link
Copy Markdown
Contributor

Welcome @mrinalchaturvedi27! It looks like this is your first PR to volcano-sh/agentcube 🎉

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread cmd/cli/tests/test_packaging.py
Comment thread cmd/cli/tests/test_packaging.py Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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__.py so agentcube.models is a proper package for setuptools discovery.
  • Switch cmd/cli/pyproject.toml to 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.

Comment thread cmd/cli/tests/test_packaging.py Outdated
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented May 12, 2026

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 47.74%. Comparing base (524e55e) to head (673905f).
⚠️ Report is 41 commits behind head on main.
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

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     
Flag Coverage Δ
unittests 47.74% <ø> (+0.17%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Signed-off-by: Mrinal Chaturvedi <mrinal.chaturvedi27@gmail.com>
Signed-off-by: Mrinal Chaturvedi <mrinal.chaturvedi27@gmail.com>
cli:
- "cmd/cli/**"
- "Makefile"
- ".github/workflows/python-cli-tests.yml"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
@acsoto
Copy link
Copy Markdown
Member

acsoto commented May 23, 2026

/lgtm

Copy link
Copy Markdown
Member

@hzxuzhonghu hzxuzhonghu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good fix for the missing models package.

cmd/cli/pyproject.toml

  • Lines 64-67: Switching from an explicit package list to find_packages with include = ["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 an import agentcube.models check to catch the specific regression this PR fixes.

cmd/cli/tests/test_packaging.py

  • Line 21-32: Good regression test using find_packages to verify all expected packages are discovered.

LGTM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants