Repository navigation
fix: skip workspace version warning outside a workspace (no config/) #191
Description
Overview
autonerves.workspace.check_version runs on every import of autofit / autogalaxy / autolens with workspace_root defaulting to the current working directory. Run from a plain data directory (no workspace at all), it finds no version floor and warns "Cannot verify the workspace ...". Reported by external contributor @HRSAstro in https://github.com/orgs/PyAutoLabs/discussions/13 (comment PyAutoLabs/.github#13 (comment)). The fix makes the no-floor branch silent when the directory does not look like a workspace.
Plan
- When no version floor is found, stay silent if the directory is a package source checkout (as today) or has no
config/directory (not a workspace). - A directory with a
config/but no version keys still warns: that is a genuinely misconfigured workspace. - No walk-up to a parent workspace: a workspace script run from a subdirectory goes from a false warning to silent, same as outside a workspace.
- Update the
check_versionand_is_source_checkoutdocstrings. - Tests: the existing bare-dir warning test creates
config/first; add a bare-dir-is-silent test and aconfig/-present-no-keys-warns test; red on unfixed source first, then green.
Tier: judge — merge mode: human /prm
Detailed implementation plan
Work Classification: Library
Worktree root: ~/Code/PyAutoLabs-wt/workspace-version-warning-outside-workspace/
Affected Repositories
- PyAutoNerves (primary)
Branch Survey
| Repository | Current Branch | Dirty? |
|---|---|---|
| ./organs/PyAutoNerves | main | clean |
Suggested branch: feature/workspace-version-warning-outside-workspace
Implementation Steps
autonerves/workspace.py: add_looks_like_workspace(root)returning(root / "config").is_dir()(every workspace shipsconfig/;version.txtis already consumed earlier incheck_version).- In
check_version's no-floor branch:if floor_version is None or floor_version == "": if _is_source_checkout(root) or not _looks_like_workspace(root): return _warn_once(_missing_version_warning(root, library_version)) return
- Update the
check_versiondocstring (no-floor paragraph) and_is_source_checkout's docstring to describe both silent cases. - Tests in
test_autonerves/test_workspace.py:test_missing_sources_warns: createtmp_path / "config"first (still warns).- new
test_missing_sources_without_config_dir_is_silent: bare tmp dir underwarnings.simplefilter("error")emits nothing (must fail on unfixed source). - new
test_config_dir_without_general_yaml_or_version_txt_warns. - Source-checkout tests and
test_yaml_without_version_key_falls_through_to_warningunaffected.
- Run the full autonerves suite.
Key Files
autonerves/workspace.py—check_version,_is_source_checkout, new_looks_like_workspacetest_autonerves/test_workspace.py— tests
Reliance check
No repo asserts the warning text. Heart (workspace-validation.yml), Hands (release.yml) and PyAutoLens subprocess tests only set PYAUTO_SKIP_WORKSPACE_VERSION_CHECK=1; unaffected. Risk: a real workspace clone missing config/ stops warning — not a realistic layout.
Original Prompt
Click to expand starting prompt
autonerves check_version warns 'Cannot verify the workspace' from directories that are not a workspace
Type: bug
Target: PyAutoNerves
Repos:
- PyAutoNerves
Themes: - config
- community
Autonomy: supervised
Priority: low
Status: draft
Filed: 2026-10-07
Difficulty: small
Consequence: judge
Witness: with a bare tmp dir (noconfig/, noversion.txt, nosetup.py/pyproject.toml) as cwd,check_version("2026.8.17.1")emits no warning (underwarnings.simplefilter("error")); a tmp dir with an emptyconfig/dir still warns; the existingtest_missing_sources_warnsis updated to createconfig/first and still passes.
Review-minutes: 4
Unattended: ready
Source: GitHub Discussion https://github.com/orgs/PyAutoLabs/discussions/13 (external contributor @HRSAstro, pyuvimage), comment Streaming visibilities for memory efficiency .github#13 (comment); technical review 2026-10-07 (Item D, accept).
Request (verbatim)
- Running a plain script from a data directory triggers the autonerves workspace version warning. It's harmless, but it might be worth skipping when there is no workspace config at all.
What
check_version (autonerves/workspace.py:175) defaults root = Path.cwd(); with no config/general.yaml version keys and no version.txt it warns unless _is_source_checkout(root) (:98, setup.py/pyproject.toml). A plain data directory has none, so _warn_once(_missing_version_warning(...)) (:250-253 region) fires. It runs on import of autofit/autogalaxy/autolens (autofit/__init__.py:175, autogalaxy/__init__.py:141, autolens/__init__.py:163); autoarray does not call it.
Plan
- In the no-floor branch:
with
if floor_version is None or floor_version == "": if _is_source_checkout(root) or not _looks_like_workspace(root): return_looks_like_workspace(root) = (root / "config").is_dir()(every workspace shipsconfig/;version.txtis already consumed above). Aconfig/with no version keys still warns (genuinely misconfigured; keepstest_yaml_without_version_key_falls_through_to_warning). - Update the
check_versiondocstring (:198-202) and_is_source_checkout's. - No walk-up to a parent workspace root: a workspace script run from a subdirectory goes from a false warning to silent (floor unchecked, same as outside a workspace); walking up could find an unrelated parent
config/.
Tests (organs/PyAutoNerves/test_autonerves/test_workspace.py): test_missing_sources_warns (:31) uses a bare tmp_path and will flip — create config/ first; add test_missing_sources_without_config_dir_is_silent; add "config/ present, no general.yaml, no version.txt → warns". Source-checkout tests (:37, :47) unaffected.
Reliance check: no repo asserts the warning text. Heart (workspace-validation.yml:77), Hands (release.yml:474,776) and PyAutoLens subprocess tests (test_tracer_fields.py:527,649, test_analysis_point_gradient_mode.py:214) only set PYAUTO_SKIP_WORKSPACE_VERSION_CHECK=1; unaffected. Risk: a real workspace clone missing config/ stops warning — not a realistic layout.
Activity
Jammy2211 commentedon Oct 7, 2026
Library PR opened: #192 (tests: 241 passed; new silent test red on unfixed source first). Workspace impact: none — option (iii). Tier judge → human /prm.
Jammy2211 commentedon Oct 7, 2026
Shipped — merged in #192 (merge commit 91c2d0e).
check_versionnow stays silent when the working directory is not a workspace (noconfig/directory), so running a plain script from a data directory no longer emits the workspace version warning. Aconfig/with no version keys still warns.Pending release: lands in the next PyAutoNerves release. Reported via https://github.com/orgs/PyAutoLabs/discussions/13 (thanks @HRSAstro).