The Codegen CLI includes a simplified self-update system that allows users to easily update to the latest version.
- Automatically detects installation method (pip, pipx, uv tool, homebrew, development)
- Checks for updates periodically (once per day by default)
- Shows update notifications when new versions are available
- Fetches stable releases from PyPI
- Update to latest stable version
- Update to specific versions
- Dry-run mode to preview changes
- Legacy mode for simple pip upgrades
- Pre-update validation checks
- Major version update warnings
- Post-update tips and guidance
- List available versions
- Check for updates without installing
- View current and latest versions
# Update to latest stable version
codegen update
# Check for available updates without installing
codegen update --check
# List available versions
codegen update --list
# Show version history
codegen update --history# Update to specific version
codegen update --version 1.2.3
# Preview update without making changes
codegen update --dry-run
# Force update check (bypass cache)
codegen update --force
# Use legacy pip upgrade method
codegen update --legacyThe update system fetches stable releases from PyPI. Pre-release versions are automatically filtered out to ensure stability. Only production-ready versions are shown and available for installation through the update command.
The update system automatically detects how Codegen was installed and uses the appropriate update method:
pip install codegen
# Updates via: pip install --upgrade codegenpipx install codegen
# Updates via: pipx upgrade codegenuv tool install codegen
# Updates via: uv tool install --upgrade codegenbrew install codegen
# Updates via: brew upgrade codegenFor development/editable installs, the update system will notify you to update via git:
git pull origin main
pip install -e .The update system performs a streamlined update process:
- Version Check: Fetches available versions from PyPI
- Comparison: Compares current version with available versions
- Confirmation: Asks for user confirmation before proceeding
- Installation: Uses the appropriate package manager to update
- Verification: Displays success message and restart instructions
When updating to a new major version:
- The system warns about potential breaking changes
- Post-update tips are displayed
- Users are encouraged to check the changelog
The CLI checks for updates periodically and shows notifications when new versions are available:
ℹ️ A new version of Codegen CLI is available: 1.2.3
Run 'codegen update' to upgrade
To disable automatic update checks, set the environment variable:
export CODEGEN_DISABLE_UPDATE_CHECK=1If an update causes issues, you can downgrade to a previous version:
# Downgrade to a specific version
codegen update --version 1.2.2
# Or use your package manager directly
pip install codegen==1.2.2
pipx install codegen==1.2.2 --force
uv tool install codegen==1.2.2 --upgradeUpdate settings are stored in ~/.codegen/:
update_check.json- Last update check timestamp and cache
-
Try using the legacy update method:
codegen update --legacy
-
Manually update via pip:
pip install --upgrade codegen
-
Check installation method:
which codegen pip show codegen
If you get permission errors, you may need to use sudo (not recommended) or update your user installation:
# For user installation
pip install --user --upgrade codegen
# For pipx
pipx upgrade codegenIf you need to downgrade:
-
Use the update command with a specific version:
codegen update --version 1.2.2
-
Or manually install the desired version:
pip install codegen==1.2.2 pipx install codegen==1.2.2 --force uv tool install codegen==1.2.2 --upgrade
Test the update system in development:
# Check current version
codegen --version
# Test update check
codegen update --check --force
# Test dry-run update
codegen update --dry-run
# Test specific version
codegen update --version 1.2.3 --dry-runTo add new update features:
- Modify
updater.pyfor core functionality - Update command options in
main.py - Add tests for new functionality
from codegen.cli.commands.update import UpdateManager
manager = UpdateManager()
# Check for updates
result = manager.check_for_updates(force=True)
# Perform update
success = manager.perform_update(target_version="1.2.3", dry_run=False)
# Check installation method
print(manager.install_method)from codegen.cli.commands.update.updater import InstallMethod
methods = [
InstallMethod.PIP,
InstallMethod.PIPX,
InstallMethod.UV_TOOL,
InstallMethod.HOMEBREW,
InstallMethod.DEVELOPMENT,
InstallMethod.UNKNOWN
]- Regular Updates: Keep your CLI updated for latest features and security fixes
- Check Changelog: Review breaking changes before major version updates
- Test in Dev: Test updates in development environment first
- Use Dry Run: Preview updates with
--dry-runbefore applying - Report Issues: Report update issues to help improve the system
- Updates are fetched over HTTPS from PyPI
- Package signatures are verified by pip/pipx/uv
- Pre-release versions are filtered out automatically
- Major version updates require confirmation
- Automatic rollback on update failure
- Configuration migration system
- Release notes integration
- Beta and nightly release channels
- Binary distribution for faster updates
- Automatic security update installation
- Update progress with detailed logging
- Network proxy support
- Offline update packages