Skip to content

Upload .py source instead of .pyc bytecode for Python version robustness - #108

Merged
szachovy merged 2 commits into
masterfrom
fix/41-python-version-guard
Apr 9, 2026
Merged

Upload .py source instead of .pyc bytecode for Python version robustness#108
szachovy merged 2 commits into
masterfrom
fix/41-python-version-guard

Conversation

@szachovy

@szachovy szachovy commented Apr 8, 2026

Copy link
Copy Markdown
Owner

Replace the hardcoded Python 3.10 .pyc magic number and bytecode compilation with plain .py source upload. The remote node's Python compiles at runtime, decoupling the host Python version from the container Python version.

Changes

  • src/remote.py: Remove compile()/marshal/.pyc header from run_python_container_command(), upload .py source and execute via python3; remove unused marshal import
  • src/initialize.py: Add minimum version guard (>= 3.10) with clear error message at startup
  • README.md: Update host Python requirement from exact v3.10.12 to >= 3.10
  • docs/ARCHITECTURE.md: Update remote execution model description from bytecode to source
  • CHANGELOG.md: Add entry

Why not a version guard?

A strict == 3.10 guard artificially limits the project to a single Python version. The root cause was the hardcoded .pyc magic number — by uploading .py source instead, the container Python handles compilation at runtime (<100ms overhead), and any Python >= 3.10 works on the host.

Closes #38
Closes #41

@szachovy
szachovy force-pushed the fix/41-python-version-guard branch 2 times, most recently from 15cfc84 to 1dbedb8 Compare April 9, 2026 09:07
@szachovy szachovy changed the title Add Python version guard to entry point Upload .py source instead of .pyc bytecode for Python version robustness Apr 9, 2026
Replace the hardcoded Python 3.10 .pyc magic number and bytecode
compilation with plain .py source upload. The remote node's Python
compiles at runtime, decoupling the host Python version from the
container Python version.

- Remove compile()/marshal/.pyc header from run_python_container_command,
  upload .py source and execute via python3
- Remove unused marshal import from remote.py
- Add minimum version guard (>= 3.10) in initialize.py
- Update README to require Python >= 3.10 on the host
- Update ARCHITECTURE.md to reflect source execution model

Closes #38
Closes #41

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@szachovy
szachovy force-pushed the fix/41-python-version-guard branch from 1dbedb8 to 51499b1 Compare April 9, 2026 10:08
@szachovy
szachovy merged commit c6291b8 into master Apr 9, 2026
12 checks passed
@szachovy
szachovy deleted the fix/41-python-version-guard branch April 9, 2026 12:06
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.

RP-4: No runtime Python version guard at entry point RP-1: Hardcoded Python 3.10 .pyc magic number locks host Python version

1 participant