Registry / data / requirementslib

requirementslib

JSON →
library3.0.0pypypiunverified

A Python library for converting between pip-style requirements and Pipfile/Pipfile.lock formats. Version 3.0.0 is a major overhaul that replaced attrs with pydantic for validation. Maintained irregularly.

pip install requirementslib
INSTALL
IMPORT
SIG · REQUIREMENTSLIB
R
requirementslib
datapythonv3.0.0
Install
5.1s avg
Import
Disk
36MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v3.0.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
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 33.3MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 5.1s · import 0.000s · 33MB
36MB installed
● package 36MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Requirement
from requirementslib import Requirement
from requirementslib import Requirement

Basic usage: creating a Requirement from a pip line and loading a Pipfile.

from requirementslib import Requirement, Pipfile # Parse a single requirement req = Requirement.from_line('requests==2.31.0') print(req.as_line()) # Load a Pipfile pf = Pipfile.load('Pipfile') print(pf.sections)
Debug
Known issues
breakingIn v3.0.0, the internal validation changed from attrs to pydantic. Custom Requirement subclasses or direct attribute manipulation may break. The public API (from_line, as_line, etc.) remains the same.
fix
Ensure code does not rely on attrs internals. Use public methods for serialization/deserialization.
affects: >=3.0.0
deprecatedThe 'requirementslib.models' submodule is removed in v3. Import directly from requirementslib instead.
fix
Replace 'from requirementslib.models import ...' with 'from requirementslib import ...'.
affects: >=3.0.0
gotchaPackage name handling: Requirement.from_line('MyPackage') will lowercase the name. Use the 'name' property to get the canonical normalized name.
fix
Access req.name for normalized form; use req.as_line() to preserve original casing in output if needed.
affects: all
Upgrade
Version history
3.0.0latest on PyPI · released Jun 18, 2023
Audit
Dependencies

No dependency data recorded yet.

Agent activity
12 hits · last 30 days
node
9
OpenAI (training)
1
Resources
requirementslib — pip install requirementslib · libregistry