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.3.1.tar.gz
.
File metadata
- Download URL: dep_logic-0.3.1.tar.gz
- Upload date:
- Size: 33.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.0 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7a2ae82e21084e5e851fb4c89156bd6528ce96969e127a78cd6e05e5e7f52ed2 |
|
MD5 | 0bd20566f25f6a303977d449c848b4ca |
|
BLAKE2b-256 | e3368cfbc28929c85b71e3d1c18fdc128cec484fcc6bdf4819ed1b42cebb5727 |
Provenance
File details
Details for the file dep_logic-0.3.1-py3-none-any.whl
.
File metadata
- Download URL: dep_logic-0.3.1-py3-none-any.whl
- Upload date:
- Size: 32.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.0 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 043f3a31be6d0db551568061488e7dc1797144cdef3be9ff3abc2f8a3125f87a |
|
MD5 | c5a9cbea40a59a54407b49a06259ff32 |
|
BLAKE2b-256 | 7b508e90a371ec96524f8bdc029b02ea05f32fd074353924699e50993733d28b |