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-detectorVerified import paths — ran on the pinned version, not inferred.
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.
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.
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.
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.
pip install requirements-detector
requirements-detector . (to analyze the current directory) or requirements-detector /path/to/your/project
pip install requirements-detector