METADATA 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. Metadata-Version: 2.4
  2. Name: python-discovery
  3. Version: 1.1.3
  4. Summary: Python interpreter discovery
  5. Project-URL: Changelog, https://github.com/tox-dev/python-discovery/releases
  6. Project-URL: Documentation, https://python-discovery.readthedocs.io
  7. Project-URL: Homepage, https://github.com/tox-dev/python-discovery
  8. Project-URL: Source, https://github.com/tox-dev/python-discovery
  9. Project-URL: Tracker, https://github.com/tox-dev/python-discovery/issues
  10. Maintainer-email: Bernát Gábor <gaborjbernat@gmail.com>
  11. License: Permission is hereby granted, free of charge, to any person obtaining a
  12. copy of this software and associated documentation files (the
  13. "Software"), to deal in the Software without restriction, including
  14. without limitation the rights to use, copy, modify, merge, publish,
  15. distribute, sublicense, and/or sell copies of the Software, and to
  16. permit persons to whom the Software is furnished to do so, subject to
  17. the following conditions:
  18. The above copyright notice and this permission notice shall be included
  19. in all copies or substantial portions of the Software.
  20. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  21. OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  22. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  23. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  24. CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  25. TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  26. SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  27. License-File: LICENSE
  28. Keywords: discovery,interpreter,python
  29. Classifier: Development Status :: 5 - Production/Stable
  30. Classifier: Intended Audience :: Developers
  31. Classifier: License :: OSI Approved :: MIT License
  32. Classifier: Operating System :: MacOS :: MacOS X
  33. Classifier: Operating System :: Microsoft :: Windows
  34. Classifier: Operating System :: POSIX
  35. Classifier: Programming Language :: Python :: 3 :: Only
  36. Classifier: Programming Language :: Python :: 3.8
  37. Classifier: Programming Language :: Python :: 3.9
  38. Classifier: Programming Language :: Python :: 3.10
  39. Classifier: Programming Language :: Python :: 3.11
  40. Classifier: Programming Language :: Python :: 3.12
  41. Classifier: Programming Language :: Python :: 3.13
  42. Classifier: Programming Language :: Python :: 3.14
  43. Classifier: Programming Language :: Python :: Implementation :: CPython
  44. Classifier: Topic :: Software Development :: Libraries
  45. Classifier: Topic :: Utilities
  46. Requires-Python: >=3.8
  47. Requires-Dist: filelock>=3.15.4
  48. Requires-Dist: platformdirs<5,>=4.3.6
  49. Provides-Extra: docs
  50. Requires-Dist: furo>=2025.12.19; extra == 'docs'
  51. Requires-Dist: sphinx-autodoc-typehints>=3.6.3; extra == 'docs'
  52. Requires-Dist: sphinx>=9.1; extra == 'docs'
  53. Requires-Dist: sphinxcontrib-mermaid>=2; extra == 'docs'
  54. Provides-Extra: testing
  55. Requires-Dist: covdefaults>=2.3; extra == 'testing'
  56. Requires-Dist: coverage>=7.5.4; extra == 'testing'
  57. Requires-Dist: pytest-mock>=3.14; extra == 'testing'
  58. Requires-Dist: pytest>=8.3.5; extra == 'testing'
  59. Requires-Dist: setuptools>=75.1; extra == 'testing'
  60. Description-Content-Type: text/markdown
  61. # [`python-discovery`](https://python-discovery.readthedocs.io/en/latest/)
  62. [![PyPI](https://img.shields.io/pypi/v/python-discovery?style=flat-square)](https://pypi.org/project/python-discovery/)
  63. [![Supported Python versions](https://img.shields.io/pypi/pyversions/python-discovery.svg)](https://pypi.org/project/python-discovery/)
  64. [![Downloads](https://static.pepy.tech/badge/python-discovery/month)](https://pepy.tech/project/python-discovery)
  65. [![check](https://github.com/tox-dev/python-discovery/actions/workflows/check.yaml/badge.svg)](https://github.com/tox-dev/python-discovery/actions/workflows/check.yaml)
  66. [![Documentation Status](https://readthedocs.org/projects/python-discovery/badge/?version=latest)](https://python-discovery.readthedocs.io/en/latest/?badge=latest)
  67. ## What is python-discovery?
  68. `python-discovery` is a library for discovering Python interpreters installed on your machine. You may have multiple
  69. Python versions from system packages, [pyenv](https://github.com/pyenv/pyenv), [mise](https://mise.jdx.dev/),
  70. [asdf](https://asdf-vm.com/), [uv](https://docs.astral.sh/uv/), or the Windows registry (PEP 514). This library finds
  71. the right one for you.
  72. Give it a requirement like `python3.12` or `>=3.11,<3.13`, and it searches all known locations, verifies each candidate,
  73. and returns detailed metadata about the match. Results are cached to disk so repeated lookups are fast.
  74. ## Usage
  75. ```python
  76. from pathlib import Path
  77. from python_discovery import DiskCache, get_interpreter
  78. cache = DiskCache(root=Path("~/.cache/python-discovery").expanduser())
  79. result = get_interpreter("python3.12", cache=cache)
  80. if result is not None:
  81. print(result.executable) # /usr/bin/python3.12
  82. print(result.implementation) # CPython
  83. print(result.version_info[:3]) # (3, 12, 1)
  84. ```
  85. The `get_interpreter()` function accepts various specification formats:
  86. - Absolute path: `/usr/bin/python3.12`
  87. - Version: `3.12`
  88. - Implementation prefix: `cpython3.12`
  89. - PEP 440 specifier: `>=3.10`, `>=3.11,<3.13`
  90. ## Documentation
  91. Full documentation is available at [python-discovery.readthedocs.io](https://python-discovery.readthedocs.io/en/latest/)