Skip to content

feat(workspace): config-aware version check with YAML bypass - #101

Merged
Jammy2211 merged 1 commit into
mainfrom
feature/workspace-version-config-check
Apr 30, 2026
Merged

Jammy2211 merged 1 commit into
mainfrom
feature/workspace-version-config-check

Conversation

@Jammy2211

Copy link
Copy Markdown
Collaborator

Summary

Extend check_version so workspace/library version mismatches surface on every script run (via check_version(__version__) calls landing in PyAutoFit, PyAutoGalaxy, and PyAutoLens), not just welcome.py. The version is now read from config/general.yaml's version.workspace_version first — so the version travels with the user's config directory even when scripts are copy-pasted out of the workspace root — with version.txt retained as a legacy fallback. A new version.workspace_version_check: False YAML flag mirrors the existing python_version_check pattern and lets users on main-branch workspace clones (where mismatches are expected because main updates faster than releases) opt out without an env var.

Tracking: #100

API Changes

check_version is unchanged in signature but its resolution and bypass behaviour are extended:

  • New source-of-truth precedence: config/general.yaml → version.txt → warn.
  • New bypass: version.workspace_version_check: False in general.yaml.
  • New error and warning messages explicitly point users at the YAML override and call out the main-branch case.

See full details below.

Test Plan

  • pytest test_autoconf/test_workspace.py — 14 tests cover YAML source, bypass flag, fallback, mismatch, unparseable YAML
  • pytest test_autoconf/ — full suite stays green
  • Manual: import a downstream library from a workspace dir → no warning; from /tmp → warning text mentions YAML override and main branch
  • Manual: synthesise a mismatch (workspace_version: 2025.1.1.1 in a tmp config) → error renders with main-branch guidance
Full API Changes (for automation & release notes)

Changed Behaviour

  • autoconf.workspace.check_version(library_version, workspace_root=None) — now reads <workspace_root>/config/general.yaml's version.workspace_version as the primary source, falling back to <workspace_root>/version.txt. Honours version.workspace_version_check: False in general.yaml as a bypass (in addition to the existing PYAUTO_SKIP_WORKSPACE_VERSION_CHECK=1 env var). YAML wins if both sources exist and disagree. Warning and error messages rewritten to surface both bypass mechanisms and the main-branch use case.

Migration

  • No call-site changes required. Existing callers (welcome.py, the new library __init__.py calls landing in PyAutoFit/Galaxy/Lens) work unchanged.
  • Users on main-branch workspace clones who hit the new mismatch error should add to config/general.yaml:
    version:
      workspace_version_check: False

🤖 Generated with Claude Code

@Jammy2211

Copy link
Copy Markdown
Collaborator Author

@Jammy2211
Jammy2211 merged commit 93ad7ca into main Apr 30, 2026
4 checks passed
@Jammy2211
Jammy2211 deleted the feature/workspace-version-config-check branch April 30, 2026 18:16
@Jammy2211 Jammy2211 removed the pending-release PR queued for the next release build label Sep 4, 2026
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