33Find local python installs on Windows/Linux/MacOS and find the latest installers from python.org
44for Windows and MacOS or sources for Linux (as python.org does not provide linux installers).
55
6- Requires Python >= 3.8 (but will discover older Python installs)
6+ Requires Python >= 3.10 (but will discover older Python installs)
77
88[ Download the zipapp here] ( https://github.com/DavidCEllis/ducktools-pythonfinder/releases/latest/download/pythonfinder.pyz )
99
10- It is also available as a library on PyPI that can be installed with pip:
11- ` python -m pip install ducktools-pythonfinder `
10+ It is also available as an application and library on PyPI. The simplest way to install this
11+ is with [ uv] ( https://docs.astral.sh/uv/ ) .
12+
13+ With uv:
14+ * Install it as an application with ` uv tool install ducktools-pythonfinder `
15+ * Run once with ` uvx ducktools-pythonfinder `
16+ * Add it as a library to a project with ` uv add ducktools-pythonfinder `
17+ * Add it as a library for a script with ` uv add --script scriptname.py ducktools-pythonfinder `
18+ * test it in a repl with ` uv run --isolated --with ducktools-pythonfinder python `
19+
20+ If you do not wish to use ` uv ` , you can also install as an application with
21+ [ pipx] ( https://pipx.pypa.io/latest/ ) , or manually manage dependencies in ` pyproject.toml ` ,
22+ [ inline script metadata] ( https://packaging.python.org/en/latest/specifications/inline-script-metadata/#inline-script-metadata )
23+ or in virtual environments using ` pip ` .
1224
1325## Command Line Usage ##
1426
1527` ducktools-pythonfinder ` can be used as a module or as a bundled zipapp (as ` pythonfinder.pyz ` ).
1628
17- ` python pythonfinder.pyz ` or ` python -m ducktools.pythonfinder `
29+ ` python pythonfinder.pyz ` or ` python -m ducktools.pythonfinder `
1830will provide a table of installed python versions
1931and their respective folders. It will also indicate the python running the
2032command if it is found, or the python that is the base for the venv running the command.
@@ -23,18 +35,18 @@ Python versions listed can be restricted by using the `--max`, `--min` and
2335` --compatible ` options to the command. These roughly translate to ` >= ` for min, ` < ` for max
2436and ` ~= ` for compatible in python version specifiers.
2537
26- If you wish to find the latest binaries available from python.org for your platform
38+ If you wish to find the latest binaries available from python.org for your platform
2739(or sources on Linux) there is the additional ` online ` command with some extra flags.
2840
29- By default it will fetch the latest patches for each Python release (eg: 2.7.18 for 2.7) for
41+ By default it will fetch the latest patches for each Python release (eg: 2.7.18 for 2.7) for
3042the hardware you're on. The filters for local versions also work.
3143
3244* ` --all-binaries ` will get you all binary releases that match the restrictions.
3345* ` --system ` and ` --machine ` allow you to specify a platform other than the one you are using
3446 (the values you give should match platform.system() and platform.machine() return values).
3547* ` --prerelease ` includes prerelease versions in the search.
3648
37- Example:
49+ Example:
3850` python pythonfinder.pyz online --min 3.10 --system Windows --machine AMD64 `
3951
4052```
@@ -61,8 +73,8 @@ On Windows these methods will search the registry for PEP514 recorded python ins
6173before checking for any ` pyenv-win ` installs that have not been registered. Finally, if
6274` uv ` is available it will try to find Python installs managed by ` uv ` .
6375
64- On Linux and MacOS this will search for ` pyenv ` installs first,
65- if ` uv ` is available it will then try to find ` uv ` managed python installs.
76+ On Linux and MacOS this will search for ` pyenv ` installs first,
77+ if ` uv ` is available it will then try to find ` uv ` managed python installs.
6678Finally it will search ` PATH ` for any other ` python* ` binaries that might be available.
6779
6880If a python install is found twice (for instance a pyenv install in the windows registry)
@@ -131,8 +143,8 @@ latest_prerelease_binary = searcher.latest_binary_match(SpecifierSet(">=3.10"),
131143## Why? ##
132144
133145For the purposes of PEP723 script dependencies and other releated tools
134- it may be useful to find another version of python other than the one currently running
135- in order to satisfy the ` requires-python ` field.
146+ it may be useful to find another version of python other than the one currently running
147+ in order to satisfy the ` requires-python ` field.
136148This tool is intended to search for potential python installs to attempt to
137149satisfy such a requirement.
138150
0 commit comments