@@ -35,28 +35,6 @@ Python versions listed can be restricted by using the `--max`, `--min` and
3535` --compatible ` options to the command. These roughly translate to ` >= ` for min, ` < ` for max
3636and ` ~= ` for compatible in python version specifiers.
3737
38- If you wish to find the latest binaries available from python.org for your platform
39- (or sources on Linux) there is the additional ` online ` command with some extra flags.
40-
41- By default it will fetch the latest patches for each Python release (eg: 2.7.18 for 2.7) for
42- the hardware you're on. The filters for local versions also work.
43-
44- * ` --all-binaries ` will get you all binary releases that match the restrictions.
45- * ` --system ` and ` --machine ` allow you to specify a platform other than the one you are using
46- (the values you give should match platform.system() and platform.machine() return values).
47- * ` --prerelease ` includes prerelease versions in the search.
48-
49- Example:
50- ` python pythonfinder.pyz online --min 3.10 --system Windows --machine AMD64 `
51-
52- ```
53- | Python Version | URL |
54- | -------------- | ------------------------------------------------------------------ |
55- | 3.12.5 | https://www.python.org/ftp/python/3.12.5/python-3.12.5-amd64.exe |
56- | 3.11.9 | https://www.python.org/ftp/python/3.11.9/python-3.11.9-amd64.exe |
57- | 3.10.11 | https://www.python.org/ftp/python/3.10.11/python-3.10.11-amd64.exe |
58- ```
59-
6038## Library Usage ##
6139
6240### Local installs ###
@@ -113,33 +91,13 @@ PythonInstall(version=(3, 13, 0, 'candidate', 1), executable='~\\.pyenv\\pyenv-w
11391There is now a submodule to search for virtual environments.
11492
11593``` python
94+ import os
11695from ducktools.pythonfinder.venv import list_python_venvs
11796
118- for venv in list_python_venvs():
97+ for venv in list_python_venvs(recursive = False , search_parent_folders = True ):
11998 print (venv.executable)
12099```
121100
122- ### Python.org search ###
123-
124- Python.org searches are handled by the ` ducktools.pythonfinder.pythonorg_search ` module.
125-
126- ``` python
127- from packaging.specifiers import SpecifierSet
128- from ducktools.pythonfinder.pythonorg_search import PythonOrgSearch
129-
130- # If system and machine are not provided this uses platform.system() and platform.machine()
131- searcher = PythonOrgSearch(system = " Windows" , machine = " AMD64" )
132-
133- all_releases = searcher.releases
134- all_release_files = searcher.release_files
135- all_312_releases = searcher.matching_versions(SpecifierSet(" ~=3.12.0" ))
136- all_312_downloads = searcher.matching_versions(SpecifierSet(" ~=3.12.0" ))
137- all_312_311_win_binaries = searcher.all_matching_binaries(SpecifierSet(" >=3.11.0, <3.13" ))
138- latest_312_311_win_binaries = searcher.latest_minor_binaries(SpecifierSet(" >=3.11.0, <3.13" ))
139- latest_matching_win_binary = searcher.latest_binary_match(SpecifierSet(" >=3.10" ))
140- latest_prerelease_binary = searcher.latest_binary_match(SpecifierSet(" >=3.10" ), prereleases = True )
141- ```
142-
143101## Why? ##
144102
145103For the purposes of PEP723 script dependencies and other releated tools
@@ -153,4 +111,4 @@ satisfy such a requirement.
153111That module appears to require searching for a specific version and will find venv pythons.
154112
155113In contrast ` ducktools.pythonfinder ` simply yields python installs as they are discovered
156- and will attempt to avoid returning virtualenv python installs
114+ and will attempt to avoid returning virtualenv python installs (unless you are searching for venvs)
0 commit comments