Skip to content

Soften Python version check with general.yaml bypass#96

Merged
Jammy2211 merged 1 commit into
mainfrom
feature/soften-python-version-check
Apr 24, 2026
Merged

Soften Python version check with general.yaml bypass#96
Jammy2211 merged 1 commit into
mainfrom
feature/soften-python-version-check

Conversation

@Jammy2211
Copy link
Copy Markdown
Collaborator

Summary

  • Replaces the hard RuntimeError for Python < 3.12 with a softer check that can be bypassed via version.python_version_check: False in a workspace's config/general.yaml.
  • Updates the error message to accurately describe reality: Python 3.9/3.10/3.11 technically work but aren't officially tested against; 3.12+ is the supported track.
  • Default behaviour on workspaces that haven't opted in is unchanged — the check still raises if Python < 3.12, just with a clearer message that names the working-but-unsupported versions and shows the YAML snippet to bypass.

Why

The PyAutoGPU venv is still on Python 3.10 and was being blocked from importing autoconf entirely, even though nothing in the library actually needs 3.12. The 3.12 cap was a support statement, not a functional dependency. Hard-failing at import is too aggressive — users with known-good older-Python environments should be able to opt in per-workspace.

API Changes

  • autoconf/__init__.py: new private _python_version_check_bypassed() helper that does a minimal yaml.safe_load(Path.cwd() / "config" / "general.yaml") and returns True iff the version.python_version_check key is explicitly False. Any read/parse failure (missing file, missing yaml module, missing key, bad YAML) falls through to the raise, so the default fails safely.
  • The raise now includes the YAML snippet the user needs to add to bypass.

Paired PR

Test plan

  • pytest test_autoconf/ on Python 3.12 (87 passed)
  • On PyAutoGPU (Python 3.10): python -c "import autoconf" with the default True setting → raises with the new multi-line message referencing 3.9/3.10/3.11 and the bypass snippet
  • On PyAutoGPU (Python 3.10): flip to python_version_check: False → import succeeds, scripts/imaging/modeling.py (with PYAUTO_TEST_MODE=2) runs past the version gate into model-fitting
  • cd /tmp && python -c "import autoconf" on 3.10 (no workspace config) → still raises, message unchanged

🤖 Generated with Claude Code

The hard 3.12+ check was preventing stable-but-older Python environments
(e.g. the PyAutoGPU venv still on 3.10) from importing autoconf at all.
The library actually runs fine on 3.9/3.10/3.11 — the 3.12 requirement
was a support statement, not a functional dependency.

The check now:
- Reads `<cwd>/config/general.yaml` for `version.python_version_check`.
- If that key is `False`, import proceeds silently.
- Otherwise raises with a clearer message that names the three Pythons
  that technically work and shows the YAML snippet to add to bypass.

Any failure reading the config (missing file, bad YAML, missing key,
missing `yaml` module) falls through to the raise, so the default
behaviour on an unconfigured workspace is unchanged.

Co-Authored-By: Claude Opus 4.7 <[email protected]>
@Jammy2211 Jammy2211 merged commit b4a2d12 into main Apr 24, 2026
4 checks passed
@Jammy2211 Jammy2211 deleted the feature/soften-python-version-check branch April 24, 2026 14:13
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