Fix version resolution and detect install conflicts - #334
Open
ump45nose wants to merge 1 commit into
Open
Conversation
Contributor
|
Thanks @ump45nose, good fix approach. Please comment on #333 and claim the issue first (GFI, unclaimed duplicates clutter the backlog). Before merge:
Re-run |
Harden _package_version_str and get_installed_version so corrupt or duplicate install metadata never prints vNone; add detect_install_conflicts, skillware doctor --install, and a startup advisory. Fixes ARPAHLS#333
ump45nose
force-pushed
the
fix/333-version-resolver-install-conflicts
branch
from
September 4, 2026 15:08
7d362b2 to
da757de
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes #333 — the CLI prints
vNone/skillware Nonewhen a maintainer mixes editable and PyPI installs on the same Python and pip leaves duplicate/orphanskillwaredistribution metadata.The root cause is
_package_version_str()/get_installed_version()treating corrupt metadata as a valid "None" string and the fallback returningimportlib.metadata.version("skillware")verbatim. This PR hardens both, adds conflict detection, and surfaces it viaskillware doctor --installplus a startup advisory.Changes
skillware/version_policy.pyget_installed_version()now treats"","dev", and literal"None"as invalid (returnsNone).detect_install_conflicts()— flags duplicate distributions, missingMetadata-Version, unparseable versions, orphan.dist-infodirs (noMETADATA/RECORD), and editable+wheel coexistence on one interpreter.InstallConflictdataclass withcode,summary, and Windows/Unix fix commands.skillware/cli.py_package_version_str()never returnsNoneor empty — final fallback is"dev".emit_install_conflict_advisory()— one dim stderr line on CLI startup when conflicts are detected.skillware doctor --install— reports install version + health, lists each conflict with copy-paste Windows/Unix fix commands. Exit 0 = healthy, 1 = conflicts.CONTRIBUTING.md— new "Editable vs PyPI on the same Python" subsection documenting one-mode-per-interpreter, uninstall-before-switching, and orphan cleanup.CHANGELOG.md— entries under[Unreleased].docs/usage/cli.md— documentsskillware doctor --install.Type of Change
skillware/cli.py,docs/usage/cli.mdChecklist (all PRs)
Fixes #333)python -m black --check .passes locallyflake8 .passes locallypytest tests/passes for affected modules (tests/test_cli.py,tests/test_version_policy.py— 87 passed)CHANGELOG.mdupdated under[Unreleased](user-visible behavior change)skills/files changed (skill checklist omitted)Testing
python -m black --check .→ all files unchanged.python -m flake8 .→ clean.python -m pytest tests/test_version_policy.py tests/test_cli.py -q→ 87 passed.skillware doctor --installreports the editable+wheel mix and duplicate distribution that actually exist in the local venv (exit 1), and the startup advisory prints when conflicts exist.Note: the full
pytest tests//pytest skills/suites require the[dev,all]extras (google-genai, playwright, PIL, etc.) that are not installed in this local venv; CI installs them viapip install -e ".[dev,all]"and remains authoritative.AI assistance
This contribution was drafted with AI assistance. Per the repository's Agent Code of Conduct, no AI tool or agent is added to
Co-authored-by:trailers.Related Issues