Skip to main content

Python tool to find and list requirements of a Python project

Project description

Requirements Detector

Status

Latest Version Build Satus Health Coverage Status Documentation

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:

  1. Parse setup.py (if this is successful, the remaining steps are skipped)
  2. Parse pyproject.yoml (if a tool.poetry.dependencies section is found, the remaining steps are skipped)
  3. Parse requirements.txt or requirements.pip
  4. Parse all *.txt and *.pip files inside a folder called requirements
  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)

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

requirements_detector-1.3.1.tar.gz (15.9 kB view details)

Uploaded Source

Built Distribution

requirements_detector-1.3.1-py3-none-any.whl (20.5 kB view details)

Uploaded Python 3

File details

Details for the file requirements_detector-1.3.1.tar.gz.

File metadata

  • Download URL: requirements_detector-1.3.1.tar.gz
  • Upload date:
  • Size: 15.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.11.1 readme-renderer/43.0 requests/2.32.3 requests-toolbelt/1.0.0 urllib3/2.2.3 tqdm/4.66.5 importlib-metadata/8.5.0 keyring/25.4.1 rfc3986/2.0.0 colorama/0.4.6 CPython/3.11.10

File hashes

Hashes for requirements_detector-1.3.1.tar.gz
Algorithm Hash digest
SHA256 b89e34faf0e4d17f5736923918bd5401949cbe723294ccfefd698b3cda28e676
MD5 a4dfc54eef0b2eb6225e90dff87a32db
BLAKE2b-256 83d2624d0ebcddc872cee851a5fd0db164be0367df9b52d4c7342b1c07aa0468

See more details on using hashes here.

File details

Details for the file requirements_detector-1.3.1-py3-none-any.whl.

File metadata

  • Download URL: requirements_detector-1.3.1-py3-none-any.whl
  • Upload date:
  • Size: 20.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.11.1 readme-renderer/43.0 requests/2.32.3 requests-toolbelt/1.0.0 urllib3/2.2.3 tqdm/4.66.5 importlib-metadata/8.5.0 keyring/25.4.1 rfc3986/2.0.0 colorama/0.4.6 CPython/3.11.10

File hashes

Hashes for requirements_detector-1.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3ef72e1c5c3ad11100058e8f074a5762a4902985e698099d2e7f1283758d4045
MD5 cdfdc3f76e155d66a2f0df9e03a6658f
BLAKE2b-256 f45273f2ce20ea50400acd625f73432db7ef39334ae37ebf5c4f6a07b2ba18e0

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page