compreq
A library for dynamically computing Python requirements, to keep them up-to-date.
Concepts
This library relies heavily on packaging, and you should understand that first.
The base types are the Version, Specifier, SpecifierSet and Requirement in packaging and
Release and ReleaseSet added by this library.
For all of the base types this library adds lazy versions - which both allows reuse, but also allows some values to be fetched from the context, instead of specified explicitly.
To resolve a lazy object into a concrete value use a CompReq.resolve_... method.
Finally this library adds wrappers around pyproject.toml and requirements.txt files, for getting
and setting the requirments in them.
Example:
import compreq as cr
with cr.PyprojectFile.open() as pyproject:
prev_python_specifier = cr.get_bounds(
pyproject.get_requirements()["python"].specifier
).lower_specifier_set()
comp_req = cr.CompReq(python_specifier=prev_python_specifier)
default_range = cr.version(
">=",
cr.floor_ver(
cr.REL_MINOR,
cr.minimum_ver(
cr.max_ver(cr.min_age(years=1)),
cr.min_ver(cr.count(cr.MINOR, 3)),
),
),
) & cr.version("<", cr.ceil_ver(cr.REL_MAJOR, cr.max_ver()))
dev_range = cr.version(">=", cr.floor_ver(cr.REL_MINOR, cr.max_ver())) & cr.version(
"<", cr.ceil_ver(cr.REL_MINOR, cr.max_ver())
)
pyproject.set_requirements(
comp_req,
[
cr.pkg("beautifulsoup4") & default_range,
cr.pkg("packaging") & default_range,
cr.pkg("pip") & default_range,
cr.pkg("python") & default_range,
cr.pkg("python-dateutil") & default_range,
cr.pkg("requests") & default_range,
cr.pkg("tomlkit") & default_range,
cr.pkg("typing-extensions") & default_range,
],
)
pyproject.set_requirements(
comp_req,
[
cr.pkg("black") & dev_range,
cr.pkg("isort") & dev_range,
cr.pkg("mypy") & dev_range,
cr.pkg("pylint") & dev_range,
cr.pkg("pytest") & dev_range,
cr.pkg("taskipy") & dev_range,
cr.pkg("types-beautifulsoup4") & default_range,
cr.pkg("types-python-dateutil") & default_range,
cr.pkg("types-requests") & default_range,
],
"dev",
)
Or see requirements.py.
References:
https://peps.python.org/pep-0440/ https://packaging.pypa.io/en/stable
Metadata
Release files for compreq 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| compreq-0.4.0.tar.gz | 69.5 kB | With provenance | Details for compreq-0.4.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| compreq-0.4.0-py3-none-any.whl | Python 3 | none | any | Details for compreq-0.4.0-py3-none-any.whl |
Total release size: 102.9 kB
Release files / compreq-0.4.0.tar.gz
| Download URL | compreq-0.4.0.tar.gz |
|---|---|
| Size | 69.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
be3f12f3719e4c001724df8492790614ef84f86b5e3b8f5991a2ec8965d5f3f6
|
|
BLAKE2b-256 checksum How to use checksums |
a7b2892047dd37caa81137f240ec07d340190eb0072a47f1339cf191dc18055b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 25, 2025.
Transparency logRelease files / compreq-0.4.0-py3-none-any.whl
| Download URL | compreq-0.4.0-py3-none-any.whl |
|---|---|
| Size | 33.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
64940840bebc20ff770177874b3adec1bdd28585e6f26b9b4194c9f292f3b604
|
|
BLAKE2b-256 checksum How to use checksums |
12edf6d7871ca1ec16948c8acad5f33df0a2c59dd43df10f69a506590ae2d501
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 25, 2025.
Transparency logSecurity for compreq 0.4.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for compreq-0.4.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 25, 2025.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.