python-discovery 1.9.4__tar.gz → 1.9.5__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {python_discovery-1.9.4 → python_discovery-1.9.5}/.github/workflows/check.yaml +1 -1
- python_discovery-1.9.5/CONTRIBUTING.md +5 -0
- {python_discovery-1.9.4 → python_discovery-1.9.5}/PKG-INFO +1 -1
- {python_discovery-1.9.4 → python_discovery-1.9.5}/docs/changelog.rst +17 -0
- {python_discovery-1.9.4 → python_discovery-1.9.5}/src/python_discovery/_discovery.py +3 -2
- {python_discovery-1.9.4 → python_discovery-1.9.5}/src/python_discovery/_py_spec.py +17 -14
- {python_discovery-1.9.4 → python_discovery-1.9.5}/tests/test_iter_interpreters.py +24 -0
- {python_discovery-1.9.4 → python_discovery-1.9.5}/tests/test_py_spec_extra.py +19 -15
- {python_discovery-1.9.4 → python_discovery-1.9.5}/.github/FUNDING.yaml +0 -0
- {python_discovery-1.9.4 → python_discovery-1.9.5}/.github/SECURITY.md +0 -0
- {python_discovery-1.9.4 → python_discovery-1.9.5}/.github/THREAT_MODEL.md +0 -0
- {python_discovery-1.9.4 → python_discovery-1.9.5}/.github/dependabot.yaml +0 -0
- {python_discovery-1.9.4 → python_discovery-1.9.5}/.github/release.yaml +0 -0
- {python_discovery-1.9.4 → python_discovery-1.9.5}/.github/workflows/codeql.yaml +0 -0
- {python_discovery-1.9.4 → python_discovery-1.9.5}/.github/workflows/news.yaml +0 -0
- {python_discovery-1.9.4 → python_discovery-1.9.5}/.github/workflows/prepare-release.yaml +0 -0
- {python_discovery-1.9.4 → python_discovery-1.9.5}/.github/workflows/release.yaml +0 -0
- {python_discovery-1.9.4 → python_discovery-1.9.5}/.github/workflows/scorecard.yaml +0 -0
- {python_discovery-1.9.4 → python_discovery-1.9.5}/.github/workflows/upgrade-release-tools.yaml +0 -0
- {python_discovery-1.9.4 → python_discovery-1.9.5}/.gitignore +0 -0
- {python_discovery-1.9.4 → python_discovery-1.9.5}/.pre-commit-config.yaml +0 -0
- {python_discovery-1.9.4 → python_discovery-1.9.5}/.readthedocs.yaml +0 -0
- {python_discovery-1.9.4 → python_discovery-1.9.5}/.readthedocs.yml +0 -0
- {python_discovery-1.9.4 → python_discovery-1.9.5}/CODE_OF_CONDUCT.md +0 -0
- {python_discovery-1.9.4 → python_discovery-1.9.5}/LICENSE +0 -0
- {python_discovery-1.9.4 → python_discovery-1.9.5}/README.md +0 -0
- {python_discovery-1.9.4 → python_discovery-1.9.5}/docs/_static/custom.css +0 -0
- {python_discovery-1.9.4 → python_discovery-1.9.5}/docs/_static/github.svg +0 -0
- {python_discovery-1.9.4 → python_discovery-1.9.5}/docs/_static/logo.svg +0 -0
- {python_discovery-1.9.4 → python_discovery-1.9.5}/docs/changelog/template.jinja2 +0 -0
- {python_discovery-1.9.4 → python_discovery-1.9.5}/docs/conf.py +0 -0
- {python_discovery-1.9.4 → python_discovery-1.9.5}/docs/contributing.rst +0 -0
- {python_discovery-1.9.4 → python_discovery-1.9.5}/docs/explanation.rst +0 -0
- {python_discovery-1.9.4 → python_discovery-1.9.5}/docs/how-to/standalone-usage.rst +0 -0
- {python_discovery-1.9.4 → python_discovery-1.9.5}/docs/index.rst +0 -0
- {python_discovery-1.9.4 → python_discovery-1.9.5}/docs/reference/api.rst +0 -0
- {python_discovery-1.9.4 → python_discovery-1.9.5}/docs/reference/environment-variables.rst +0 -0
- {python_discovery-1.9.4 → python_discovery-1.9.5}/docs/tutorial/getting-started.rst +0 -0
- {python_discovery-1.9.4 → python_discovery-1.9.5}/pylock.toml +0 -0
- {python_discovery-1.9.4 → python_discovery-1.9.5}/pyproject.toml +0 -0
- {python_discovery-1.9.4 → python_discovery-1.9.5}/src/python_discovery/__init__.py +0 -0
- {python_discovery-1.9.4 → python_discovery-1.9.5}/src/python_discovery/_cache.py +0 -0
- {python_discovery-1.9.4 → python_discovery-1.9.5}/src/python_discovery/_cached_py_info.py +0 -0
- {python_discovery-1.9.4 → python_discovery-1.9.5}/src/python_discovery/_compat.py +0 -0
- {python_discovery-1.9.4 → python_discovery-1.9.5}/src/python_discovery/_py_info.py +0 -0
- {python_discovery-1.9.4 → python_discovery-1.9.5}/src/python_discovery/_py_info_collect.py +0 -0
- {python_discovery-1.9.4 → python_discovery-1.9.5}/src/python_discovery/_specifier.py +0 -0
- {python_discovery-1.9.4 → python_discovery-1.9.5}/src/python_discovery/_windows/__init__.py +0 -0
- {python_discovery-1.9.4 → python_discovery-1.9.5}/src/python_discovery/_windows/_cancel_io.py +0 -0
- {python_discovery-1.9.4 → python_discovery-1.9.5}/src/python_discovery/_windows/_pep514.py +0 -0
- {python_discovery-1.9.4 → python_discovery-1.9.5}/src/python_discovery/_windows/_propose.py +0 -0
- {python_discovery-1.9.4 → python_discovery-1.9.5}/src/python_discovery/py.typed +0 -0
- {python_discovery-1.9.4 → python_discovery-1.9.5}/tasks/old_target_check.py +0 -0
- {python_discovery-1.9.4 → python_discovery-1.9.5}/tasks/old_target_check.sh +0 -0
- {python_discovery-1.9.4 → python_discovery-1.9.5}/tests/conftest.py +0 -0
- {python_discovery-1.9.4 → python_discovery-1.9.5}/tests/py_info/test_py_info.py +0 -0
- {python_discovery-1.9.4 → python_discovery-1.9.5}/tests/py_info/test_py_info_exe_based_of.py +0 -0
- {python_discovery-1.9.4 → python_discovery-1.9.5}/tests/test_cache.py +0 -0
- {python_discovery-1.9.4 → python_discovery-1.9.5}/tests/test_cache_recovery.py +0 -0
- {python_discovery-1.9.4 → python_discovery-1.9.5}/tests/test_cached_py_info.py +0 -0
- {python_discovery-1.9.4 → python_discovery-1.9.5}/tests/test_discovery.py +0 -0
- {python_discovery-1.9.4 → python_discovery-1.9.5}/tests/test_discovery_extra.py +0 -0
- {python_discovery-1.9.4 → python_discovery-1.9.5}/tests/test_py_info_collect.py +0 -0
- {python_discovery-1.9.4 → python_discovery-1.9.5}/tests/test_py_info_extra.py +0 -0
- {python_discovery-1.9.4 → python_discovery-1.9.5}/tests/test_py_spec.py +0 -0
- {python_discovery-1.9.4 → python_discovery-1.9.5}/tests/test_query_timeout.py +0 -0
- {python_discovery-1.9.4 → python_discovery-1.9.5}/tests/test_specifier.py +0 -0
- {python_discovery-1.9.4 → python_discovery-1.9.5}/tests/windows/conftest.py +0 -0
- {python_discovery-1.9.4 → python_discovery-1.9.5}/tests/windows/test_windows.py +0 -0
- {python_discovery-1.9.4 → python_discovery-1.9.5}/tests/windows/test_windows_pep514.py +0 -0
- {python_discovery-1.9.4 → python_discovery-1.9.5}/tests/windows/winreg_mock_values.py +0 -0
- {python_discovery-1.9.4 → python_discovery-1.9.5}/tox.toml +0 -0
|
@@ -6,6 +6,23 @@
|
|
|
6
6
|
|
|
7
7
|
.. towncrier release notes start
|
|
8
8
|
|
|
9
|
+
.. _release-1-9-5:
|
|
10
|
+
|
|
11
|
+
*********************
|
|
12
|
+
v1.9.5 (2026-11-06)
|
|
13
|
+
*********************
|
|
14
|
+
|
|
15
|
+
.. _release-1-9-5-fixed:
|
|
16
|
+
|
|
17
|
+
Fixed
|
|
18
|
+
-----
|
|
19
|
+
|
|
20
|
+
- :func:`~python_discovery.iter_interpreters` with no key no longer probes ``PATH`` directories or subdirectories named
|
|
21
|
+
like Python executables as interpreters (:pr:`247`) by :user:`qodelicious` and :user:`gaborbernat`.
|
|
22
|
+
- ``PythonSpec.satisfies`` now checks a version specifier at the precision it was written with, so ``3.11`` no longer
|
|
23
|
+
satisfies ``>=3.13``. The Windows registry pre-filter skips mismatched releases and interrogates candidates whose
|
|
24
|
+
prerelease status is unknown (:pr:`246`) by :user:`qodelicious` and :user:`gaborbernat`.
|
|
25
|
+
|
|
9
26
|
.. _release-1-9-4:
|
|
10
27
|
|
|
11
28
|
*********************
|
|
@@ -496,12 +496,13 @@ def path_exe_finder(
|
|
|
496
496
|
direct = f"{direct}.exe"
|
|
497
497
|
|
|
498
498
|
def path_exes(path: Path) -> Generator[tuple[Path, bool], None, None]:
|
|
499
|
+
# an empty spec (enumerating everything) would make the direct path the PATH directory itself
|
|
499
500
|
direct_path = path / direct
|
|
500
|
-
if direct_path.
|
|
501
|
+
if direct_path.is_file():
|
|
501
502
|
yield direct_path, impl_must_match
|
|
502
503
|
|
|
503
504
|
for exe in path.iterdir():
|
|
504
|
-
if match := pat.fullmatch(exe.name):
|
|
505
|
+
if (match := pat.fullmatch(exe.name)) and exe.is_file():
|
|
505
506
|
yield exe.absolute(), impl_must_match or match["impl"].lower() == "python"
|
|
506
507
|
|
|
507
508
|
return path_exes
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
-
import contextlib
|
|
6
5
|
import pathlib
|
|
7
6
|
import re
|
|
8
7
|
from typing import Final
|
|
@@ -235,27 +234,31 @@ class PythonSpec:
|
|
|
235
234
|
if not components:
|
|
236
235
|
return True
|
|
237
236
|
|
|
238
|
-
version_str = ".".join(str(part) for part in components)
|
|
239
237
|
if spec.version_specifier is None:
|
|
240
238
|
return True
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
239
|
+
for item in spec.version_specifier:
|
|
240
|
+
required_precision = self._get_required_precision(item)
|
|
241
|
+
if required_precision is None or len(components) < required_precision:
|
|
242
|
+
continue
|
|
243
|
+
# Registry versions omit prerelease status, so a matching release still needs interrogation.
|
|
244
|
+
if (
|
|
245
|
+
(version := item.version) is not None
|
|
246
|
+
and version.pre_type is not None
|
|
247
|
+
and tuple(components[:required_precision]) == version.release[:required_precision]
|
|
248
|
+
):
|
|
249
|
+
continue
|
|
250
|
+
# compare at the precision the specifier was written with, as PythonInfo.satisfies does
|
|
251
|
+
if not item.contains(".".join(str(part) for part in components[:required_precision])):
|
|
252
|
+
return False
|
|
249
253
|
return True
|
|
250
254
|
|
|
251
255
|
@staticmethod
|
|
252
256
|
def _get_required_precision(item: SimpleSpecifier) -> int | None:
|
|
253
|
-
"""Get the required precision for a specifier item."""
|
|
254
257
|
if item.version is None:
|
|
255
258
|
return None
|
|
256
|
-
|
|
257
|
-
return
|
|
258
|
-
return
|
|
259
|
+
if item.wildcard_precision is not None:
|
|
260
|
+
return item.wildcard_precision
|
|
261
|
+
return re.split(r"a|b|rc", item.version_str, maxsplit=1)[0].count(".") + 1
|
|
259
262
|
|
|
260
263
|
def satisfies(self, spec: PythonSpec) -> bool: # ruff:ignore[too-many-return-statements]
|
|
261
264
|
"""
|
|
@@ -144,6 +144,30 @@ def test_iter_interpreters_no_key_probes_variant_builds_on_path(
|
|
|
144
144
|
assert str(exe) in [call.args[0] for call in from_exe.call_args_list]
|
|
145
145
|
|
|
146
146
|
|
|
147
|
+
@pytest.mark.usefixtures("uv_dir")
|
|
148
|
+
@pytest.mark.parametrize(
|
|
149
|
+
"directory_name",
|
|
150
|
+
[
|
|
151
|
+
pytest.param(".", id="path-directory"),
|
|
152
|
+
pytest.param(f"python3.99{'.exe' if IS_WIN else ''}", id="named-directory"),
|
|
153
|
+
],
|
|
154
|
+
)
|
|
155
|
+
def test_iter_interpreters_skips_path_directories(
|
|
156
|
+
tmp_path: Path, monkeypatch: pytest.MonkeyPatch, mocker: MockerFixture, directory_name: str
|
|
157
|
+
) -> None:
|
|
158
|
+
bin_dir = tmp_path / "bin"
|
|
159
|
+
bin_dir.mkdir()
|
|
160
|
+
(bin_dir / directory_name).mkdir(exist_ok=True)
|
|
161
|
+
executable = bin_dir / f"python3.98{'.exe' if IS_WIN else ''}"
|
|
162
|
+
executable.touch()
|
|
163
|
+
monkeypatch.setenv("PATH", str(bin_dir))
|
|
164
|
+
from_exe = mocker.patch("python_discovery._discovery.PathPythonInfo.from_exe", return_value=None)
|
|
165
|
+
|
|
166
|
+
list(iter_interpreters())
|
|
167
|
+
|
|
168
|
+
assert [call.args[0] for call in from_exe.call_args_list] == [str(executable)]
|
|
169
|
+
|
|
170
|
+
|
|
147
171
|
@pytest.mark.usefixtures("uv_dir")
|
|
148
172
|
def test_iter_interpreters_dedups_symlinks(
|
|
149
173
|
tmp_path: Path,
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
-
from unittest.mock import MagicMock
|
|
4
|
-
|
|
5
3
|
import pytest
|
|
6
4
|
|
|
7
5
|
from python_discovery import PythonSpec
|
|
@@ -165,16 +163,22 @@ def test_specifier_set_parsed_for_valid_format() -> None:
|
|
|
165
163
|
assert spec.implementation == "cpython"
|
|
166
164
|
|
|
167
165
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
166
|
+
@pytest.mark.parametrize(
|
|
167
|
+
("candidate", "text", "expected"),
|
|
168
|
+
[
|
|
169
|
+
pytest.param("3.11", ">=3.13", False, id="minor-too-old"),
|
|
170
|
+
pytest.param("3.14", "<3.13", False, id="minor-too-new"),
|
|
171
|
+
pytest.param("3.11", "==3.12.*", False, id="minor-wildcard-miss"),
|
|
172
|
+
pytest.param("3.12", "==3.12.*", True, id="minor-wildcard-hit"),
|
|
173
|
+
pytest.param("3.13", ">=3.12,<3.14", True, id="minor-in-range"),
|
|
174
|
+
pytest.param("3", ">=4", False, id="major-too-old"),
|
|
175
|
+
pytest.param("3.12", ">=3.12.5", True, id="micro-unknown"),
|
|
176
|
+
pytest.param("3.12.1", "==3.12", True, id="micro-at-minor-precision"),
|
|
177
|
+
pytest.param("3.14", "==3.14rc1", True, id="prerelease-unknown"),
|
|
178
|
+
pytest.param("3.14", "<=3.14rc1", True, id="prerelease-upper-bound-unknown"),
|
|
179
|
+
pytest.param("3.14.0", "==3.14.0rc1", True, id="prerelease-unknown-at-micro-precision"),
|
|
180
|
+
pytest.param("3.13", ">=3.14rc1", False, id="earlier-release-still-filtered"),
|
|
181
|
+
],
|
|
182
|
+
)
|
|
183
|
+
def test_version_specifier_compared_at_written_precision(candidate: str, text: str, expected: bool) -> None:
|
|
184
|
+
assert PythonSpec.from_string_spec(candidate).satisfies(PythonSpec.from_string_spec(text)) is expected
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_discovery-1.9.4 → python_discovery-1.9.5}/.github/workflows/upgrade-release-tools.yaml
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_discovery-1.9.4 → python_discovery-1.9.5}/src/python_discovery/_windows/_cancel_io.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_discovery-1.9.4 → python_discovery-1.9.5}/tests/py_info/test_py_info_exe_based_of.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|