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.0.0.tar.gz (9.0 kB view details)

Uploaded Source

Built Distribution

requirements_detector-1.0.0-py3-none-any.whl (11.9 kB view details)

Uploaded Python 3

File details

Details for the file requirements-detector-1.0.0.tar.gz.

File metadata

  • Download URL: requirements-detector-1.0.0.tar.gz
  • Upload date:
  • Size: 9.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.0 importlib-metadata/4.8.3 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.4 CPython/3.9.9

File hashes

Hashes for requirements-detector-1.0.0.tar.gz
Algorithm Hash digest
SHA256 e6038611078dceafc5ca32217537ca964279f7d5315d407d3eb99d5fdcb10892
MD5 1db3a83e80468c9242c56f5815982d2b
BLAKE2b-256 0115f46e05809dc7edb1f026e766d38a58761943d24a32a1346218ff5310335c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: requirements_detector-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 11.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.0 importlib-metadata/4.8.3 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.4 CPython/3.9.9

File hashes

Hashes for requirements_detector-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 efa8e6cf653e62c92f3edd5cb475321c243a60a5f471a014b65cf3a33dda3988
MD5 de3ed37fd42e2becb834aeaf06f37b7f
BLAKE2b-256 a3e39764db65d91da91ac2f5244770613011d386072c619ab2fa0eea27acc978

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