45 releases
Uses new Rust 2024
| new 0.0.48 | May 18, 2026 |
|---|---|
| 0.0.47 | May 12, 2026 |
| 0.0.41 | Apr 27, 2026 |
| 0.0.35 | Mar 26, 2026 |
| 0.0.3 | Nov 26, 2025 |
#1379 in Text processing
4,189 downloads per month
Used in 9 crates
(3 directly)
2MB
41K
SLoC
Parses a subset of requirement.txt syntax
https://pip.pypa.io/en/stable/reference/requirements-file-format/
Supported:
- PEP 508 requirements
-r-c--hash(postfix)-e
Unsupported:
<path>. TBD<archive_url>. TBD- Options without a requirement, such as
--find-linksor--index-url
Grammar as implemented:
file = (statement | empty ('#' any*)? '\n')*
empty = whitespace*
statement = constraint_include | requirements_include | editable_requirement | requirement
constraint_include = '-c' ('=' | wrappable_whitespaces) filepath
requirements_include = '-r' ('=' | wrappable_whitespaces) filepath
editable_requirement = '-e' ('=' | wrappable_whitespaces) requirement
# We check whether the line starts with a letter or a number, in that case we assume it's a
# PEP 508 requirement
# https://packaging.python.org/en/latest/specifications/name-normalization/#valid-non-normalized-names
# This does not (yet?) support plain files or urls, we use a letter or a number as first
# character to assume a PEP 508 requirement
requirement = [a-zA-Z0-9] pep508_grammar_tail wrappable_whitespaces hashes
hashes = ('--hash' ('=' | wrappable_whitespaces) [a-zA-Z0-9-_]+ ':' [a-zA-Z0-9-_] wrappable_whitespaces+)*
# This should indicate a single backslash before a newline
wrappable_whitespaces = whitespace ('\\\n' | whitespace)*
uv-requirements-txt
This crate is an internal component of uv. The Rust API exposed here is unstable and will have frequent breaking changes.
This version (0.0.48) is a component of uv 0.11.15. The source can be found here.
See uv's crate versioning policy for details on versioning.
Dependencies
~125–170MB
~3.5M SLoC