♻️ refactor: rewrite with standalone python_discovery from virtualenv#28
Merged
gaborbernat merged 1 commit intotox-dev:mainfrom Feb 25, 2026
Merged
♻️ refactor: rewrite with standalone python_discovery from virtualenv#28gaborbernat merged 1 commit intotox-dev:mainfrom
gaborbernat merged 1 commit intotox-dev:mainfrom
Conversation
cbb3365 to
b59b295
Compare
The original py-discovery package was a thin stub. This replaces it with the battle-tested interpreter discovery engine extracted from virtualenv, renamed from py_discovery to python_discovery. The rewrite brings a complete implementation: spec-based interpreter matching, filesystem and registry discovery, caching with file locks, PEP 514 Windows support, version specifiers, and version manager shim resolution (pyenv/mise/asdf). Full type annotations target Python 3.8+ with ty verification against both 3.8 and 3.14. Documentation follows Diataxis structure with tutorial, how-to, explanation, and API reference.
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.
The
python_discoverypackage was extracted from virtualenv as a self-contained module with zero virtualenv imports and relative-only internal imports. This rewrites the standalonetox-dev/py-discoveryrepo to use that extracted code, replacing the old implementation entirely.The package now ships as
python-discovery(import namepython_discovery) with full support for Python 3.8 through 3.14. It includes interpreter discovery via PATH and PEP 514 (Windows registry), aDiskCachefor subprocess-basedPythonInforesolution, andPythonSpecparsing with architecture, machine ISA, and free-threading support. Runtime features like@dataclass(kw_only=True, slots=True)are conditionally enabled on Python 3.10+ while maintaining compatibility with older versions.Project tooling follows the
pytest-envpattern:hatchling+hatch-vcsbuild,tox-uvtest runner,rufflinting withALLrules,tytype checking across 3.8 and 3.14, and 100% branch coverage enforced viacovdefaults. Documentation uses the Diataxis layout withfurotheme on ReadTheDocs.