Install & Compatibility
Where this runs
tested against v0.7.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.566s · 21.3MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 1.9s · import 0.520s · 23MB
20MB installed
● package 20MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
parse
✓ from dparse2 import parse
Original dparse used 'from dparse import parse'. The module is now dparse2.
filetypes
✓ from dparse2.filetypes import RequirementsFile
✗ from dparse import filetypes
Package name changed from dparse to dparse2.
dparse2
✓ import dparse2
Top-level package is dparse2, not dparse.
Parses a requirements.txt file and prints each dependency name and version specifier.
from dparse2 import parse
from dparse2.filetypes import RequirementsFile
with open('requirements.txt') as f:
content = f.read()
parsed = parse(content, RequirementsFile)
for dep in parsed.dependencies:
print(dep.name, dep.specs)
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'dparse'
Package renamed to dparse2; old import fails.
fixRun 'pip install dparse2' and change imports to 'import dparse2'.
AttributeError: module 'dparse2' has no attribute 'parse'
Wrong import path; parse is a function, not a module attribute when using 'import dparse2'.
fixUse 'from dparse2 import parse' or 'dparse2.parse(...)'.
TypeError: parse() missing 1 required positional argument: 'file_type'
parse() requires a file type class as second argument.
fixProvide a file type, e.g., 'from dparse2.filetypes import RequirementsFile' and call 'parse(content, RequirementsFile)'.
Upgrade
Version history
0.7.0latest on PyPI · released Dec 23, 2022
Audit
Dependencies
packagingrequiredversion comparison
tomlrequiredparsing Pipfile and poetry files
pyyamlrequiredparsing conda yml files