python-discovery 1.6.6__tar.gz → 1.6.7__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.
Files changed (67) hide show
  1. {python_discovery-1.6.6 → python_discovery-1.6.7}/.github/workflows/news.yaml +3 -2
  2. {python_discovery-1.6.6 → python_discovery-1.6.7}/.github/workflows/prepare-release.yaml +1 -1
  3. {python_discovery-1.6.6 → python_discovery-1.6.7}/.github/workflows/release.yaml +6 -6
  4. {python_discovery-1.6.6 → python_discovery-1.6.7}/.github/workflows/upgrade-release-tools.yaml +1 -1
  5. {python_discovery-1.6.6 → python_discovery-1.6.7}/PKG-INFO +1 -1
  6. {python_discovery-1.6.6 → python_discovery-1.6.7}/docs/changelog.rst +17 -0
  7. {python_discovery-1.6.6 → python_discovery-1.6.7}/src/python_discovery/_discovery.py +3 -2
  8. {python_discovery-1.6.6 → python_discovery-1.6.7}/src/python_discovery/_py_info.py +5 -1
  9. {python_discovery-1.6.6 → python_discovery-1.6.7}/tests/test_discovery.py +12 -0
  10. {python_discovery-1.6.6 → python_discovery-1.6.7}/tests/test_iter_interpreters.py +36 -0
  11. {python_discovery-1.6.6 → python_discovery-1.6.7}/tests/test_py_info_extra.py +33 -0
  12. {python_discovery-1.6.6 → python_discovery-1.6.7}/.github/FUNDING.yaml +0 -0
  13. {python_discovery-1.6.6 → python_discovery-1.6.7}/.github/SECURITY.md +0 -0
  14. {python_discovery-1.6.6 → python_discovery-1.6.7}/.github/dependabot.yaml +0 -0
  15. {python_discovery-1.6.6 → python_discovery-1.6.7}/.github/release.yaml +0 -0
  16. {python_discovery-1.6.6 → python_discovery-1.6.7}/.github/workflows/check.yaml +0 -0
  17. {python_discovery-1.6.6 → python_discovery-1.6.7}/.github/workflows/codeql.yaml +0 -0
  18. {python_discovery-1.6.6 → python_discovery-1.6.7}/.gitignore +0 -0
  19. {python_discovery-1.6.6 → python_discovery-1.6.7}/.pre-commit-config.yaml +0 -0
  20. {python_discovery-1.6.6 → python_discovery-1.6.7}/.readthedocs.yaml +0 -0
  21. {python_discovery-1.6.6 → python_discovery-1.6.7}/.readthedocs.yml +0 -0
  22. {python_discovery-1.6.6 → python_discovery-1.6.7}/CODE_OF_CONDUCT.md +0 -0
  23. {python_discovery-1.6.6 → python_discovery-1.6.7}/LICENSE +0 -0
  24. {python_discovery-1.6.6 → python_discovery-1.6.7}/README.md +0 -0
  25. {python_discovery-1.6.6 → python_discovery-1.6.7}/docs/_static/custom.css +0 -0
  26. {python_discovery-1.6.6 → python_discovery-1.6.7}/docs/_static/logo.svg +0 -0
  27. {python_discovery-1.6.6 → python_discovery-1.6.7}/docs/changelog/template.jinja2 +0 -0
  28. {python_discovery-1.6.6 → python_discovery-1.6.7}/docs/conf.py +0 -0
  29. {python_discovery-1.6.6 → python_discovery-1.6.7}/docs/contributing.rst +0 -0
  30. {python_discovery-1.6.6 → python_discovery-1.6.7}/docs/explanation.rst +0 -0
  31. {python_discovery-1.6.6 → python_discovery-1.6.7}/docs/how-to/standalone-usage.rst +0 -0
  32. {python_discovery-1.6.6 → python_discovery-1.6.7}/docs/index.rst +0 -0
  33. {python_discovery-1.6.6 → python_discovery-1.6.7}/docs/reference/api.rst +0 -0
  34. {python_discovery-1.6.6 → python_discovery-1.6.7}/docs/reference/environment-variables.rst +0 -0
  35. {python_discovery-1.6.6 → python_discovery-1.6.7}/docs/tutorial/getting-started.rst +0 -0
  36. {python_discovery-1.6.6 → python_discovery-1.6.7}/pylock.toml +0 -0
  37. {python_discovery-1.6.6 → python_discovery-1.6.7}/pyproject.toml +0 -0
  38. {python_discovery-1.6.6 → python_discovery-1.6.7}/src/python_discovery/__init__.py +0 -0
  39. {python_discovery-1.6.6 → python_discovery-1.6.7}/src/python_discovery/_cache.py +0 -0
  40. {python_discovery-1.6.6 → python_discovery-1.6.7}/src/python_discovery/_cached_py_info.py +0 -0
  41. {python_discovery-1.6.6 → python_discovery-1.6.7}/src/python_discovery/_compat.py +0 -0
  42. {python_discovery-1.6.6 → python_discovery-1.6.7}/src/python_discovery/_py_info_collect.py +0 -0
  43. {python_discovery-1.6.6 → python_discovery-1.6.7}/src/python_discovery/_py_spec.py +0 -0
  44. {python_discovery-1.6.6 → python_discovery-1.6.7}/src/python_discovery/_specifier.py +0 -0
  45. {python_discovery-1.6.6 → python_discovery-1.6.7}/src/python_discovery/_windows/__init__.py +0 -0
  46. {python_discovery-1.6.6 → python_discovery-1.6.7}/src/python_discovery/_windows/_pep514.py +0 -0
  47. {python_discovery-1.6.6 → python_discovery-1.6.7}/src/python_discovery/_windows/_propose.py +0 -0
  48. {python_discovery-1.6.6 → python_discovery-1.6.7}/src/python_discovery/py.typed +0 -0
  49. {python_discovery-1.6.6 → python_discovery-1.6.7}/tasks/old_target_check.py +0 -0
  50. {python_discovery-1.6.6 → python_discovery-1.6.7}/tasks/old_target_check.sh +0 -0
  51. {python_discovery-1.6.6 → python_discovery-1.6.7}/tests/conftest.py +0 -0
  52. {python_discovery-1.6.6 → python_discovery-1.6.7}/tests/py_info/test_py_info.py +0 -0
  53. {python_discovery-1.6.6 → python_discovery-1.6.7}/tests/py_info/test_py_info_exe_based_of.py +0 -0
  54. {python_discovery-1.6.6 → python_discovery-1.6.7}/tests/test_cache.py +0 -0
  55. {python_discovery-1.6.6 → python_discovery-1.6.7}/tests/test_cache_recovery.py +0 -0
  56. {python_discovery-1.6.6 → python_discovery-1.6.7}/tests/test_cached_py_info.py +0 -0
  57. {python_discovery-1.6.6 → python_discovery-1.6.7}/tests/test_discovery_extra.py +0 -0
  58. {python_discovery-1.6.6 → python_discovery-1.6.7}/tests/test_py_info_collect.py +0 -0
  59. {python_discovery-1.6.6 → python_discovery-1.6.7}/tests/test_py_spec.py +0 -0
  60. {python_discovery-1.6.6 → python_discovery-1.6.7}/tests/test_py_spec_extra.py +0 -0
  61. {python_discovery-1.6.6 → python_discovery-1.6.7}/tests/test_query_timeout.py +0 -0
  62. {python_discovery-1.6.6 → python_discovery-1.6.7}/tests/test_specifier.py +0 -0
  63. {python_discovery-1.6.6 → python_discovery-1.6.7}/tests/windows/conftest.py +0 -0
  64. {python_discovery-1.6.6 → python_discovery-1.6.7}/tests/windows/test_windows.py +0 -0
  65. {python_discovery-1.6.6 → python_discovery-1.6.7}/tests/windows/test_windows_pep514.py +0 -0
  66. {python_discovery-1.6.6 → python_discovery-1.6.7}/tests/windows/winreg_mock_values.py +0 -0
  67. {python_discovery-1.6.6 → python_discovery-1.6.7}/tox.toml +0 -0
@@ -7,6 +7,7 @@ concurrency:
7
7
  cancel-in-progress: true
8
8
  permissions:
9
9
  contents: read
10
+ pull-requests: read
10
11
  jobs:
11
12
  changelog:
12
13
  name: 📝 News fragment
@@ -24,9 +25,9 @@ jobs:
24
25
  python-version: "3.15"
25
26
  enable-cache: false
26
27
  - name: 📦 Install locked release tools
27
- uses: tox-dev/github-workflows/install-locked-tools@259a3d3fb578d00517ffb73341fdd463259b0b2f # 6.0.1
28
+ uses: tox-dev/github-workflows/install-locked-tools@57a765127aae73adf7d0e24a7fe0f067f2d3ea3e # 6.2.1
28
29
  with:
29
30
  groups: release-news
30
31
  venv: ${{ runner.temp }}/release-tools
31
32
  - name: 🔍 Validate news fragments
32
- uses: tox-dev/github-workflows/validate-news@259a3d3fb578d00517ffb73341fdd463259b0b2f # 6.0.1
33
+ uses: tox-dev/github-workflows/validate-news@57a765127aae73adf7d0e24a7fe0f067f2d3ea3e # 6.2.1
@@ -12,7 +12,7 @@ permissions: {}
12
12
  jobs:
13
13
  prepare:
14
14
  name: 🏷️ Prepare Towncrier release
15
- uses: tox-dev/github-workflows/.github/workflows/prepare-towncrier-release.yaml@259a3d3fb578d00517ffb73341fdd463259b0b2f # 6.0.1
15
+ uses: tox-dev/github-workflows/.github/workflows/prepare-towncrier-release.yaml@57a765127aae73adf7d0e24a7fe0f067f2d3ea3e # 6.2.1
16
16
  permissions:
17
17
  contents: read
18
18
  pull-requests: read
@@ -10,7 +10,7 @@ concurrency:
10
10
  jobs:
11
11
  build:
12
12
  name: 🏗️ Build
13
- uses: tox-dev/github-workflows/.github/workflows/validate-python-release.yaml@259a3d3fb578d00517ffb73341fdd463259b0b2f # 6.0.1
13
+ uses: tox-dev/github-workflows/.github/workflows/validate-python-release.yaml@57a765127aae73adf7d0e24a7fe0f067f2d3ea3e # 6.2.1
14
14
  permissions:
15
15
  contents: read
16
16
  notes:
@@ -33,17 +33,17 @@ jobs:
33
33
  python-version: "3.15"
34
34
  enable-cache: false
35
35
  - name: 📦 Install locked release tools
36
- uses: tox-dev/github-workflows/install-locked-tools@259a3d3fb578d00517ffb73341fdd463259b0b2f # 6.0.1
36
+ uses: tox-dev/github-workflows/install-locked-tools@57a765127aae73adf7d0e24a7fe0f067f2d3ea3e # 6.2.1
37
37
  with:
38
38
  groups: release-notes
39
39
  venv: ${{ runner.temp }}/release-tools
40
40
  - name: 🏷️ Select previous tag
41
41
  id: previous
42
- uses: tox-dev/github-workflows/select-previous-tag@259a3d3fb578d00517ffb73341fdd463259b0b2f # 6.0.1
42
+ uses: tox-dev/github-workflows/select-previous-tag@57a765127aae73adf7d0e24a7fe0f067f2d3ea3e # 6.2.1
43
43
  with:
44
44
  tag: ${{ github.ref_name }}
45
45
  - name: 📝 Render release notes
46
- uses: tox-dev/github-workflows/render-release-notes@259a3d3fb578d00517ffb73341fdd463259b0b2f # 6.0.1
46
+ uses: tox-dev/github-workflows/render-release-notes@57a765127aae73adf7d0e24a7fe0f067f2d3ea3e # 6.2.1
47
47
  with:
48
48
  tag: ${{ github.ref_name }}
49
49
  previous: ${{ steps.previous.outputs.previous }}
@@ -101,13 +101,13 @@ jobs:
101
101
  artifact-ids: ${{ needs.notes.outputs.artifact-id }}
102
102
  path: ${{ runner.temp }}
103
103
  - name: 🔍 Verify PyPI artifacts
104
- uses: tox-dev/github-workflows/reconcile-pypi-artifacts@259a3d3fb578d00517ffb73341fdd463259b0b2f # 6.0.1
104
+ uses: tox-dev/github-workflows/reconcile-pypi-artifacts@57a765127aae73adf7d0e24a7fe0f067f2d3ea3e # 6.2.1
105
105
  with:
106
106
  project: python-discovery
107
107
  version: ${{ github.ref_name }}
108
108
  dist: dist
109
109
  - name: 🚀 Publish GitHub release
110
- uses: tox-dev/github-workflows/publish-github-release@259a3d3fb578d00517ffb73341fdd463259b0b2f # 6.0.1
110
+ uses: tox-dev/github-workflows/publish-github-release@57a765127aae73adf7d0e24a7fe0f067f2d3ea3e # 6.2.1
111
111
  env:
112
112
  GH_TOKEN: ${{ github.token }}
113
113
  with:
@@ -10,7 +10,7 @@ concurrency:
10
10
  jobs:
11
11
  upgrade:
12
12
  name: 🔀 Upgrade release tools
13
- uses: tox-dev/github-workflows/.github/workflows/upgrade-release-tools.yaml@259a3d3fb578d00517ffb73341fdd463259b0b2f # 6.0.1
13
+ uses: tox-dev/github-workflows/.github/workflows/upgrade-release-tools.yaml@57a765127aae73adf7d0e24a7fe0f067f2d3ea3e # 6.2.1
14
14
  permissions:
15
15
  contents: read
16
16
  secrets:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: python-discovery
3
- Version: 1.6.6
3
+ Version: 1.6.7
4
4
  Import-Name: python_discovery
5
5
  Summary: Python interpreter discovery
6
6
  Project-URL: Changelog, https://github.com/tox-dev/python-discovery/blob/main/docs/changelog.rst
@@ -6,6 +6,23 @@
6
6
 
7
7
  .. towncrier release notes start
8
8
 
9
+ .. _release-1-6-7:
10
+
11
+ *********************
12
+ v1.6.7 (2026-10-28)
13
+ *********************
14
+
15
+ .. _release-1-6-7-fixed:
16
+
17
+ Fixed
18
+ -----
19
+
20
+ - Rank uv's minor version links behind the concrete install on Windows too, where uv creates them as directory junctions
21
+ that ``Path.is_symlink()`` does not report (:pr:`170`) by :user:`darrenhuai` and :user:`gaborbernat`.
22
+ - Stop a venv lookup from rewriting the ``executable`` of earlier results, ``PythonInfo.current()`` and
23
+ ``PythonInfo.current_system()`` when they share its base interpreter (:pr:`171`) by :user:`darrenhuai` and
24
+ :user:`gaborbernat`.
25
+
9
26
  .. _release-1-6-6:
10
27
 
11
28
  *********************
@@ -389,8 +389,9 @@ def _uv_sort_key(install: _UvInstall) -> tuple[int, ...]:
389
389
  version = key.version
390
390
  return (
391
391
  impl_order.index(key.implementation) if key.implementation in impl_order else len(impl_order),
392
- # uv's minor version links point at a concrete install that moves on upgrade, so report the target instead
393
- int(install.path.is_symlink()),
392
+ # uv's minor version links point at a concrete install that moves on upgrade, so report the target instead;
393
+ # spot them by the name they resolve to, as on Windows they are junctions, which is_symlink() does not report
394
+ int(install.path.resolve().name != install.path.name),
394
395
  -version.major,
395
396
  -version.minor,
396
397
  -version.micro,
@@ -2,6 +2,7 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
+ import copy
5
6
  import json
6
7
  import logging
7
8
  import os
@@ -475,7 +476,10 @@ class PythonInfo: # ruff:ignore[too-many-public-methods]
475
476
  resolved = cls.from_exe(target.system_executable, cache)
476
477
  if resolved is not None:
477
478
  target = resolved
478
- target.executable = start_executable
479
+ if target.executable != start_executable:
480
+ # the cache hands every lookup of this base the same object, so point a copy at the start executable
481
+ target = copy.copy(target)
482
+ target.executable = start_executable
479
483
  return target
480
484
 
481
485
  _cache_exe_discovery: ClassVar[dict[tuple[str, bool], PythonInfo]] = {}
@@ -167,6 +167,18 @@ def test_discovery_absolute_path_with_try_first(
167
167
  assert Path(interpreter.executable) == good_exe
168
168
 
169
169
 
170
+ def test_discovery_venvs_on_one_base_keep_their_executable(tmp_path: Path, session_cache: DiskCache) -> None:
171
+ scripts_dir = "Scripts" if IS_WIN else "bin"
172
+ exe_name = "python.exe" if IS_WIN else "python"
173
+ exes = [tmp_path / name / scripts_dir / exe_name for name in ("a", "b")]
174
+ for exe in exes:
175
+ subprocess.check_call([sys.executable, "-m", "venv", "--without-pip", str(exe.parents[1])])
176
+
177
+ found = [get_interpreter(str(exe), cache=session_cache) for exe in exes]
178
+
179
+ assert [Path(info.executable) for info in found if info is not None] == exes
180
+
181
+
170
182
  def test_discovery_via_path_with_file(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:
171
183
  a_file = tmp_path / "a_file"
172
184
  a_file.touch()
@@ -431,6 +431,42 @@ def test_iter_interpreters_uv_minor_version_link_loses_to_its_target(
431
431
  assert uv_probed("3.15") == ["cpython-3.15.0b3-macos-aarch64-none/bin/python"]
432
432
 
433
433
 
434
+ @pytest.mark.parametrize(
435
+ ("concrete", "link"),
436
+ [
437
+ pytest.param("cpython-3.15.0b3-windows-x86_64-none", "cpython-3.15-windows-x86_64-none", id="prerelease"),
438
+ # the link ties with its target on version, so directory name order decides, and "-" sorts before "."
439
+ pytest.param("cpython-3.14.0-windows-x86_64-none", "cpython-3.14-windows-x86_64-none", id="first-release"),
440
+ ],
441
+ )
442
+ def test_iter_interpreters_uv_minor_version_junction_loses_to_its_target(
443
+ uv_install: Callable[..., None],
444
+ uv_probed: Callable[[str | None], list[str]],
445
+ uv_junction: Callable[[str, str], None],
446
+ concrete: str,
447
+ link: str,
448
+ ) -> None:
449
+ uv_install(f"{concrete}/python.exe")
450
+ uv_junction(concrete, link)
451
+
452
+ assert uv_probed("3") == [f"{concrete}/python.exe"]
453
+
454
+
455
+ @pytest.fixture
456
+ def uv_junction(uv_dir: Path, mocker: MockerFixture) -> Callable[[str, str], None]:
457
+ def _junction(target: str, link: str) -> None:
458
+ if IS_WIN: # pragma: win32 cover
459
+ import _winapi
460
+
461
+ _winapi.CreateJunction(str(uv_dir / target), str(uv_dir / link))
462
+ else: # pragma: win32 no cover
463
+ # stand in for the junction with a symlink that does not report as one
464
+ (uv_dir / link).symlink_to(uv_dir / target)
465
+ mocker.patch.object(Path, "is_symlink", return_value=False)
466
+
467
+ return _junction
468
+
469
+
434
470
  def test_iter_interpreters_uv_probes_one_executable_per_install(
435
471
  uv_dir: Path, uv_install: Callable[..., None], monkeypatch: pytest.MonkeyPatch, mocker: MockerFixture
436
472
  ) -> None:
@@ -439,3 +439,36 @@ def test_resolve_to_system_from_exe_returns_none(mocker: MockerFixture) -> None:
439
439
  mocker.patch.object(PythonInfo, "from_exe", return_value=None)
440
440
  result = PythonInfo.resolve_to_system(None, target)
441
441
  assert result.executable == "/some/venv/python"
442
+
443
+
444
+ @pytest.mark.parametrize(
445
+ "system_executable",
446
+ [
447
+ pytest.param("/some/system/python", id="resolved"),
448
+ pytest.param(None, id="discovered"),
449
+ ],
450
+ )
451
+ def test_resolve_to_system_leaves_shared_info_untouched(mocker: MockerFixture, system_executable: str | None) -> None:
452
+ shared = copy.deepcopy(CURRENT)
453
+ shared.system_executable = shared.executable = "/some/system/python"
454
+ mocker.patch.object(PythonInfo, "from_exe", return_value=shared)
455
+ mocker.patch.object(PythonInfo, "discover_exe", return_value=shared)
456
+
457
+ results: list[PythonInfo] = []
458
+ for venv in ("/some/venv-a", "/some/venv-b"):
459
+ target = copy.deepcopy(CURRENT)
460
+ target.system_executable = system_executable
461
+ target.real_prefix, target.base_prefix, target.executable = None, venv, f"{venv}/python"
462
+ results.append(PythonInfo.resolve_to_system(None, target))
463
+
464
+ assert [(info.executable, info.system_executable) for info in results] == [
465
+ ("/some/venv-a/python", "/some/system/python"),
466
+ ("/some/venv-b/python", "/some/system/python"),
467
+ ]
468
+ assert shared.executable == "/some/system/python"
469
+
470
+
471
+ def test_resolve_to_system_returns_target_when_executable_unchanged() -> None:
472
+ target = copy.deepcopy(CURRENT)
473
+ target.system_executable = target.executable = "/some/system/python"
474
+ assert PythonInfo.resolve_to_system(None, target) is target