Python dependency specifications supporting logical operations
Project description
Dep-Logic
Python dependency specifications supporting logical operations
Installation
pip install dep-logic
This library requires Python 3.8 or later.
Currently, it contains two sub-modules:
dep_logic.specifier
- a module for parsing and calculating PEP 440 version specifiers.dep_logic.markers
- a module for parsing and calculating PEP 508 environment markers.
What does it do?
This library allows logic operations on version specifiers and environment markers.
For example:
>>> from dep_logic.specifiers import parse_version_specifier
>>>
>>> a = parse_version_specifier(">=1.0.0")
>>> b = parse_version_specifier("<2.0.0")
>>> print(a & b)
>=1.0.0,<2.0.0
>>> a = parse_version_specifier(">=1.0.0,<2.0.0")
>>> b = parse_version_specifier(">1.5")
>>> print(a | b)
>=1.0.0
For markers:
>>> from dep_logic.markers import parse_marker
>>> m1 = parse_marker("python_version < '3.8'")
>>> m2 = parse_marker("python_version >= '3.6'")
>>> print(m1 & m2)
python_version < "3.8" and python_version >= "3.6"
About the project
This project is based on @sdispater's poetry-core code, but it includes additional packages and a lark parser, which increases the package size and makes it less reusable.
Furthermore, poetry-core
does not always comply with PEP-508. As a result, this project aims to offer a lightweight utility for dependency specification logic using PyPA's packaging.
Submodules:
dep_logic.specifiers
- PEP 440 version specifiersdep_logic.markers
- PEP 508 environment markersdep_logic.tags
- PEP 425 platform tags
Caveats
Logic operations with ===<string>
specifiers is partially supported.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file dep_logic-0.4.6.tar.gz
.
File metadata
- Download URL: dep_logic-0.4.6.tar.gz
- Upload date:
- Size: 35.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 673d45402e9f11c4e501b08ebaea1efaa5e9bc6f69410684a9e448f8f5b26d6a |
|
MD5 | bcd0468fce81ff2f86b541720a4819ca |
|
BLAKE2b-256 | 510935566c841705e68699ef64784967211d1b3a68a9d13fb8860ce8bbd4afbd |
Provenance
File details
Details for the file dep_logic-0.4.6-py3-none-any.whl
.
File metadata
- Download URL: dep_logic-0.4.6-py3-none-any.whl
- Upload date:
- Size: 33.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 837a890bff8c8eeef0aa54ece388d423a83f48e8697f25b74549d90f65f7da72 |
|
MD5 | 1b064ce9b13dc62e54f841205ba6efd4 |
|
BLAKE2b-256 | ce6fb1d38da8b5d176726073b89c6905d59a8c26a40dab01a49981eb6de6e274 |