Python tool to find and list requirements of a Python project
Project description
Requirements Detector
Status
About
requirements-detector is a simple Python tool which attempts to find and list the requirements of a Python project.
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.
It uses the following methods in order, in the root of the project:
- Parse
setup.py(if this is successful, the remaining steps are skipped) - Parse
pyproject.toml(if atool.poetry.dependenciessection is found, the remaining steps are skipped) - Parse
requirements.txtorrequirements.pip - Parse all
*.txtand*.pipfiles inside a folder calledrequirements - Parse all files in the root folder matching
*requirements*.txtorreqs.txt(so for example,pip_requirements.txtwould match, as wouldrequirements_common.txt)
Usage
detect-requirements [path]
If path is not specified, the current working directory will be used.
Output
The output will be plaintext, and match that of a pip requirements file, for example:
Django==1.5.2
South>=0.8
anyjson
celery>=2.2,<3
Usage From Python
>>> import os
>>> from requirements_detector import find_requirements
>>> find_requirements(os.getcwd())
[DetectedRequirement:Django==1.5.2, DetectedRequirement:South>=0.8, ...]
If you know the relevant file or directory, you can use from_requirements_txt, from_setup_py or from_requirements_dir directly.
>>> from requirements_detector import from_requirements_txt
>>> from_requirements_txt("/path/to/requirements.txt")
[DetectedRequirement:Django==1.5.2, DetectedRequirement:South>=0.8, ...]
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file requirements_detector-1.5.0.tar.gz.
File metadata
- Download URL: requirements_detector-1.5.0.tar.gz
- Upload date:
- Size: 16.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
49ae15a73c1ab4e33c81e02166248d61323d331999c798b226bc21a09846dbbe
|
|
| MD5 |
1a452c5a94f9d2a586d376353fe256f0
|
|
| BLAKE2b-256 |
2f0626ff42b5ab0ec87f5290e19719bf7f0ce36bc0ad1e26d5e31d03e69a9132
|
File details
Details for the file requirements_detector-1.5.0-py3-none-any.whl.
File metadata
- Download URL: requirements_detector-1.5.0-py3-none-any.whl
- Upload date:
- Size: 21.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
729c93034caccd3f8c2f9152536afb0fac19d283b7e52ada32f269d3b5f9c285
|
|
| MD5 |
df32423eef69de1916df4ffbe4f5bf80
|
|
| BLAKE2b-256 |
2e73dba124df535e6f6224c136b2d86de622ab3d573c347d391b071c59e19a8a
|