METADATA 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. Metadata-Version: 2.1
  2. Name: requirements-detector
  3. Version: 1.2.2
  4. Summary: Python tool to find and list requirements of a Python project
  5. Home-page: https://github.com/landscapeio/requirements-detector
  6. License: MIT
  7. Keywords: python,requirements detector
  8. Author: Landscape.io
  9. Author-email: code@landscape.io
  10. Requires-Python: >=3.7,<4.0
  11. Classifier: Development Status :: 5 - Production/Stable
  12. Classifier: Environment :: Console
  13. Classifier: Intended Audience :: Developers
  14. Classifier: License :: OSI Approved :: MIT License
  15. Classifier: Operating System :: Unix
  16. Classifier: Programming Language :: Python :: 3
  17. Classifier: Programming Language :: Python :: 3.7
  18. Classifier: Programming Language :: Python :: 3.8
  19. Classifier: Programming Language :: Python :: 3.9
  20. Classifier: Programming Language :: Python :: 3.10
  21. Classifier: Programming Language :: Python :: 3.11
  22. Classifier: Programming Language :: Python :: 3.10
  23. Classifier: Programming Language :: Python :: 3.11
  24. Classifier: Programming Language :: Python :: 3.7
  25. Classifier: Programming Language :: Python :: 3.8
  26. Classifier: Programming Language :: Python :: 3.9
  27. Classifier: Topic :: Software Development :: Quality Assurance
  28. Requires-Dist: astroid (>=2.0,<3.0)
  29. Requires-Dist: packaging (>=21.3)
  30. Requires-Dist: semver (>=3.0.0,<4.0.0)
  31. Requires-Dist: toml (>=0.10.2,<0.11.0)
  32. Description-Content-Type: text/markdown
  33. # Requirements Detector
  34. ## Status
  35. [![Latest Version](https://img.shields.io/pypi/v/requirements-detector.svg?label=version&style=flat)](https://pypi.python.org/pypi/requirements-detector)
  36. [![Build Satus](https://github.com/landscapeio/requirements-detector/actions/workflows/ci.yaml/badge.svg)](https://github.com/landscapeio/requirements-detector/actions/workflows/ci.yaml)
  37. [![Health](https://landscape.io/github/landscapeio/requirements-detector/master/landscape.svg?style=flat)](https://landscape.io/github/landscapeio/requirements-detector/master)
  38. [![Coverage Status](https://img.shields.io/coveralls/landscapeio/requirements-detector.svg?style=flat)](https://coveralls.io/r/landscapeio/requirements-detector)
  39. [![Documentation](https://readthedocs.org/projects/requirements-detector/badge/?version=master)](https://readthedocs.org/projects/requirements-detector/)
  40. ## About
  41. `requirements-detector` is a simple Python tool which attempts to find and list the requirements of a Python project.
  42. When run from the root of a Python project, it will try to ascertain which libraries and the versions of those libraries that the project depends on.
  43. It uses the following methods in order, in the root of the project:
  44. 1. Parse `setup.py` (if this is successful, the remaining steps are skipped)
  45. 2. Parse `pyproject.yoml` (if a `tool.poetry.dependencies` section is found, the remaining steps are skipped)
  46. 3. Parse `requirements.txt` or `requirements.pip`
  47. 4. Parse all `*.txt` and `*.pip` files inside a folder called `requirements`
  48. 5. Parse all files in the root folder matching `*requirements*.txt` or `reqs.txt` (so for example, `pip_requirements.txt` would match, as would `requirements_common.txt`)
  49. ### Usage
  50. ```
  51. detect-requirements [path]
  52. ```
  53. If `path` is not specified, the current working directory will be used.
  54. ### Output
  55. The output will be plaintext, and match that of a [pip requirements file](http://www.pip-installer.org/en/latest/logic.html), for example:
  56. ```
  57. Django==1.5.2
  58. South>=0.8
  59. anyjson
  60. celery>=2.2,<3
  61. ```
  62. ### Usage From Python
  63. ```
  64. >>> import os
  65. >>> from requirements_detector import find_requirements
  66. >>> find_requirements(os.getcwd())
  67. [DetectedRequirement:Django==1.5.2, DetectedRequirement:South>=0.8, ...]
  68. ```
  69. If you know the relevant file or directory, you can use `from_requirements_txt`, `from_setup_py` or `from_requirements_dir` directly.
  70. ```
  71. >>> from requirements_detector import from_requirements_txt
  72. >>> from_requirements_txt("/path/to/requirements.txt")
  73. [DetectedRequirement:Django==1.5.2, DetectedRequirement:South>=0.8, ...]
  74. ```