python-discovery 1.2.1__tar.gz → 1.2.2__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 (53) hide show
  1. {python_discovery-1.2.1 → python_discovery-1.2.2}/.github/workflows/check.yaml +1 -1
  2. {python_discovery-1.2.1 → python_discovery-1.2.2}/.github/workflows/release.yaml +1 -1
  3. {python_discovery-1.2.1 → python_discovery-1.2.2}/.pre-commit-config.yaml +3 -3
  4. {python_discovery-1.2.1 → python_discovery-1.2.2}/PKG-INFO +1 -1
  5. python_discovery-1.2.2/docs/changelog/59.bugfix.rst +1 -0
  6. {python_discovery-1.2.1 → python_discovery-1.2.2}/docs/conf.py +7 -1
  7. {python_discovery-1.2.1 → python_discovery-1.2.2}/src/python_discovery/__init__.py +2 -1
  8. {python_discovery-1.2.1 → python_discovery-1.2.2}/src/python_discovery/_py_info.py +25 -3
  9. {python_discovery-1.2.1 → python_discovery-1.2.2}/tests/py_info/test_py_info.py +2 -2
  10. {python_discovery-1.2.1 → python_discovery-1.2.2}/tests/test_py_spec.py +10 -0
  11. {python_discovery-1.2.1 → python_discovery-1.2.2}/.github/FUNDING.yaml +0 -0
  12. {python_discovery-1.2.1 → python_discovery-1.2.2}/.github/SECURITY.md +0 -0
  13. {python_discovery-1.2.1 → python_discovery-1.2.2}/.github/dependabot.yaml +0 -0
  14. {python_discovery-1.2.1 → python_discovery-1.2.2}/.github/release.yaml +0 -0
  15. {python_discovery-1.2.1 → python_discovery-1.2.2}/.gitignore +0 -0
  16. {python_discovery-1.2.1 → python_discovery-1.2.2}/.readthedocs.yaml +0 -0
  17. {python_discovery-1.2.1 → python_discovery-1.2.2}/.readthedocs.yml +0 -0
  18. {python_discovery-1.2.1 → python_discovery-1.2.2}/CODE_OF_CONDUCT.md +0 -0
  19. {python_discovery-1.2.1 → python_discovery-1.2.2}/LICENSE +0 -0
  20. {python_discovery-1.2.1 → python_discovery-1.2.2}/README.md +0 -0
  21. {python_discovery-1.2.1 → python_discovery-1.2.2}/docs/_static/custom.css +0 -0
  22. {python_discovery-1.2.1 → python_discovery-1.2.2}/docs/_static/logo.svg +0 -0
  23. {python_discovery-1.2.1 → python_discovery-1.2.2}/docs/explanation.rst +0 -0
  24. {python_discovery-1.2.1 → python_discovery-1.2.2}/docs/how-to/standalone-usage.rst +0 -0
  25. {python_discovery-1.2.1 → python_discovery-1.2.2}/docs/index.rst +0 -0
  26. {python_discovery-1.2.1 → python_discovery-1.2.2}/docs/reference/api.rst +0 -0
  27. {python_discovery-1.2.1 → python_discovery-1.2.2}/docs/reference/environment-variables.rst +0 -0
  28. {python_discovery-1.2.1 → python_discovery-1.2.2}/docs/tutorial/getting-started.rst +0 -0
  29. {python_discovery-1.2.1 → python_discovery-1.2.2}/pyproject.toml +0 -0
  30. {python_discovery-1.2.1 → python_discovery-1.2.2}/src/python_discovery/_cache.py +0 -0
  31. {python_discovery-1.2.1 → python_discovery-1.2.2}/src/python_discovery/_cached_py_info.py +0 -0
  32. {python_discovery-1.2.1 → python_discovery-1.2.2}/src/python_discovery/_compat.py +0 -0
  33. {python_discovery-1.2.1 → python_discovery-1.2.2}/src/python_discovery/_discovery.py +0 -0
  34. {python_discovery-1.2.1 → python_discovery-1.2.2}/src/python_discovery/_py_spec.py +0 -0
  35. {python_discovery-1.2.1 → python_discovery-1.2.2}/src/python_discovery/_specifier.py +0 -0
  36. {python_discovery-1.2.1 → python_discovery-1.2.2}/src/python_discovery/_windows/__init__.py +0 -0
  37. {python_discovery-1.2.1 → python_discovery-1.2.2}/src/python_discovery/_windows/_pep514.py +0 -0
  38. {python_discovery-1.2.1 → python_discovery-1.2.2}/src/python_discovery/_windows/_propose.py +0 -0
  39. {python_discovery-1.2.1 → python_discovery-1.2.2}/src/python_discovery/py.typed +0 -0
  40. {python_discovery-1.2.1 → python_discovery-1.2.2}/tests/conftest.py +0 -0
  41. {python_discovery-1.2.1 → python_discovery-1.2.2}/tests/py_info/test_py_info_exe_based_of.py +0 -0
  42. {python_discovery-1.2.1 → python_discovery-1.2.2}/tests/test_cache.py +0 -0
  43. {python_discovery-1.2.1 → python_discovery-1.2.2}/tests/test_cached_py_info.py +0 -0
  44. {python_discovery-1.2.1 → python_discovery-1.2.2}/tests/test_discovery.py +0 -0
  45. {python_discovery-1.2.1 → python_discovery-1.2.2}/tests/test_discovery_extra.py +0 -0
  46. {python_discovery-1.2.1 → python_discovery-1.2.2}/tests/test_py_info_extra.py +0 -0
  47. {python_discovery-1.2.1 → python_discovery-1.2.2}/tests/test_py_spec_extra.py +0 -0
  48. {python_discovery-1.2.1 → python_discovery-1.2.2}/tests/test_specifier.py +0 -0
  49. {python_discovery-1.2.1 → python_discovery-1.2.2}/tests/windows/conftest.py +0 -0
  50. {python_discovery-1.2.1 → python_discovery-1.2.2}/tests/windows/test_windows.py +0 -0
  51. {python_discovery-1.2.1 → python_discovery-1.2.2}/tests/windows/test_windows_pep514.py +0 -0
  52. {python_discovery-1.2.1 → python_discovery-1.2.2}/tests/windows/winreg_mock_values.py +0 -0
  53. {python_discovery-1.2.1 → python_discovery-1.2.2}/tox.toml +0 -0
@@ -39,7 +39,7 @@ jobs:
39
39
  fetch-depth: 0
40
40
  persist-credentials: false
41
41
  - name: Install the latest version of uv
42
- uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7
42
+ uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0
43
43
  with:
44
44
  enable-cache: false
45
45
  cache-dependency-glob: "pyproject.toml"
@@ -18,7 +18,7 @@ jobs:
18
18
  fetch-depth: 0
19
19
  persist-credentials: false
20
20
  - name: Install the latest version of uv
21
- uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7
21
+ uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0
22
22
  with:
23
23
  enable-cache: false
24
24
  cache-dependency-glob: "pyproject.toml"
@@ -5,7 +5,7 @@ repos:
5
5
  - id: end-of-file-fixer
6
6
  - id: trailing-whitespace
7
7
  - repo: https://github.com/python-jsonschema/check-jsonschema
8
- rev: 0.37.0
8
+ rev: 0.37.1
9
9
  hooks:
10
10
  - id: check-github-workflows
11
11
  args: ["--verbose"]
@@ -15,11 +15,11 @@ repos:
15
15
  - id: codespell
16
16
  additional_dependencies: ["tomli>=2.4"]
17
17
  - repo: https://github.com/tox-dev/pyproject-fmt
18
- rev: "v2.20.0"
18
+ rev: "v2.21.0"
19
19
  hooks:
20
20
  - id: pyproject-fmt
21
21
  - repo: https://github.com/astral-sh/ruff-pre-commit
22
- rev: "v0.15.7"
22
+ rev: "v0.15.9"
23
23
  hooks:
24
24
  - id: ruff-format
25
25
  - id: ruff
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-discovery
3
- Version: 1.2.1
3
+ Version: 1.2.2
4
4
  Summary: Python interpreter discovery
5
5
  Project-URL: Changelog, https://github.com/tox-dev/python-discovery/releases
6
6
  Project-URL: Documentation, https://python-discovery.readthedocs.io
@@ -0,0 +1 @@
1
+ export normalize_isa and deprecate KNOWN_ARCHITECTURES - by :user:`rahuldevikar`.
@@ -21,13 +21,19 @@ extensions = [
21
21
  "sphinxcontrib.mermaid",
22
22
  ]
23
23
 
24
+ extlinks = {
25
+ "issue": ("https://github.com/tox-dev/python-discovery/issues/%s", "#%s"),
26
+ "pull": ("https://github.com/tox-dev/python-discovery/pull/%s", "PR #%s"),
27
+ "user": ("https://github.com/%s", "@%s"),
28
+ }
29
+
24
30
  intersphinx_mapping = {
25
31
  "python": ("https://docs.python.org/3", None),
26
32
  }
27
33
 
28
34
  templates_path = []
29
35
  source_suffix = ".rst"
30
- exclude_patterns = ["_build"]
36
+ exclude_patterns = ["_build", "changelog/*.rst"]
31
37
 
32
38
  main_doc = "index"
33
39
  pygments_style = "default"
@@ -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
9
- from ._py_info import KNOWN_ARCHITECTURES, PythonInfo
9
+ from ._py_info import KNOWN_ARCHITECTURES, PythonInfo, normalize_isa
10
10
  from ._py_spec import PythonSpec
11
11
  from ._specifier import SimpleSpecifier, SimpleSpecifierSet, SimpleVersion
12
12
 
@@ -24,4 +24,5 @@ __all__ = [
24
24
  "SimpleVersion",
25
25
  "__version__",
26
26
  "get_interpreter",
27
+ "normalize_isa",
27
28
  ]
@@ -770,21 +770,43 @@ class PythonInfo: # noqa: PLR0904
770
770
 
771
771
  KNOWN_ARCHITECTURES: frozenset[str] = frozenset({
772
772
  "arm64",
773
- "i686",
774
773
  "loongarch64",
774
+ "ppc",
775
775
  "ppc64",
776
776
  "ppc64le",
777
777
  "riscv64",
778
778
  "s390x",
779
+ "sparc64",
779
780
  "x86",
780
781
  "x86_64",
781
782
  })
782
- """Known CPU architecture (ISA) values after normalization."""
783
+ """Known CPU architecture (ISA) values after normalization.
784
+
785
+ .. deprecated::
786
+ Use :func:`normalize_isa` instead, which handles both known and unknown architectures.
787
+ """
783
788
 
784
789
 
785
790
  def normalize_isa(isa: str) -> str:
791
+ """
792
+ Normalize an ISA (instruction set architecture) string to a canonical form.
793
+
794
+ Known aliases are mapped (e.g. ``amd64`` → ``x86_64``, ``aarch64`` → ``arm64``).
795
+ Unrecognized values are lowercased and returned as-is.
796
+ """
786
797
  low = isa.lower()
787
- return {"amd64": "x86_64", "aarch64": "arm64", "i386": "x86", "i586": "x86"}.get(low, low)
798
+ return {
799
+ "amd64": "x86_64",
800
+ "aarch64": "arm64",
801
+ "i386": "x86",
802
+ "i486": "x86",
803
+ "i586": "x86",
804
+ "i686": "x86",
805
+ "powerpc": "ppc",
806
+ "powerpc64": "ppc64",
807
+ "powerpc64le": "ppc64le",
808
+ "sparcv9": "sparc64",
809
+ }.get(low, low)
788
810
 
789
811
 
790
812
  def _main() -> None: # pragma: no cover
@@ -14,7 +14,7 @@ from typing import TYPE_CHECKING, NamedTuple
14
14
  import pytest
15
15
  from setuptools.dist import Distribution
16
16
 
17
- from python_discovery import KNOWN_ARCHITECTURES, DiskCache, PythonInfo, PythonSpec
17
+ from python_discovery import DiskCache, PythonInfo, PythonSpec
18
18
  from python_discovery import _cached_py_info as cached_py_info
19
19
  from python_discovery._py_info import VersionInfo
20
20
 
@@ -338,7 +338,7 @@ def test_py_info_machine_property() -> None:
338
338
  assert machine is not None
339
339
  assert isinstance(machine, str)
340
340
  assert len(machine) > 0
341
- assert machine in KNOWN_ARCHITECTURES, f"unexpected machine value: {machine}"
341
+ assert machine == machine.lower(), f"machine value should be lowercase: {machine}"
342
342
 
343
343
 
344
344
  def test_py_info_machine_in_spec() -> None:
@@ -217,9 +217,19 @@ def test_spec_satisfies_machine(left: str, right: str, expected: bool) -> None:
217
217
  pytest.param("x86_64", "x86_64", id="x86_64"),
218
218
  pytest.param("arm64", "arm64", id="arm64"),
219
219
  pytest.param("x86", "x86", id="x86"),
220
+ pytest.param("i386", "x86", id="i386"),
221
+ pytest.param("i486", "x86", id="i486"),
222
+ pytest.param("i586", "x86", id="i586"),
223
+ pytest.param("i686", "x86", id="i686"),
220
224
  pytest.param("ppc64le", "ppc64le", id="ppc64le"),
225
+ pytest.param("powerpc", "ppc", id="powerpc"),
226
+ pytest.param("powerpc64", "ppc64", id="powerpc64"),
227
+ pytest.param("powerpc64le", "ppc64le", id="powerpc64le"),
221
228
  pytest.param("riscv64", "riscv64", id="riscv64"),
222
229
  pytest.param("s390x", "s390x", id="s390x"),
230
+ pytest.param("sparcv9", "sparc64", id="sparcv9"),
231
+ pytest.param("sparc64", "sparc64", id="sparc64"),
232
+ pytest.param("alpha", "alpha", id="alpha-passthrough"),
223
233
  ],
224
234
  )
225
235
  def test_normalize_isa(isa: str, normalized: str) -> None: