python-discovery 1.7.0__py3-none-any.whl → 1.9.0__py3-none-any.whl

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.
@@ -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,6 +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: MarkerEnvironment
60
61
  prefix: str | None
61
62
  base_prefix: str | None
62
63
  real_prefix: str | None
@@ -628,6 +629,20 @@ class PythonInfo: # ruff:ignore[too-many-public-methods]
628
629
  yield upper
629
630
 
630
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
+
631
646
  KNOWN_ARCHITECTURES: frozenset[str] = frozenset({
632
647
  "arm64",
633
648
  "loongarch64",
@@ -671,6 +686,7 @@ def normalize_isa(isa: str) -> str:
671
686
 
672
687
  __all__ = [
673
688
  "KNOWN_ARCHITECTURES",
689
+ "MarkerEnvironment",
674
690
  "PythonInfo",
675
691
  "VersionInfo",
676
692
  "normalize_isa",
@@ -64,6 +64,30 @@ class PythonInfoCollector:
64
64
  self.os = os.name
65
65
  self.free_threaded = sysconfig.get_config_var("Py_GIL_DISABLED") == 1
66
66
  self.debug_build = bool(sysconfig.get_config_var("Py_DEBUG"))
67
+ # Vermin checks the whole script against Python 2.7 despite the version gate above.
68
+ interpreter = getattr(sys, "implementation") # ruff:ignore[get-attr-with-constant]
69
+ interpreter_version = interpreter.version
70
+ marker_version = "{}.{}.{}{}".format(
71
+ interpreter_version.major,
72
+ interpreter_version.minor,
73
+ interpreter_version.micro,
74
+ "{}{}".format(interpreter_version.releaselevel[0], interpreter_version.serial)
75
+ if interpreter_version.releaselevel != "final"
76
+ else "",
77
+ )
78
+ self.marker_environment = {
79
+ "implementation_name": interpreter.name,
80
+ "implementation_version": marker_version,
81
+ "os_name": os.name,
82
+ "platform_machine": platform.machine(),
83
+ "platform_release": platform.release(),
84
+ "platform_system": platform.system(),
85
+ "platform_version": platform.version(),
86
+ "python_full_version": platform.python_version(),
87
+ "platform_python_implementation": platform.python_implementation(),
88
+ "python_version": ".".join(platform.python_version_tuple()[:2]),
89
+ "sys_platform": sys.platform,
90
+ }
67
91
 
68
92
  def _init_prefixes(self):
69
93
  def abs_path(value):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: python-discovery
3
- Version: 1.7.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
@@ -1,17 +1,17 @@
1
- python_discovery/__init__.py,sha256=Hi4j3pMvC8Fo8KoNL-wOHsPSCUHwY4c0qvv5sjnFzME,808
1
+ python_discovery/__init__.py,sha256=BV4pKMWDAK_3pU8o2hYvtL30WKs_wTzIBRuFV7nUaug,852
2
2
  python_discovery/_cache.py,sha256=svmG2GzUQzd2xTjAbm2eX1CKxxGAglfv4kxaPuxwPIA,5147
3
3
  python_discovery/_cached_py_info.py,sha256=15P5_TODxkZCkNfD2Uk5dtPxGf0Nea_aWm2N7uY9zbY,12059
4
4
  python_discovery/_compat.py,sha256=iqxGuhK9rPaiui80G1H1KrweoMJ16gyLYEmUrSXrp5c,709
5
5
  python_discovery/_discovery.py,sha256=Ulq3gbOrCvVULengzFF20yrDwGYCj3xs86CGqF2LThc,23212
6
- python_discovery/_py_info.py,sha256=fAhFj5swYdGvhJpAXR6b6O1yT2MSbRXTDMrdu15e6q8,26965
7
- python_discovery/_py_info_collect.py,sha256=3PNlySbxNSHDjBw8KJ_olVpOXww1qhGdY28YoLfF0Z8,16160
6
+ python_discovery/_py_info.py,sha256=AzL53BYCDB8nxVBbXyOh4YsFtZft-HoTG7EnCJdp7B8,27377
7
+ python_discovery/_py_info_collect.py,sha256=k9P4JzNkvW9iw37teeu7L6Y27ytWTnvWiK47B3gm5xg,17390
8
8
  python_discovery/_py_spec.py,sha256=14WRyDOLEQt7COevcUU5Rb6sgy99l9XI5XEQRUtCHf8,11800
9
9
  python_discovery/_specifier.py,sha256=9sMnJs7FTfIIduTCKKTA7Lk7onARqwkG_zzFIqgj0xs,10364
10
10
  python_discovery/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
11
  python_discovery/_windows/__init__.py,sha256=qthcyGh36b3WkeSbZ4ECRRYLbCOCaQu5X_DRZ98tXfk,315
12
12
  python_discovery/_windows/_pep514.py,sha256=Vhxe-3hETFIXQrekLqOHmzG5eq5moeR8b0dCS80zbBg,8026
13
13
  python_discovery/_windows/_propose.py,sha256=EE-N-BiNgrFU9mQ34SkoF5gRaNjtspghssQxT9uRQi0,1756
14
- python_discovery-1.7.0.dist-info/METADATA,sha256=FOu5Fx2hWx_B48bPGJK6vX-1lRqt3ahuJfbn86jW1tw,3937
15
- python_discovery-1.7.0.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
16
- python_discovery-1.7.0.dist-info/licenses/LICENSE,sha256=kOJeH68qSq6o2V7o5_VziwUqGswMnFgGgQH5Mahr1Yg,1023
17
- python_discovery-1.7.0.dist-info/RECORD,,
14
+ python_discovery-1.9.0.dist-info/METADATA,sha256=Bho3HCmi0jKsr1vRJbe9CU2J0PctXyaX6MsWsT_uk8A,3937
15
+ python_discovery-1.9.0.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
16
+ python_discovery-1.9.0.dist-info/licenses/LICENSE,sha256=kOJeH68qSq6o2V7o5_VziwUqGswMnFgGgQH5Mahr1Yg,1023
17
+ python_discovery-1.9.0.dist-info/RECORD,,