python-discovery 1.2.0__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.0 → python_discovery-1.2.2}/.github/dependabot.yaml +2 -0
  2. {python_discovery-1.2.0 → python_discovery-1.2.2}/.github/workflows/check.yaml +4 -3
  3. {python_discovery-1.2.0 → python_discovery-1.2.2}/.github/workflows/release.yaml +7 -6
  4. {python_discovery-1.2.0 → python_discovery-1.2.2}/.pre-commit-config.yaml +7 -3
  5. {python_discovery-1.2.0 → python_discovery-1.2.2}/PKG-INFO +1 -1
  6. python_discovery-1.2.2/docs/changelog/59.bugfix.rst +1 -0
  7. {python_discovery-1.2.0 → python_discovery-1.2.2}/docs/conf.py +7 -1
  8. {python_discovery-1.2.0 → python_discovery-1.2.2}/src/python_discovery/__init__.py +3 -1
  9. {python_discovery-1.2.0 → python_discovery-1.2.2}/src/python_discovery/_py_info.py +37 -1
  10. {python_discovery-1.2.0 → python_discovery-1.2.2}/tests/py_info/test_py_info.py +1 -2
  11. {python_discovery-1.2.0 → python_discovery-1.2.2}/tests/test_py_spec.py +10 -0
  12. {python_discovery-1.2.0 → python_discovery-1.2.2}/.github/FUNDING.yaml +0 -0
  13. {python_discovery-1.2.0 → python_discovery-1.2.2}/.github/SECURITY.md +0 -0
  14. {python_discovery-1.2.0 → python_discovery-1.2.2}/.github/release.yaml +0 -0
  15. {python_discovery-1.2.0 → python_discovery-1.2.2}/.gitignore +0 -0
  16. {python_discovery-1.2.0 → python_discovery-1.2.2}/.readthedocs.yaml +0 -0
  17. {python_discovery-1.2.0 → python_discovery-1.2.2}/.readthedocs.yml +0 -0
  18. {python_discovery-1.2.0 → python_discovery-1.2.2}/CODE_OF_CONDUCT.md +0 -0
  19. {python_discovery-1.2.0 → python_discovery-1.2.2}/LICENSE +0 -0
  20. {python_discovery-1.2.0 → python_discovery-1.2.2}/README.md +0 -0
  21. {python_discovery-1.2.0 → python_discovery-1.2.2}/docs/_static/custom.css +0 -0
  22. {python_discovery-1.2.0 → python_discovery-1.2.2}/docs/_static/logo.svg +0 -0
  23. {python_discovery-1.2.0 → python_discovery-1.2.2}/docs/explanation.rst +0 -0
  24. {python_discovery-1.2.0 → python_discovery-1.2.2}/docs/how-to/standalone-usage.rst +0 -0
  25. {python_discovery-1.2.0 → python_discovery-1.2.2}/docs/index.rst +0 -0
  26. {python_discovery-1.2.0 → python_discovery-1.2.2}/docs/reference/api.rst +0 -0
  27. {python_discovery-1.2.0 → python_discovery-1.2.2}/docs/reference/environment-variables.rst +0 -0
  28. {python_discovery-1.2.0 → python_discovery-1.2.2}/docs/tutorial/getting-started.rst +0 -0
  29. {python_discovery-1.2.0 → python_discovery-1.2.2}/pyproject.toml +17 -17
  30. {python_discovery-1.2.0 → python_discovery-1.2.2}/src/python_discovery/_cache.py +0 -0
  31. {python_discovery-1.2.0 → python_discovery-1.2.2}/src/python_discovery/_cached_py_info.py +0 -0
  32. {python_discovery-1.2.0 → python_discovery-1.2.2}/src/python_discovery/_compat.py +0 -0
  33. {python_discovery-1.2.0 → python_discovery-1.2.2}/src/python_discovery/_discovery.py +0 -0
  34. {python_discovery-1.2.0 → python_discovery-1.2.2}/src/python_discovery/_py_spec.py +0 -0
  35. {python_discovery-1.2.0 → python_discovery-1.2.2}/src/python_discovery/_specifier.py +0 -0
  36. {python_discovery-1.2.0 → python_discovery-1.2.2}/src/python_discovery/_windows/__init__.py +0 -0
  37. {python_discovery-1.2.0 → python_discovery-1.2.2}/src/python_discovery/_windows/_pep514.py +0 -0
  38. {python_discovery-1.2.0 → python_discovery-1.2.2}/src/python_discovery/_windows/_propose.py +0 -0
  39. {python_discovery-1.2.0 → python_discovery-1.2.2}/src/python_discovery/py.typed +0 -0
  40. {python_discovery-1.2.0 → python_discovery-1.2.2}/tests/conftest.py +0 -0
  41. {python_discovery-1.2.0 → python_discovery-1.2.2}/tests/py_info/test_py_info_exe_based_of.py +0 -0
  42. {python_discovery-1.2.0 → python_discovery-1.2.2}/tests/test_cache.py +0 -0
  43. {python_discovery-1.2.0 → python_discovery-1.2.2}/tests/test_cached_py_info.py +0 -0
  44. {python_discovery-1.2.0 → python_discovery-1.2.2}/tests/test_discovery.py +0 -0
  45. {python_discovery-1.2.0 → python_discovery-1.2.2}/tests/test_discovery_extra.py +0 -0
  46. {python_discovery-1.2.0 → python_discovery-1.2.2}/tests/test_py_info_extra.py +0 -0
  47. {python_discovery-1.2.0 → python_discovery-1.2.2}/tests/test_py_spec_extra.py +0 -0
  48. {python_discovery-1.2.0 → python_discovery-1.2.2}/tests/test_specifier.py +0 -0
  49. {python_discovery-1.2.0 → python_discovery-1.2.2}/tests/windows/conftest.py +0 -0
  50. {python_discovery-1.2.0 → python_discovery-1.2.2}/tests/windows/test_windows.py +0 -0
  51. {python_discovery-1.2.0 → python_discovery-1.2.2}/tests/windows/test_windows_pep514.py +0 -0
  52. {python_discovery-1.2.0 → python_discovery-1.2.2}/tests/windows/winreg_mock_values.py +0 -0
  53. {python_discovery-1.2.0 → python_discovery-1.2.2}/tox.toml +0 -0
@@ -4,3 +4,5 @@ updates:
4
4
  directory: "/"
5
5
  schedule:
6
6
  interval: "daily"
7
+ cooldown:
8
+ default-days: 7
@@ -34,13 +34,14 @@ jobs:
34
34
  - dev
35
35
  - pkg_meta
36
36
  steps:
37
- - uses: actions/checkout@v6
37
+ - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
38
38
  with:
39
39
  fetch-depth: 0
40
+ persist-credentials: false
40
41
  - name: Install the latest version of uv
41
- uses: astral-sh/setup-uv@v7
42
+ uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0
42
43
  with:
43
- enable-cache: true
44
+ enable-cache: false
44
45
  cache-dependency-glob: "pyproject.toml"
45
46
  github-token: ${{ secrets.GITHUB_TOKEN }}
46
47
  - name: Install tox
@@ -13,19 +13,20 @@ jobs:
13
13
  build:
14
14
  runs-on: ubuntu-latest
15
15
  steps:
16
- - uses: actions/checkout@v6
16
+ - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
17
17
  with:
18
18
  fetch-depth: 0
19
+ persist-credentials: false
19
20
  - name: Install the latest version of uv
20
- uses: astral-sh/setup-uv@v7
21
+ uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0
21
22
  with:
22
- enable-cache: true
23
+ enable-cache: false
23
24
  cache-dependency-glob: "pyproject.toml"
24
25
  github-token: ${{ secrets.GITHUB_TOKEN }}
25
26
  - name: Build package
26
27
  run: uv build --python 3.14 --python-preference only-managed --sdist --wheel . --out-dir dist
27
28
  - name: Store the distribution packages
28
- uses: actions/upload-artifact@v7
29
+ uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7
29
30
  with:
30
31
  name: ${{ env.dists-artifact-name }}
31
32
  path: dist/*
@@ -41,11 +42,11 @@ jobs:
41
42
  id-token: write
42
43
  steps:
43
44
  - name: Download all the dists
44
- uses: actions/download-artifact@v8
45
+ uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
45
46
  with:
46
47
  name: ${{ env.dists-artifact-name }}
47
48
  path: dist/
48
49
  - name: Publish to PyPI
49
- uses: pypa/gh-action-pypi-publish@v1.13.0
50
+ uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0
50
51
  with:
51
52
  attestations: true
@@ -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.18.1"
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.6"
22
+ rev: "v0.15.9"
23
23
  hooks:
24
24
  - id: ruff-format
25
25
  - id: ruff
@@ -31,6 +31,10 @@ repos:
31
31
  additional_dependencies:
32
32
  - prettier@3.8.1
33
33
  - "@prettier/plugin-xml@3.4.2"
34
+ - repo: https://github.com/zizmorcore/zizmor-pre-commit
35
+ rev: v1.23.1
36
+ hooks:
37
+ - id: zizmor
34
38
  - repo: meta
35
39
  hooks:
36
40
  - id: check-hooks-apply
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-discovery
3
- Version: 1.2.0
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,13 +6,14 @@ 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 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
 
13
13
  __version__ = version("python-discovery")
14
14
 
15
15
  __all__ = [
16
+ "KNOWN_ARCHITECTURES",
16
17
  "ContentStore",
17
18
  "DiskCache",
18
19
  "PyInfoCache",
@@ -23,4 +24,5 @@ __all__ = [
23
24
  "SimpleVersion",
24
25
  "__version__",
25
26
  "get_interpreter",
27
+ "normalize_isa",
26
28
  ]
@@ -768,9 +768,45 @@ class PythonInfo: # noqa: PLR0904
768
768
  yield upper
769
769
 
770
770
 
771
+ KNOWN_ARCHITECTURES: frozenset[str] = frozenset({
772
+ "arm64",
773
+ "loongarch64",
774
+ "ppc",
775
+ "ppc64",
776
+ "ppc64le",
777
+ "riscv64",
778
+ "s390x",
779
+ "sparc64",
780
+ "x86",
781
+ "x86_64",
782
+ })
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
+ """
788
+
789
+
771
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
+ """
772
797
  low = isa.lower()
773
- return {"amd64": "x86_64", "aarch64": "arm64"}.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)
774
810
 
775
811
 
776
812
  def _main() -> None: # pragma: no cover
@@ -338,8 +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
- known_isas = {"arm64", "i686", "loongarch64", "ppc64", "ppc64le", "riscv64", "s390x", "x86", "x86_64"}
342
- assert machine in known_isas, f"unexpected machine value: {machine}"
341
+ assert machine == machine.lower(), f"machine value should be lowercase: {machine}"
343
342
 
344
343
 
345
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:
@@ -129,6 +129,23 @@ count = true
129
129
  [tool.pyproject-fmt]
130
130
  max_supported_python = "3.14"
131
131
 
132
+ [tool.ty]
133
+ src.exclude = [ "tests/windows/winreg_mock_values.py" ]
134
+
135
+ [[tool.ty.overrides]]
136
+ include = [ "src/python_discovery/_py_info.py", "src/python_discovery/_py_spec.py" ]
137
+ rules.unused-ignore-comment = "ignore"
138
+ rules.invalid-argument-type = "ignore"
139
+ rules.invalid-return-type = "ignore"
140
+ rules.no-matching-overload = "ignore"
141
+
142
+ [[tool.ty.overrides]]
143
+ include = [ "tests/**/*.py" ]
144
+ rules.unused-ignore-comment = "ignore"
145
+ rules.invalid-argument-type = "ignore"
146
+ rules.no-matching-overload = "ignore"
147
+ rules.unresolved-attribute = "ignore"
148
+
132
149
  [tool.pytest]
133
150
  ini_options.markers = [ "graalpy" ]
134
151
 
@@ -162,20 +179,3 @@ report.partial_branches = [
162
179
  report.show_missing = true
163
180
  html.show_contexts = true
164
181
  html.skip_covered = false
165
-
166
- [tool.ty]
167
- src.exclude = [ "tests/windows/winreg_mock_values.py" ]
168
-
169
- [[tool.ty.overrides]]
170
- include = [ "src/python_discovery/_py_info.py", "src/python_discovery/_py_spec.py" ]
171
- rules.unused-ignore-comment = "ignore"
172
- rules.invalid-argument-type = "ignore"
173
- rules.invalid-return-type = "ignore"
174
- rules.no-matching-overload = "ignore"
175
-
176
- [[tool.ty.overrides]]
177
- include = [ "tests/**/*.py" ]
178
- rules.unused-ignore-comment = "ignore"
179
- rules.invalid-argument-type = "ignore"
180
- rules.no-matching-overload = "ignore"
181
- rules.unresolved-attribute = "ignore"