python-discovery 1.8.0__tar.gz → 1.9.0__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 (69) hide show
  1. {python_discovery-1.8.0 → python_discovery-1.9.0}/PKG-INFO +1 -1
  2. {python_discovery-1.8.0 → python_discovery-1.9.0}/docs/changelog.rst +14 -0
  3. {python_discovery-1.8.0 → python_discovery-1.9.0}/docs/how-to/standalone-usage.rst +3 -2
  4. {python_discovery-1.8.0 → python_discovery-1.9.0}/src/python_discovery/__init__.py +2 -1
  5. {python_discovery-1.8.0 → python_discovery-1.9.0}/src/python_discovery/_py_info.py +17 -2
  6. {python_discovery-1.8.0 → python_discovery-1.9.0}/tests/py_info/test_py_info.py +5 -1
  7. {python_discovery-1.8.0 → python_discovery-1.9.0}/.github/FUNDING.yaml +0 -0
  8. {python_discovery-1.8.0 → python_discovery-1.9.0}/.github/SECURITY.md +0 -0
  9. {python_discovery-1.8.0 → python_discovery-1.9.0}/.github/THREAT_MODEL.md +0 -0
  10. {python_discovery-1.8.0 → python_discovery-1.9.0}/.github/dependabot.yaml +0 -0
  11. {python_discovery-1.8.0 → python_discovery-1.9.0}/.github/release.yaml +0 -0
  12. {python_discovery-1.8.0 → python_discovery-1.9.0}/.github/workflows/check.yaml +0 -0
  13. {python_discovery-1.8.0 → python_discovery-1.9.0}/.github/workflows/codeql.yaml +0 -0
  14. {python_discovery-1.8.0 → python_discovery-1.9.0}/.github/workflows/news.yaml +0 -0
  15. {python_discovery-1.8.0 → python_discovery-1.9.0}/.github/workflows/prepare-release.yaml +0 -0
  16. {python_discovery-1.8.0 → python_discovery-1.9.0}/.github/workflows/release.yaml +0 -0
  17. {python_discovery-1.8.0 → python_discovery-1.9.0}/.github/workflows/upgrade-release-tools.yaml +0 -0
  18. {python_discovery-1.8.0 → python_discovery-1.9.0}/.gitignore +0 -0
  19. {python_discovery-1.8.0 → python_discovery-1.9.0}/.pre-commit-config.yaml +0 -0
  20. {python_discovery-1.8.0 → python_discovery-1.9.0}/.readthedocs.yaml +0 -0
  21. {python_discovery-1.8.0 → python_discovery-1.9.0}/.readthedocs.yml +0 -0
  22. {python_discovery-1.8.0 → python_discovery-1.9.0}/CODE_OF_CONDUCT.md +0 -0
  23. {python_discovery-1.8.0 → python_discovery-1.9.0}/LICENSE +0 -0
  24. {python_discovery-1.8.0 → python_discovery-1.9.0}/README.md +0 -0
  25. {python_discovery-1.8.0 → python_discovery-1.9.0}/docs/_static/custom.css +0 -0
  26. {python_discovery-1.8.0 → python_discovery-1.9.0}/docs/_static/github.svg +0 -0
  27. {python_discovery-1.8.0 → python_discovery-1.9.0}/docs/_static/logo.svg +0 -0
  28. {python_discovery-1.8.0 → python_discovery-1.9.0}/docs/changelog/template.jinja2 +0 -0
  29. {python_discovery-1.8.0 → python_discovery-1.9.0}/docs/conf.py +0 -0
  30. {python_discovery-1.8.0 → python_discovery-1.9.0}/docs/contributing.rst +0 -0
  31. {python_discovery-1.8.0 → python_discovery-1.9.0}/docs/explanation.rst +0 -0
  32. {python_discovery-1.8.0 → python_discovery-1.9.0}/docs/index.rst +0 -0
  33. {python_discovery-1.8.0 → python_discovery-1.9.0}/docs/reference/api.rst +0 -0
  34. {python_discovery-1.8.0 → python_discovery-1.9.0}/docs/reference/environment-variables.rst +0 -0
  35. {python_discovery-1.8.0 → python_discovery-1.9.0}/docs/tutorial/getting-started.rst +0 -0
  36. {python_discovery-1.8.0 → python_discovery-1.9.0}/pylock.toml +0 -0
  37. {python_discovery-1.8.0 → python_discovery-1.9.0}/pyproject.toml +0 -0
  38. {python_discovery-1.8.0 → python_discovery-1.9.0}/src/python_discovery/_cache.py +0 -0
  39. {python_discovery-1.8.0 → python_discovery-1.9.0}/src/python_discovery/_cached_py_info.py +0 -0
  40. {python_discovery-1.8.0 → python_discovery-1.9.0}/src/python_discovery/_compat.py +0 -0
  41. {python_discovery-1.8.0 → python_discovery-1.9.0}/src/python_discovery/_discovery.py +0 -0
  42. {python_discovery-1.8.0 → python_discovery-1.9.0}/src/python_discovery/_py_info_collect.py +0 -0
  43. {python_discovery-1.8.0 → python_discovery-1.9.0}/src/python_discovery/_py_spec.py +0 -0
  44. {python_discovery-1.8.0 → python_discovery-1.9.0}/src/python_discovery/_specifier.py +0 -0
  45. {python_discovery-1.8.0 → python_discovery-1.9.0}/src/python_discovery/_windows/__init__.py +0 -0
  46. {python_discovery-1.8.0 → python_discovery-1.9.0}/src/python_discovery/_windows/_pep514.py +0 -0
  47. {python_discovery-1.8.0 → python_discovery-1.9.0}/src/python_discovery/_windows/_propose.py +0 -0
  48. {python_discovery-1.8.0 → python_discovery-1.9.0}/src/python_discovery/py.typed +0 -0
  49. {python_discovery-1.8.0 → python_discovery-1.9.0}/tasks/old_target_check.py +0 -0
  50. {python_discovery-1.8.0 → python_discovery-1.9.0}/tasks/old_target_check.sh +0 -0
  51. {python_discovery-1.8.0 → python_discovery-1.9.0}/tests/conftest.py +0 -0
  52. {python_discovery-1.8.0 → python_discovery-1.9.0}/tests/py_info/test_py_info_exe_based_of.py +0 -0
  53. {python_discovery-1.8.0 → python_discovery-1.9.0}/tests/test_cache.py +0 -0
  54. {python_discovery-1.8.0 → python_discovery-1.9.0}/tests/test_cache_recovery.py +0 -0
  55. {python_discovery-1.8.0 → python_discovery-1.9.0}/tests/test_cached_py_info.py +0 -0
  56. {python_discovery-1.8.0 → python_discovery-1.9.0}/tests/test_discovery.py +0 -0
  57. {python_discovery-1.8.0 → python_discovery-1.9.0}/tests/test_discovery_extra.py +0 -0
  58. {python_discovery-1.8.0 → python_discovery-1.9.0}/tests/test_iter_interpreters.py +0 -0
  59. {python_discovery-1.8.0 → python_discovery-1.9.0}/tests/test_py_info_collect.py +0 -0
  60. {python_discovery-1.8.0 → python_discovery-1.9.0}/tests/test_py_info_extra.py +0 -0
  61. {python_discovery-1.8.0 → python_discovery-1.9.0}/tests/test_py_spec.py +0 -0
  62. {python_discovery-1.8.0 → python_discovery-1.9.0}/tests/test_py_spec_extra.py +0 -0
  63. {python_discovery-1.8.0 → python_discovery-1.9.0}/tests/test_query_timeout.py +0 -0
  64. {python_discovery-1.8.0 → python_discovery-1.9.0}/tests/test_specifier.py +0 -0
  65. {python_discovery-1.8.0 → python_discovery-1.9.0}/tests/windows/conftest.py +0 -0
  66. {python_discovery-1.8.0 → python_discovery-1.9.0}/tests/windows/test_windows.py +0 -0
  67. {python_discovery-1.8.0 → python_discovery-1.9.0}/tests/windows/test_windows_pep514.py +0 -0
  68. {python_discovery-1.8.0 → python_discovery-1.9.0}/tests/windows/winreg_mock_values.py +0 -0
  69. {python_discovery-1.8.0 → python_discovery-1.9.0}/tox.toml +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: python-discovery
3
- Version: 1.8.0
3
+ Version: 1.9.0
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,20 @@
6
6
 
7
7
  .. towncrier release notes start
8
8
 
9
+ .. _release-1-9-0:
10
+
11
+ *********************
12
+ v1.9.0 (2026-10-30)
13
+ *********************
14
+
15
+ .. _release-1-9-0-added:
16
+
17
+ Added
18
+ -----
19
+
20
+ - Expose the 11 marker keys through ``MarkerEnvironment`` for callers that type-check ``PythonInfo.marker_environment``
21
+ (:pr:`179`) by :user:`gaborbernat`.
22
+
9
23
  .. _release-1-8-0:
10
24
 
11
25
  *********************
@@ -153,7 +153,7 @@ Once you have a :class:`~python_discovery.PythonInfo`, you can inspect everythin
153
153
  +platform: str
154
154
  +sysconfig_vars: dict
155
155
  +sysconfig_paths: dict
156
- +marker_environment: dict[str, str]
156
+ +marker_environment: MarkerEnvironment
157
157
  +machine: str
158
158
  +free_threaded: bool
159
159
  +debug_build: bool
@@ -182,7 +182,8 @@ Once you have a :class:`~python_discovery.PythonInfo`, you can inspect everythin
182
182
  info.marker_environment
183
183
 
184
184
  Use ``marker_environment`` to evaluate :pep:`508` dependency markers for the discovered interpreter. The mapping
185
- contains all standard marker keys, including its implementation version and operating system.
185
+ contains all standard marker keys, including its implementation version and operating system. The exported
186
+ ``MarkerEnvironment`` type names those keys for type checkers.
186
187
 
187
188
  Prefer :attr:`~python_discovery.PythonInfo.system_exe` over the raw
188
189
  :attr:`~python_discovery.PythonInfo.system_executable` field it reads. The field is typed ``str | None`` because it
@@ -6,7 +6,7 @@ from importlib.metadata import version
6
6
 
7
7
  from ._cache import ContentStore, DiskCache, PyInfoCache
8
8
  from ._discovery import get_interpreter, iter_interpreters
9
- from ._py_info import KNOWN_ARCHITECTURES, PythonInfo, normalize_isa
9
+ from ._py_info import KNOWN_ARCHITECTURES, MarkerEnvironment, PythonInfo, normalize_isa
10
10
  from ._py_spec import KNOWN_IMPLEMENTATIONS, PythonSpec
11
11
  from ._specifier import SimpleSpecifier, SimpleSpecifierSet, SimpleVersion
12
12
 
@@ -17,6 +17,7 @@ __all__ = [
17
17
  "KNOWN_IMPLEMENTATIONS",
18
18
  "ContentStore",
19
19
  "DiskCache",
20
+ "MarkerEnvironment",
20
21
  "PyInfoCache",
21
22
  "PythonInfo",
22
23
  "PythonSpec",
@@ -11,7 +11,7 @@ import sys
11
11
  from collections import OrderedDict
12
12
  from itertools import product
13
13
  from string import digits
14
- from typing import TYPE_CHECKING, ClassVar, Final, NamedTuple
14
+ from typing import TYPE_CHECKING, ClassVar, Final, NamedTuple, TypedDict
15
15
 
16
16
  from ._py_info_collect import PythonInfoCollector
17
17
 
@@ -57,7 +57,7 @@ class PythonInfo: # ruff:ignore[too-many-public-methods]
57
57
  os: str
58
58
  free_threaded: bool
59
59
  debug_build: bool
60
- marker_environment: dict[str, str]
60
+ marker_environment: MarkerEnvironment
61
61
  prefix: str | None
62
62
  base_prefix: str | None
63
63
  real_prefix: str | None
@@ -629,6 +629,20 @@ class PythonInfo: # ruff:ignore[too-many-public-methods]
629
629
  yield upper
630
630
 
631
631
 
632
+ class MarkerEnvironment(TypedDict):
633
+ implementation_name: str
634
+ implementation_version: str
635
+ os_name: str
636
+ platform_machine: str
637
+ platform_release: str
638
+ platform_system: str
639
+ platform_version: str
640
+ python_full_version: str
641
+ platform_python_implementation: str
642
+ python_version: str
643
+ sys_platform: str
644
+
645
+
632
646
  KNOWN_ARCHITECTURES: frozenset[str] = frozenset({
633
647
  "arm64",
634
648
  "loongarch64",
@@ -672,6 +686,7 @@ def normalize_isa(isa: str) -> str:
672
686
 
673
687
  __all__ = [
674
688
  "KNOWN_ARCHITECTURES",
689
+ "MarkerEnvironment",
675
690
  "PythonInfo",
676
691
  "VersionInfo",
677
692
  "normalize_isa",
@@ -15,7 +15,7 @@ import pytest
15
15
  from packaging.markers import default_environment
16
16
  from setuptools.dist import Distribution
17
17
 
18
- from python_discovery import DiskCache, PythonInfo, PythonSpec
18
+ from python_discovery import DiskCache, MarkerEnvironment, PythonInfo, PythonSpec
19
19
  from python_discovery import _cached_py_info as cached_py_info
20
20
  from python_discovery._py_info import VersionInfo
21
21
 
@@ -500,6 +500,10 @@ def test_marker_environment_matches_target_interpreter() -> None:
500
500
  assert info.marker_environment == default_environment()
501
501
 
502
502
 
503
+ def test_marker_environment_type_has_standard_keys() -> None:
504
+ assert MarkerEnvironment.__required_keys__ == default_environment().keys()
505
+
506
+
503
507
  def test_marker_environment_uses_target_platform(tmp_path: Path) -> None:
504
508
  (tmp_path / "sitecustomize.py").write_text(
505
509
  'import platform\nplatform.machine = lambda: "target-machine"\nplatform.release = lambda: "target-release"\n',