Skip to main content

Python interpreter discovery

Project description

python-discovery

PyPI Supported Python versions Downloads check Documentation Status

What is python-discovery?

python-discovery is a library for discovering Python interpreters installed on your machine. You may have multiple Python versions from system packages, pyenv, mise, asdf, uv, or the Windows registry (PEP 514). This library finds the right one for you.

Give it a requirement like python3.12 or >=3.11,<3.13, and it searches all known locations, verifies each candidate, and returns detailed metadata about the match. Results are cached to disk so repeated lookups are fast.

Usage

from pathlib import Path

from python_discovery import DiskCache, get_interpreter

cache = DiskCache(root=Path("~/.cache/python-discovery").expanduser())
result = get_interpreter("python3.12", cache=cache)
if result is not None:
    print(result.executable)  # /usr/bin/python3.12
    print(result.implementation)  # CPython
    print(result.version_info[:3])  # (3, 12, 1)

The get_interpreter() function accepts various specification formats:

  • Absolute path: /usr/bin/python3.12
  • Version: 3.12
  • Implementation prefix: cpython3.12
  • Version specifier: >=3.10, >=3.11,<3.13

Documentation

Full documentation is available at python-discovery.readthedocs.io

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

python_discovery-1.3.1.tar.gz (68.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

python_discovery-1.3.1-py3-none-any.whl (33.2 kB view details)

Uploaded Python 3

File details

Details for the file python_discovery-1.3.1.tar.gz.

File metadata

  • Download URL: python_discovery-1.3.1.tar.gz
  • Upload date:
  • Size: 68.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for python_discovery-1.3.1.tar.gz
Algorithm Hash digest
SHA256 62f6db28064c9613e7ca76cb3f00c38c839a07c31c00dfe7ed0986493d2150a6
MD5 1b3cabb4f1581b79db2a529ce138c180
BLAKE2b-256 4860e88788207d81e46362cfbef0d4aaf4c0f49efc3c12d4c3fa3f542c34ebec

See more details on using hashes here.

Provenance

The following attestation bundles were made for python_discovery-1.3.1.tar.gz:

Publisher: release.yaml on tox-dev/python-discovery

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file python_discovery-1.3.1-py3-none-any.whl.

File metadata

File hashes

Hashes for python_discovery-1.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ed188687ebb3b82c01a17cd5ac62fc94d9f6487a7f1a0f9dfe89753fec91039c
MD5 0caa92b786390d7977c28b83b4b76839
BLAKE2b-256 b76fa05a317a66fee0aad270011461f1a63a453ed12471249f172f7d2e2bc7b4

See more details on using hashes here.

Provenance

The following attestation bundles were made for python_discovery-1.3.1-py3-none-any.whl:

Publisher: release.yaml on tox-dev/python-discovery

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page