requirements-detector


Namerequirements-detector JSON
Version 1.3.1 PyPI version JSON
download
home_pagehttps://github.com/landscapeio/requirements-detector
SummaryPython tool to find and list requirements of a Python project
upload_time2024-10-04 10:10:09
maintainerNone
docs_urlNone
authorLandscape.io
requires_python<4.0,>=3.8
licenseMIT
keywords python requirements detector
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage
            # Requirements Detector

## Status

[![Latest Version](https://img.shields.io/pypi/v/requirements-detector.svg?label=version&style=flat)](https://pypi.python.org/pypi/requirements-detector)
[![Build Satus](https://github.com/landscapeio/requirements-detector/actions/workflows/ci.yaml/badge.svg)](https://github.com/landscapeio/requirements-detector/actions/workflows/ci.yaml)
[![Health](https://landscape.io/github/landscapeio/requirements-detector/master/landscape.svg?style=flat)](https://landscape.io/github/landscapeio/requirements-detector/master)
[![Coverage Status](https://img.shields.io/coveralls/landscapeio/requirements-detector.svg?style=flat)](https://coveralls.io/r/landscapeio/requirements-detector)
[![Documentation](https://readthedocs.org/projects/requirements-detector/badge/?version=master)](https://readthedocs.org/projects/requirements-detector/)

## 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](http://www.pip-installer.org/en/latest/logic.html), 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, ...]
```


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/landscapeio/requirements-detector",
    "name": "requirements-detector",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.8",
    "maintainer_email": null,
    "keywords": "python, requirements detector",
    "author": "Landscape.io",
    "author_email": "code@landscape.io",
    "download_url": "https://files.pythonhosted.org/packages/83/d2/624d0ebcddc872cee851a5fd0db164be0367df9b52d4c7342b1c07aa0468/requirements_detector-1.3.1.tar.gz",
    "platform": null,
    "description": "# Requirements Detector\n\n## Status\n\n[![Latest Version](https://img.shields.io/pypi/v/requirements-detector.svg?label=version&style=flat)](https://pypi.python.org/pypi/requirements-detector)\n[![Build Satus](https://github.com/landscapeio/requirements-detector/actions/workflows/ci.yaml/badge.svg)](https://github.com/landscapeio/requirements-detector/actions/workflows/ci.yaml)\n[![Health](https://landscape.io/github/landscapeio/requirements-detector/master/landscape.svg?style=flat)](https://landscape.io/github/landscapeio/requirements-detector/master)\n[![Coverage Status](https://img.shields.io/coveralls/landscapeio/requirements-detector.svg?style=flat)](https://coveralls.io/r/landscapeio/requirements-detector)\n[![Documentation](https://readthedocs.org/projects/requirements-detector/badge/?version=master)](https://readthedocs.org/projects/requirements-detector/)\n\n## About\n\n`requirements-detector` is a simple Python tool which attempts to find and list the requirements of a Python project.\n\nWhen 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.\n\nIt uses the following methods in order, in the root of the project:\n\n1. Parse `setup.py` (if this is successful, the remaining steps are skipped)\n2. Parse `pyproject.yoml` (if a `tool.poetry.dependencies` section is found, the remaining steps are skipped)\n3. Parse `requirements.txt` or `requirements.pip`\n4. Parse all `*.txt` and `*.pip` files inside a folder called `requirements`\n5. 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`)\n\n### Usage\n\n```\ndetect-requirements [path]\n```\nIf `path` is not specified, the current working directory will be used.\n\n### Output\n\nThe output will be plaintext, and match that of a [pip requirements file](http://www.pip-installer.org/en/latest/logic.html), for example:\n\n```\nDjango==1.5.2\nSouth>=0.8\nanyjson\ncelery>=2.2,<3\n```\n\n### Usage From Python\n\n```\n>>> import os\n>>> from requirements_detector import find_requirements\n>>> find_requirements(os.getcwd())\n[DetectedRequirement:Django==1.5.2, DetectedRequirement:South>=0.8, ...]\n```\n\n\nIf you know the relevant file or directory,  you can use `from_requirements_txt`, `from_setup_py` or `from_requirements_dir` directly.\n\n```\n>>> from requirements_detector import from_requirements_txt\n>>> from_requirements_txt(\"/path/to/requirements.txt\")\n[DetectedRequirement:Django==1.5.2, DetectedRequirement:South>=0.8, ...]\n```\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Python tool to find and list requirements of a Python project",
    "version": "1.3.1",
    "project_urls": {
        "Homepage": "https://github.com/landscapeio/requirements-detector"
    },
    "split_keywords": [
        "python",
        " requirements detector"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f45273f2ce20ea50400acd625f73432db7ef39334ae37ebf5c4f6a07b2ba18e0",
                "md5": "cdfdc3f76e155d66a2f0df9e03a6658f",
                "sha256": "3ef72e1c5c3ad11100058e8f074a5762a4902985e698099d2e7f1283758d4045"
            },
            "downloads": -1,
            "filename": "requirements_detector-1.3.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "cdfdc3f76e155d66a2f0df9e03a6658f",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.8",
            "size": 20536,
            "upload_time": "2024-10-04T10:10:08",
            "upload_time_iso_8601": "2024-10-04T10:10:08.611940Z",
            "url": "https://files.pythonhosted.org/packages/f4/52/73f2ce20ea50400acd625f73432db7ef39334ae37ebf5c4f6a07b2ba18e0/requirements_detector-1.3.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "83d2624d0ebcddc872cee851a5fd0db164be0367df9b52d4c7342b1c07aa0468",
                "md5": "a4dfc54eef0b2eb6225e90dff87a32db",
                "sha256": "b89e34faf0e4d17f5736923918bd5401949cbe723294ccfefd698b3cda28e676"
            },
            "downloads": -1,
            "filename": "requirements_detector-1.3.1.tar.gz",
            "has_sig": false,
            "md5_digest": "a4dfc54eef0b2eb6225e90dff87a32db",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.8",
            "size": 15908,
            "upload_time": "2024-10-04T10:10:09",
            "upload_time_iso_8601": "2024-10-04T10:10:09.790338Z",
            "url": "https://files.pythonhosted.org/packages/83/d2/624d0ebcddc872cee851a5fd0db164be0367df9b52d4c7342b1c07aa0468/requirements_detector-1.3.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-04 10:10:09",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "landscapeio",
    "github_project": "requirements-detector",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "tox": true,
    "lcname": "requirements-detector"
}
        
Elapsed time: 0.38368s