Skip to content

fix(bundle): include shell lazy imports in PyInstaller build#107

Merged
jexShain merged 4 commits intoAI-Shell-Team:mainfrom
F16shen:fix/pyinstaller-shell-lazy-imports
Apr 15, 2026
Merged

fix(bundle): include shell lazy imports in PyInstaller build#107
jexShain merged 4 commits intoAI-Shell-Team:mainfrom
F16shen:fix/pyinstaller-shell-lazy-imports

Conversation

@F16shen
Copy link
Copy Markdown
Collaborator

@F16shen F16shen commented Apr 15, 2026

Summary

This PR fixes a release-blocking bundle startup regression introduced in the 0.2.1 release path.

During Release Preparation validation, the installed Linux bundle failed to start aish after installation with:

Import error: No module named 'aish.shell.entry'
This binary may not be built correctly.

Root Cause

aish.shell exposes shell entry points through lazy package exports in src/aish/shell/__init__.py.
The standalone binary is built with PyInstaller, but the spec only listed aish.shell as a hidden import and did not explicitly collect the lazily imported aish.shell.* submodules.

That meant the bundle could successfully build, but the installed aish binary failed at runtime once the CLI tried to import run_shell through the lazy export path.

Changes

Fixed

  • Updated aish.spec to collect aish.shell submodules with collect_submodules('aish.shell') so lazy shell imports are bundled into the standalone binary.
  • Added a packaging regression test to guard the PyInstaller spec configuration for lazy shell imports.
  • Updated the 0.2.1 changelog entry to describe the actual standalone bundle startup fix.

Validation

Automated

  • /home/lixin/workspace/aishell/aish/.venv/bin/python -m pytest tests/scripts/packaging/test_update_release_files.py tests/scripts/packaging/test_release_metadata.py tests/scripts/packaging/test_pyinstaller_spec.py -q
  • make test
  • Result: 569 passed, 15 skipped

Manual release-path verification

  • Rebuilt standalone binaries with make build-binary
  • Verified ./dist/aish run --model openai/gpt-4o-mini --api-key dummy can start the interactive shell in a PTY and exit cleanly
  • Rebuilt release bundle staging via make build-bundle far enough to install artifacts into build/bundle/aish-0.2.1-linux-x86_64/rootfs
  • Verified the staged installed binary build/bundle/aish-0.2.1-linux-x86_64/rootfs/usr/bin/aish run --model openai/gpt-4o-mini --api-key dummy can also enter the interactive shell and exit cleanly

Files

  • aish.spec
  • tests/scripts/packaging/test_pyinstaller_spec.py
  • CHANGELOG.md

@github-actions github-actions Bot added dependencies Pull requests that update a dependency file ci-cd docs packaging Packaging or installation issue core tests labels Apr 15, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Thanks for the pull request. A maintainer will review it when available.

Please keep the PR focused, explain the why in the description, and make sure local checks pass before requesting review.

Contribution guide: https://github.com/AI-Shell-Team/aish/blob/main/CONTRIBUTING.md

@github-actions
Copy link
Copy Markdown
Contributor

This pull request description looks incomplete. Please update the missing sections below before review.

Missing items:

  • User-visible Changes
  • Compatibility
  • Testing
  • Change Type
  • Scope

@github-actions github-actions Bot removed dependencies Pull requests that update a dependency file ci-cd core labels Apr 15, 2026
@F16shen F16shen requested a review from jexShain April 15, 2026 06:21
@jexShain jexShain merged commit 4667930 into AI-Shell-Team:main Apr 15, 2026
10 checks passed
@F16shen F16shen deleted the fix/pyinstaller-shell-lazy-imports branch April 16, 2026 03:33
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.

2 participants