Registry / devops / requirements-detector

requirements-detector

JSON →
library1.6.0pypypi✓ verified 24d ago

requirements-detector is a simple Python tool designed to find and list the dependencies of a Python project. It analyzes various common project files to ascertain required libraries and their versions. The current version is 1.5.0, and it appears to be under active development with periodic updates.

pip install requirements-detector
INSTALL
IMPORT
SIG · REQUIREMENTS-DETEC
R
requirements-detector
devopspythonv1.6.0
Install
2.0s avg
Import
317ms
Disk
20MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v1.6.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.326s · 21.9MB
glibc
py 3.10–3.95 runs
installs and imports cleanly · install 2.0s · import 0.308s · 22MB
20MB installed
● package 20MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

find_requirements
✓ from requirements_detector import find_requirements
from_requirements_txt
✓ from requirements_detector import from_requirements_txt
from_setup_py
✓ from requirements_detector import from_setup_py
from_pyproject_toml
✓ from requirements_detector import from_pyproject_toml

This quickstart demonstrates how to use `find_requirements` to automatically detect dependencies in a given directory, typically the root of a Python project. It identifies requirements by inspecting common files like `setup.py`, `pyproject.toml`, and various `requirements.txt` patterns. Alternatively, specific parsing functions like `from_requirements_txt` can be used for explicit file paths.

import os from requirements_detector import find_requirements # Detect requirements in the current working directory detected_reqs = find_requirements(os.getcwd()) for req in detected_reqs: print(f"Detected: {req.name} {req.specifier}") # Example for a specific requirements.txt file # from requirements_detector import from_requirements_txt # reqs_from_file = from_requirements_txt("/path/to/your/project/requirements.txt") # for req in reqs_from_file: # print(f"From file: {req.name} {req.specifier}")
requirements-detector --version
Debug
Known issues
gotchaThe detector prioritizes parsing order: `setup.py` first, then `pyproject.toml` (specifically `tool.poetry.dependencies`), followed by `requirements.txt`, `requirements.pip`, and other `*.txt`/`*.pip` files in a 'requirements' folder or the root. Users should be aware of this order, as requirements found earlier will prevent later files from being parsed.
fix
Ensure your primary dependency declaration method (e.g., `setup.py` or `pyproject.toml`) is correctly configured, or if relying on `requirements.txt`, understand its position in the parsing hierarchy. Use the API functions like `from_requirements_txt` for explicit file parsing if the auto-detection order is not desired.
affects: All versions
gotchaThe tool is described as 'simple' and primarily focuses on finding and listing requirements. It might not robustly handle highly complex, unconventional project structures, or advanced dependency resolution scenarios beyond its defined parsing mechanisms. It does not perform full dependency resolution or conflict detection.
fix
For complex dependency graphs, consider complementing `requirements-detector` with dedicated dependency resolution tools like `pip-tools` or `Poetry`. Always manually verify the detected requirements against your project's actual runtime needs.
affects: All versions
gotchaWhen used via the command-line interface (`detect-requirements`), the output is plaintext, formatted to resemble a standard `pip requirements` file. If you need structured data (e.g., for further programmatic processing), you must use the Python API, specifically the `find_requirements` function or other `from_*` functions, which return `DetectedRequirement` objects.
fix
For programmatic access to detected requirements, import and use the Python functions directly (e.g., `from requirements_detector import find_requirements`). Avoid parsing the CLI output if structured data is critical.
affects: All versions
Errors
Common errors & fixes
requirements-detector: command not found
The `requirements-detector` package is either not installed in your Python environment or its executable script is not located within your system's PATH.
fix
pip install requirements-detector
requirements-detector: error: the following arguments are required: path
The `requirements-detector` command was executed without specifying the required `path` argument, which indicates the project directory to be analyzed.
fix
requirements-detector .  (to analyze the current directory) or requirements-detector /path/to/your/project
ModuleNotFoundError: No module named 'requirements_detector'
While primarily a command-line tool, this error occurs if you attempt to import `requirements_detector` as a Python module in a script and the package is not installed in the current Python environment.
fix
pip install requirements-detector
Upgrade
Version history
1.6.0latest on PyPI · released Aug 11, 2026
Audit
Dependencies
astroidrequiredRuntime dependency for parsing Python code to detect imports.
packagingrequiredUsed for parsing and working with version specifiers.
semverrequiredUsed for semantic versioning comparisons.
Agent activity
16 hits · last 30 days
node
10
OpenAI (training)
1
Resources
requirements-detector — pip install requirements-detector · libregistry