Python dependency specifications supporting logical operations
Project Links
Meta
Author: Frost Ming
Requires Python: >=3.8
Classifiers
Intended Audience
- Developers
Programming Language
- Python :: 3
- Python :: 3.8
- Python :: 3.9
- Python :: 3.10
- Python :: 3.11
- Python :: 3.12
- Python :: 3.13
License
- OSI Approved :: Apache Software License
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.
Aug 02, 2025
0.5.2
May 19, 2025
0.5.1
Apr 15, 2025
0.5.0
Feb 25, 2025
0.4.11
Dec 13, 2024
0.4.10
Sep 23, 2024
0.4.9
Sep 23, 2024
0.4.8
Sep 23, 2024
0.4.7
Sep 11, 2024
0.4.6
Sep 04, 2024
0.4.5
Jul 22, 2024
0.4.4
Jul 19, 2024
0.4.3
Jul 15, 2024
0.4.2
Jul 05, 2024
0.4.1
Jul 05, 2024
0.4.0
Jul 04, 2024
0.3.5
Jul 03, 2024
0.3.4
Jul 02, 2024
0.3.3
Jul 02, 2024
0.3.2
Jul 01, 2024
0.3.1
Jun 28, 2024
0.3.0
Feb 23, 2024
0.2.0
Feb 22, 2024
0.1.0
Dec 15, 2023
0.0.4
Nov 22, 2023
0.0.3
Nov 21, 2023
0.0.2
Nov 21, 2023
0.0.1
Wheel compatibility matrix
Files in release
Extras:
None
Dependencies:
(>=22)
packaging