A utility to find python versions on your system
Project description
FindPython
A utility to find python versions on your system.
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.
Project details
Release history Release notifications | RSS feed
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.2.5.tar.gz
(16.1 kB
view details)
Built Distribution
File details
Details for the file findpython-0.2.5.tar.gz
.
File metadata
- Download URL: findpython-0.2.5.tar.gz
- Upload date:
- Size: 16.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.11
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e0fd473b4265e7e0e7843ec76feac8c0c441b869571f465befe9e695949069fe |
|
MD5 | ad94dd84bee2a71a1970e2a068fe6848 |
|
BLAKE2b-256 | 808993e51011f6279c82ec1386bab15c675f1a82ebf04de0c8193313fcd1895b |
Provenance
File details
Details for the file findpython-0.2.5-py3-none-any.whl
.
File metadata
- Download URL: findpython-0.2.5-py3-none-any.whl
- Upload date:
- Size: 18.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.11
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d09cdddad3acfa94482f0be7d353fcf13508007657f89a492fdf0b925a23c418 |
|
MD5 | 23a63b9b59908d8a30b0714bda3ecbcf |
|
BLAKE2b-256 | 94ff04767fc036a66c38685a03d2849986b0104a071e4e0f4bb09892cc8b9c6c |