Skip to main content

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

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] [version_spec]

Find python files in a directory

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

Integration

FindPython finds Python from the following places:

  • PATH environment variable
  • pyenv
  • asdf
  • /Library/Frameworks/Python.framework/Versions (MacOS)
  • winreg (Windows)

License

FindPython is released under MIT License.

Metadata

Release files for findpython 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for findpython 0.1.1
File Size Uploaded
findpython-0.1.1.tar.gz 15.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for findpython 0.1.1
File Interpreter ABI Platform
findpython-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 34.8 kB

Release files / findpython-0.1.1.tar.gz

Download URL findpython-0.1.1.tar.gz
Size 15.4 kB
Tags Source
SHA-256 checksum
How to use checksums
bc64ecfeb03f92950af40da41c2447eda5c8ed22b35b0f901304f90eb4e8b02d
BLAKE2b-256 checksum
How to use checksums
385f13ec5ae0f66b3996ee97fe48cc00bb0d97062f1a9b28b6bc903f51501e17
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2

Release files / findpython-0.1.1-py3-none-any.whl

Download URL findpython-0.1.1-py3-none-any.whl
Size 19.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9eadc269949fcc17a1f120cde9aa9a1580c2f4d6187840475167d5db000aa2b9
BLAKE2b-256 checksum
How to use checksums
d1e35ceb525b01cd5e19ba4ac300afb8889b6c86331070bb07c49f70b92b8d25
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2

Release history Release notifications | RSS feed

0.8.0

2 release files

0.7.1

2 release files

0.7.0

2 release files

0.6.3

2 release files

0.6.2

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.5

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page