Skip to content

feat(build): match local Python version by default#351

Open
deanq wants to merge 1 commit into
mainfrom
deanq/sls-python-parity-by-default
Open

feat(build): match local Python version by default#351
deanq wants to merge 1 commit into
mainfrom
deanq/sls-python-parity-by-default

Conversation

@deanq

@deanq deanq commented Jul 6, 2026

Copy link
Copy Markdown
Member

What

Makes flash build / flash deploy resolve the app Python version from the local interpreter (sys.version_info) when no --python-version override and no per-resource python_version is declared — replacing the hardcoded 3.12 fallback. An unsupported local interpreter (e.g. 3.9, 3.14) raises an actionable error. The build prints the resolved version and its source (matched local interpreter / --python-version override / declared on resource X).

Why

Supersedes #330. That branch was cut from the #346 merge (since reverted via #350) and its files were corrupted by a bad conflict resolution. The "add 3.13" half of #330 already landed on main independently; the only genuinely-unmerged piece was this match-local behavior, extracted here cleanly against current main.

Resolution order (unchanged except the fallback):

  1. --python-version override (validated; must match any per-resource declarations)
  2. Exactly one distinct per-resource python_version
  3. Local interpreter (was: hardcoded DEFAULT_PYTHON_VERSION)

Test plan

  • manifest.py::_reconcile_python_version: new TestReconcileLocalInterpreter — parametrized local-match (3.10–3.13), unsupported-local raises with actionable message, override/declaration are not shadowed by local.
  • Updated existing tests that asserted the old 3.12 fallback to assert local-match (via monkeypatch of sys.version_info) or an explicit override.
  • build.py::_python_version_source: unit tests for override / declared / local-match provenance strings.
  • make quality-check green (2580 passed; the 2 TestVersionFlag failures are pre-existing on main — ANSI-color assertion sensitivity, unrelated to this change).

Closes the useful part of #330.

flash build/deploy now resolve the app Python version from the local
interpreter (sys.version_info) when no --python-version override and no
per-resource python_version is declared, instead of a hardcoded 3.12
fallback. An unsupported local interpreter raises an actionable error.
The build prints the resolved version and its source.

Extracted from #330 (which is stale/corrupted and built on the reverted
#346); the 'add 3.13' half of #330 already landed on main, so only the
match-local behavior is carried here.

- manifest.py: _reconcile_python_version falls back to local interpreter
- build.py: _python_version_source() + build-time 'targeting Python X' line
- docs: flash-build/flash-deploy/deploy-guide describe parity-by-default
- tests: local-match, unsupported-local, override/declaration precedence
@capy-ai

capy-ai Bot commented Jul 6, 2026

Copy link
Copy Markdown

Capy auto-review is paused for this organization because the usage-cycle auto-review limit has been reached. Increase the limit or turn it off in billing settings to resume automatic reviews.

@promptless

promptless Bot commented Jul 6, 2026

Copy link
Copy Markdown

Promptless prepared a documentation update related to this change.

Triggered by PR #351 (feat(build): match local Python version by default)

This PR's other user-facing behavior (local-interpreter default, 3.103.13 supported range, resolution order, and the unsupported-interpreter error) is already covered in the published docs. The one net-new surface is the build-time provenance output — flash build now prints the resolved Python version and its source (matched local interpreter / --python-version override / declared on resource <name>). This suggestion documents that.

Note: since PR #351 is still open, the exact output strings may still shift before merge.

Review: Document flash build resolved Python version provenance output

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant