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.
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
Hashes for dep_logic-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | af439c2acaf7522dd321a71f30e0c4fd59b7553eb99967af07d53320902cde39 |
|
MD5 | a1ac4b25a3db8a6f24f0abecd826c079 |
|
BLAKE2b-256 | a3e8ec37271adcae1f4f98f47d02b1b34a3c83a09425d173d40cb25ea98de75f |