File: README.md

package info (click to toggle)
requirements-parser 0.11.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 564 kB
  • sloc: python: 360; makefile: 146
file content (81 lines) | stat: -rw-r--r-- 3,202 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# Requirements Parser

[![shield_pypi-version]][link_pypi]
[![shield_rtfd]][link_rtfd]
[![shield_gh-workflow-test]][link_gh-workflow-test]
[![shield_license]][license_file]

---

This is a small Python module for parsing [Pip](http://www.pip-installer.org/) requirement files.

The goal is to parse everything in the [Pip requirement file format](https://pip.pypa.io/en/stable/reference/pip_install/#requirements-file-format) spec.

## Installation

    pip install requirements-parser

or

    poetry add requirements-parser

## Examples

`requirements-parser` can parse a file-like object or a text string.

``` {.python}
>>> import requirements
>>> with open('requirements.txt', 'r') as fd:
...     for req in requirements.parse(fd):
...         print(req.name, req.specs)
Django [('>=', '1.11'), ('<', '1.12')]
six [('==', '1.10.0')]
```

It can handle most (if not all) of the options in requirement files that do not involve traversing the local filesystem. These include:

-   editables (`-e git+https://github.com/toastdriven/pyelasticsearch.git]{.title-ref}`)
-   version control URIs
-   egg hashes and subdirectories (`[\#egg=django-haystack&subdirectory=setup]{.title-ref}`)
-   extras ([DocParser\[PDF\]]{.title-ref})
-   URLs

## Documentation

View the documentation [here][link_rtfd].

## Python Support

We endeavour to support all functionality for all [current actively supported Python versions](https://www.python.org/downloads/).
However, some features may not be possible/present in older Python versions due to their lack of support.

## Changelog

See our [CHANGELOG][chaneglog_file].

## Contributing

Feel free to open issues, bugreports or pull requests.  
See the [CONTRIBUTING][contributing_file] file for details.

## Copyright & License

`requirements-parser` was originally written by @davidfischer and is now maintained by @madpah. See [Authors][authors_file] for full details. 

Permission to modify and redistribute is granted under the terms of the Apache 2.0 license.

See the [LICENSE][license_file] file for the full license.

[authors_file]: https://github.com/madpah/requirements-parser/blob/main/AUTHORS.md
[license_file]: https://github.com/madpah/requirements-parser/blob/main/LICENSE
[chaneglog_file]: https://github.com/madpah/requirements-parser/blob/main/CHANGELOG.md
[contributing_file]: https://github.com/madpah/requirements-parser/blob/main/CONTRIBUTING.md

[shield_gh-workflow-test]: https://img.shields.io/github/actions/workflow/status/madpah/requirements-parser/poetry.yml?branch=main&logo=GitHub&logoColor=white "build"
[shield_pypi-version]: https://img.shields.io/pypi/v/requirements-parser?logo=pypi&logoColor=white&label=PyPI "PyPI"
[shield_rtfd]: https://img.shields.io/readthedocs/requirements-parser?logo=readthedocs&logoColor=white "Read the Docs"
[shield_license]: https://img.shields.io/github/license/madpah/requirements-parser?logo=open%20source%20initiative&logoColor=white "license"

[link_gh-workflow-test]: https://github.com/madpah/requirements-parser/actions/workflows/poetry.yml?query=branch%3Amain
[link_pypi]: https://pypi.org/project/requirements-parser/
[link_rtfd]: https://requirements-parser.readthedocs.io/en/latest/