Skip to main content

A utility to find python versions on your system

Project description

FindPython

A utility to find python versions on your system.

Tests PyPI PyPI - Python Version pdm-managed

Description

This library is a rewrite of pythonfinder project by @techalchemy. It simplifies the whole code structure while preserving most of the original features.

Installation

FindPython is installable via any kind of package manager including pip:

pip install findpython
Expand this section to see findpython's availability in the package ecosystem Packaging status

Usage

>>> import findpython
>>> findpython.find(3, 9)  # Find by major and minor version
<PythonVersion executable=PosixPath('/opt/homebrew/bin/python3.9'), version=<Version('3.9.10')>, architecture='64bit', major=3, minor=9, patch=10>
>>> findpython.find("3.9")  # Find by version string
<PythonVersion executable=PosixPath('/opt/homebrew/bin/python3.9'), version=<Version('3.9.10')>, architecture='64bit', major=3, minor=9, patch=10>
>>> findpython.find("3.9-32")  # Find by version string and architecture
<PythonVersion executable=WindowsPath('C:\\Python\\3.9-32\\python.exe'), version=<Version('3.9.10')>, architecture='32bit', major=3, minor=9, patch=10>
>>> findpython.find(name="python3")  # Find by executable name
<PythonVersion executable=PosixPath('/Users/fming/Library/PythonUp/bin/python3'), version=<Version('3.10.2')>, architecture='64bit', major=3, minor=10, patch=2>
>>> findpython.find("python3")  # Find by executable name without keyword argument, same as above
<PythonVersion executable=PosixPath('/Users/fming/Library/PythonUp/bin/python3'), version=<Version('3.10.2')>, architecture='64bit', major=3, minor=10, patch=2>
>>> findpython.find_all(major=3, minor=9)  # Same arguments as `find()`, but return all matches
[<PythonVersion executable=PosixPath('/opt/homebrew/bin/python3.9'), version=<Version('3.9.10')>, architecture='64bit', major=3, minor=9, patch=10>, <PythonVersion executable=PosixPath('/opt/homebrew/bin/python3'), version=<Version('3.9.10')>, architecture='64bit', major=3, minor=9, patch=10>, <PythonVersion executable=PosixPath('/Users/fming/Library/PythonUp/cmd/python3.9'), version=<Version('3.9.9')>, architecture='64bit', major=3, minor=9, patch=9>, <PythonVersion executable=PosixPath('/usr/local/bin/python3.9'), version=<Version('3.9.5')>, architecture='64bit', major=3, minor=9, patch=5>, <PythonVersion executable=PosixPath('/usr/local/bin/python3'), version=<Version('3.9.5')>, architecture='64bit', major=3, minor=9, patch=5>]

CLI Usage

In addition, FindPython provides a CLI interface to find python versions:

usage: findpython [-h] [-V] [-a] [--resolve-symlink] [-v] [--no-same-file] [--no-same-python] [--providers PROVIDERS]
                  [version_spec]

A utility to find python versions on your system

positional arguments:
  version_spec          Python version spec or name

options:
  -h, --help            show this help message and exit
  -V, --version         show program's version number and exit
  -a, --all             Show all matching python versions
  --resolve-symlink     Resolve all symlinks
  -v, --verbose         Verbose output
  --no-same-file        Eliminate the duplicated results with the same file contents
  --no-same-python      Eliminate the duplicated results with the same sys.executable
  --providers PROVIDERS
                        Select provider(s) to use

Integration

FindPython finds Python from the following places:

  • PATH environment variable
  • pyenv install root
  • asdf python install root
  • rye toolchain install root
  • /Library/Frameworks/Python.framework/Versions (MacOS)
  • Windows registry (Windows only)

License

FindPython is released under MIT License.

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

findpython-0.6.1.tar.gz (17.8 kB view details)

Uploaded Source

Built Distribution

findpython-0.6.1-py3-none-any.whl (20.6 kB view details)

Uploaded Python 3

File details

Details for the file findpython-0.6.1.tar.gz.

File metadata

  • Download URL: findpython-0.6.1.tar.gz
  • Upload date:
  • Size: 17.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.12

File hashes

Hashes for findpython-0.6.1.tar.gz
Algorithm Hash digest
SHA256 56e52b409a92bcbd495cf981c85acf137f3b3e51cc769b46eba219bb1ab7533c
MD5 cfacba6dea0e987508705fb70ec868b5
BLAKE2b-256 2957a35de26696baa005ddcfce8af495fb8cdb75942ebebf1cf219a04706fc81

See more details on using hashes here.

Provenance

File details

Details for the file findpython-0.6.1-py3-none-any.whl.

File metadata

  • Download URL: findpython-0.6.1-py3-none-any.whl
  • Upload date:
  • Size: 20.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.12

File hashes

Hashes for findpython-0.6.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1fb4d709205de185b0561900267dfff64a841c910fe28d6038b2394ff925a81a
MD5 adc8a5c0707f1345bb1f976591148fe3
BLAKE2b-256 c2a826dc9afd5502fd07d2694143b5084ed9ad87df09588af7e6992afe2a227b

See more details on using hashes here.

Provenance

Supported by

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