-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor pythonfinder for improved efficiency and PEP 514 support #6360
Open
matteius
wants to merge
32
commits into
main
Choose a base branch
from
python-finder-rewrite
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains 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
42da4d1
to
2468175
Compare
2 tasks
My plan is to port over to pythonfinder and release as version 3.0.0 |
e886363
to
22a9496
Compare
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.
Refactor pythonfinder for improved efficiency and PEP 514 support
Summary
This PR completely refactors the pythonfinder module to improve efficiency, reduce logical errors, and fix support for PEP 514 (Python registration in the Windows registry). The refactoring replaces the complex object hierarchy with a more modular, composition-based approach that is easier to maintain and extend.
Motivation
The original pythonfinder implementation had several issues:
Changes
PythonInfo
dataclassFeatures
The refactored implementation continues to support all required features:
Implementation Details
The new implementation is organized into three main components:
Finders: Specialized classes for finding Python in different locations
SystemFinder
: Searches in the system PATHPyenvFinder
: Searches in pyenv installationsAsdfFinder
: Searches in asdf installationsWindowsRegistryFinder
: Implements PEP 514 for Windows registryModels: Simple data classes for storing Python information
PythonInfo
: Stores information about a Python installationUtils: Utility functions for path and version handling
path_utils.py
: Path-related utility functionsversion_utils.py
: Version-related utility functionsTesting
Basic functionality has been tested with a test script that successfully finds Python installations and retrieves their version information. More comprehensive testing, especially on Windows, is recommended before merging.
Future Work
Related Issues
Fixes #XXX (PEP 514 support)
Addresses #YYY (Performance issues)
Breaking Changes
This is a complete refactoring of the pythonfinder module, so it includes breaking changes to the internal API. However, the public API (
Finder
class) maintains compatibility with the original implementation.The checklist
Fixes #5893
Fixes #6147
Fixes #6026
Fixes #5662 (possibly)
news/
directory to describe this fix with the extension.bugfix.rst
,.feature.rst
,.behavior.rst
,.doc.rst
..vendor.rst
. or.trivial.rst
(this will appear in the release changelog). Use semantic line breaks and name the file after the issue number or the PR #.