Skip to content

Commit b0350ba

Browse files
committed
Release 3.0.4
1 parent dfd2316 commit b0350ba

7 files changed

Lines changed: 79 additions & 65 deletions

File tree

CHANGELOG.rst

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,81 @@
1+
3.0.4 (2026-06-09)
2+
==================
3+
4+
Features & Improvements
5+
-----------------------
6+
7+
- Add ``Finder(pyenv_only=True)`` to restrict discovery to pyenv-managed Python installations. `#3855 <https://github.com/sarugaku/pythonfinder/issues/3855>`_
8+
9+
10+
Bug Fixes
11+
---------
12+
13+
- * Convert away from pydantic to reduce complexity; simplify the path manipulation logics to use pathlib. `#157 <https://github.com/sarugaku/pythonfinder/issues/157>`_
14+
15+
- Fix full-version matching for Python installations discovered via the Windows
16+
py launcher.
17+
18+
``py --list-paths`` only reports ``major.minor`` (e.g. ``3.11``), so
19+
``PyLauncherFinder`` was storing ``patch=None`` for every entry. Callers that
20+
searched for a specific full version such as ``3.11.9`` (e.g. from
21+
``python_full_version`` in a Pipfile) received no match because
22+
``matches(patch=9)`` evaluated ``None == 9 → False``.
23+
24+
The finder now queries each discovered executable for its real version string
25+
(e.g. ``3.11.9``) via ``get_python_version()`` after the py-launcher lookup,
26+
so that full-version searches succeed. If the executable cannot be queried the
27+
code falls back gracefully to the ``major.minor`` string reported by the py
28+
launcher. `#158 <https://github.com/sarugaku/pythonfinder/issues/158>`_
29+
30+
- Treat any ``Path.exists()`` ``OSError`` as an inaccessible path during discovery, allowing FUSE and network mount failures to be skipped cleanly. `#4898 <https://github.com/sarugaku/pythonfinder/issues/4898>`_
31+
32+
- Refactor pythonfinder for improved efficiency and PEP 514 support
33+
Summary
34+
35+
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.
36+
Motivation
37+
38+
The original pythonfinder implementation had several issues:
39+
40+
Complex object wrapping with paths as objects, leading to excessive recursion
41+
Tight coupling between classes making the code difficult to follow and maintain
42+
Broken Windows registry support (PEP 514)
43+
Performance issues due to redundant path scanning and inefficient caching
44+
45+
Changes
46+
47+
Architecture: Replaced inheritance-heavy design with a composition-based approach using specialized finders
48+
Data Model: Simplified the data model with a clean PythonInfo dataclass
49+
Windows Support: Implemented proper PEP 514 support for Windows registry
50+
Performance: Improved caching and reduced redundant operations
51+
Error Handling: Added more specific exceptions and better error handling
52+
53+
Features
54+
55+
The refactored implementation continues to support all required features:
56+
57+
System and user PATH searches
58+
pyenv installations
59+
asdf installations
60+
Windows registry (PEP 514) - now working correctly
61+
62+
Implementation Details
63+
64+
The new implementation is organized into three main components:
65+
66+
Finders: Specialized classes for finding Python in different locations
67+
SystemFinder: Searches in the system PATH
68+
PyenvFinder: Searches in pyenv installations
69+
AsdfFinder: Searches in asdf installations
70+
WindowsRegistryFinder: Implements PEP 514 for Windows registry
71+
72+
Models: Simple data classes for storing Python information
73+
PythonInfo: Stores information about a Python installation
74+
75+
Utils: Utility functions for path and version handling
76+
path_utils.py: Path-related utility functions
77+
version_utils.py: Version-related utility functions `#rewrite-3.0 <https://github.com/sarugaku/pythonfinder/issues/rewrite-3.0>`_
78+
179
2.0.6 (2023-10-19)
280
==================
381

news/157.bugfix.rst

Lines changed: 0 additions & 1 deletion
This file was deleted.

news/158.bugfix.rst

Lines changed: 0 additions & 15 deletions
This file was deleted.

news/3855.feature.rst

Lines changed: 0 additions & 1 deletion
This file was deleted.

news/4898.bugfix.rst

Lines changed: 0 additions & 1 deletion
This file was deleted.

news/rewrite-3.0.bugfix.rst

Lines changed: 0 additions & 46 deletions
This file was deleted.

src/pythonfinder/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44
from .models.python_info import PythonInfo
55
from .pythonfinder import Finder
66

7-
__version__ = "3.0.4.dev0"
7+
__version__ = "3.0.4"
88

99
__all__ = ["Finder", "PythonInfo", "InvalidPythonVersion", "PythonNotFound"]

0 commit comments

Comments
 (0)