METADATA 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. Metadata-Version: 2.1
  2. Name: findpython
  3. Version: 0.3.1
  4. Summary: A utility to find python versions on your system
  5. Author-Email: Frost Ming <mianghong@gmail.com>
  6. License: MIT
  7. Classifier: Programming Language :: Python :: 3
  8. Classifier: Programming Language :: Python :: 3.7
  9. Classifier: Programming Language :: Python :: 3.8
  10. Classifier: Programming Language :: Python :: 3.9
  11. Classifier: Programming Language :: Python :: 3.10
  12. Classifier: Programming Language :: Python :: 3.11
  13. Project-URL: Homepage, https://github.com/frostming/findpython
  14. Requires-Python: >=3.7
  15. Requires-Dist: packaging>=20
  16. Description-Content-Type: text/markdown
  17. # FindPython
  18. _A utility to find python versions on your system._
  19. [![Tests](https://github.com/frostming/findpython/actions/workflows/ci.yml/badge.svg)](https://github.com/frostming/findpython/actions/workflows/ci.yml)
  20. [![PyPI](https://img.shields.io/pypi/v/findpython?logo=python&logoColor=%23cccccc&style=flat-square)](https://pypi.org/project/findpython)
  21. [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/findpython?logo=python&logoColor=%23cccccc&style=flat-square)](https://pypi.org/project/findpython)
  22. [![pdm-managed](https://img.shields.io/badge/pdm-managed-blueviolet?style=flat-square)](https://github.com/frostming/findpython)
  23. ## Description
  24. This library is a rewrite of [pythonfinder] project by [@techalchemy][techalchemy].
  25. It simplifies the whole code structure while preserving most of the original features.
  26. [pythonfinder]: https://github.com/sarugaku/pythonfinder
  27. [techalchemy]: https://github.com/techalchemy
  28. ## Installation
  29. FindPython is installable via any kind of package manager including `pip`:
  30. ```bash
  31. pip install findpython
  32. ```
  33. <details>
  34. <summary>Expand this section to see findpython's availability in the package ecosystem</summary>
  35. <a href="https://repology.org/project/python:findpython/versions">
  36. <img src="https://repology.org/badge/vertical-allrepos/python:findpython.svg?header=python%3Afindpython" alt="Packaging status">
  37. </a>
  38. </details>
  39. ## Usage
  40. ```python
  41. >>> import findpython
  42. >>> findpython.find(3, 9) # Find by major and minor version
  43. <PythonVersion executable=PosixPath('/opt/homebrew/bin/python3.9'), version=<Version('3.9.10')>, architecture='64bit', major=3, minor=9, patch=10>
  44. >>> findpython.find("3.9") # Find by version string
  45. <PythonVersion executable=PosixPath('/opt/homebrew/bin/python3.9'), version=<Version('3.9.10')>, architecture='64bit', major=3, minor=9, patch=10>
  46. >>> findpython.find("3.9-32") # Find by version string and architecture
  47. <PythonVersion executable=WindowsPath('C:\\Python\\3.9-32\\python.exe'), version=<Version('3.9.10')>, architecture='32bit', major=3, minor=9, patch=10>
  48. >>> findpython.find(name="python3") # Find by executable name
  49. <PythonVersion executable=PosixPath('/Users/fming/Library/PythonUp/bin/python3'), version=<Version('3.10.2')>, architecture='64bit', major=3, minor=10, patch=2>
  50. >>> findpython.find("python3") # Find by executable name without keyword argument, same as above
  51. <PythonVersion executable=PosixPath('/Users/fming/Library/PythonUp/bin/python3'), version=<Version('3.10.2')>, architecture='64bit', major=3, minor=10, patch=2>
  52. >>> findpython.find_all(major=3, minor=9) # Same arguments as `find()`, but return all matches
  53. [<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>]
  54. ```
  55. ## CLI Usage
  56. In addition, FindPython provides a CLI interface to find python versions:
  57. ```
  58. usage: findpython [-h] [-V] [-a] [--resolve-symlink] [-v] [--no-same-file] [--no-same-python] [--providers PROVIDERS]
  59. [version_spec]
  60. A utility to find python versions on your system
  61. positional arguments:
  62. version_spec Python version spec or name
  63. options:
  64. -h, --help show this help message and exit
  65. -V, --version show program's version number and exit
  66. -a, --all Show all matching python versions
  67. --resolve-symlink Resolve all symlinks
  68. -v, --verbose Verbose output
  69. --no-same-file Eliminate the duplicated results with the same file contents
  70. --no-same-python Eliminate the duplicated results with the same sys.executable
  71. --providers PROVIDERS
  72. Select provider(s) to use
  73. ```
  74. ## Integration
  75. FindPython finds Python from the following places:
  76. - `PATH` environment variable
  77. - pyenv install root
  78. - asdf python install root
  79. - [rye](https://rye-up.com) toolchain install root
  80. - `/Library/Frameworks/Python.framework/Versions` (MacOS)
  81. - Windows registry (Windows only)
  82. ## License
  83. FindPython is released under MIT License.