fix: always bundle runpod-flash in flash build + versioning report#227
fix: always bundle runpod-flash in flash build + versioning report#227
Conversation
runpod_flash is now unconditionally bundled from site-packages during every build, making --use-local-flash unnecessary. Adds __version__ constant to __init__.py so bundled code carries its own version for accurate runtime reporting in deployed workers. - Rename copy functions to reflect site-packages source - Remove --use-local-flash from deploy command and docs - Add tests for unconditional bundling behavior - Update dotenv test to allow __version__ before imports
Added x-release-please-version annotation to __init__.py and configured extra-files in release-please-config.json so __version__ is bumped automatically on each release.
importlib.metadata reads the pip-installed version, which differs from the bundled version inside worker containers. Using __version__ ensures the user-agent reports the actual running version.
There was a problem hiding this comment.
Pull request overview
This PR fixes stale version reporting in Flash worker containers by ensuring the bundled runpod_flash package is always the source of truth (both for runtime execution and for version/user-agent reporting), and removes the confusing --use-local-flash development flag.
Changes:
- Make
flash buildalways bundlerunpod_flashfrom the current environment and remove--use-local-flashfrom build/deploy commands and docs. - Add
runpod_flash.__version__and update User-Agent generation to read from it instead ofimportlib.metadata. - Configure release-please to bump
src/runpod_flash/__init__.pyversion automatically; adjust/add unit tests for the new bundling behavior.
Reviewed changes
Copilot reviewed 9 out of 10 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
uv.lock |
Bumps locked version for runpod-flash to 1.4.1. |
tests/unit/test_dotenv_loading.py |
Updates import-order assertion logic to match new __init__.py layout. |
tests/unit/cli/commands/test_build.py |
Adds bundling-related tests and _find_runpod_flash tests; updates existing build tests for unconditional bundling. |
src/runpod_flash/core/utils/user_agent.py |
Switches version source for User-Agent to runpod_flash.__version__. |
src/runpod_flash/cli/docs/flash-deploy.md |
Removes --use-local-flash docs and local-dev section. |
src/runpod_flash/cli/docs/README.md |
Removes --use-local-flash from deploy options list. |
src/runpod_flash/cli/commands/deploy.py |
Removes --use-local-flash option wiring. |
src/runpod_flash/cli/commands/build.py |
Implements unconditional bundling flow and removes flag-driven logic. |
src/runpod_flash/__init__.py |
Adds __version__ constant for bundled version reporting. |
release-please-config.json |
Adds extra-files entry so release-please bumps __version__. |
Comments suppressed due to low confidence (2)
src/runpod_flash/init.py:4
- The comment says ".env vars ... before everything else", but
__version__is now defined above the dotenv import. Either adjust the comment to reflect the new ordering (e.g., "before other imports") or move__version__below the dotenv load if you truly intend dotenv to run first.
__version__ = "1.4.1" # x-release-please-version
# Load .env vars from file before everything else
from dotenv import load_dotenv
src/runpod_flash/core/utils/user_agent.py:15
- The docstring example hard-codes a specific version string (
1.4.1). This will go stale on the next release and can cause confusion when comparing actual output. Consider using a placeholder in the example (e.g.,<version>) or omitting the exact version value.
Example:
>>> get_user_agent()
'Runpod Flash/1.4.1 (Python 3.11.12; Darwin 25.2.0; arm64)'
"""
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Package names are case-insensitive per PEP 503, so entries like `Runpod-Flash` or `RUNPOD_FLASH` in requirements.txt would survive filtering and reintroduce the duplicated-install conflict.
…tches Patches were entered immediately on ExitStack before the `with` block started, risking leaks if an exception occurred during setup. Wrapping in @contextmanager ensures patch lifetime is strictly scoped.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 9 out of 10 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Problem
When a Flash app is deployed, the worker container has two copies of
runpod_flash: one pip-installed in the base image, and one bundled duringflash build. The bundled copy is the one that actually executes at runtime (viasys.path.insertafter unpack), but version reporting was reading from the pip-installed metadata — reporting stale versions in both the startup banner and HTTP User-Agent headers.Additionally,
--use-local-flashwas a development-only flag that created confusion about how bundling works. Flash should always bundle from the installed environment.Changes
Always bundle
runpod_flashduring buildflash buildnow unconditionally copiesrunpod_flashfrom site-packages into the build artifact--use-local-flashflag frombuildanddeploycommands and CLI docsAccurate version sourcing via
__version____version__to__init__.pyso the bundled package carries its version with ituser_agent.py) now readsrunpod_flash.__version__instead ofimportlib.metadata.version(), ensuring HTTP requests from inside worker containers report the actual bundled versionextra-filesto auto-bump__version__on each release (zero maintenance)Companion PR
__version__from bundledrunpod_flashfor startup banner)Test plan
make quality-checkpasses (1263 tests, 73% coverage)