Skip to main content

Python dependency specifications supporting logical operations

Project description

Dep-Logic

PyPI - Version Python Version from PEP 621 TOML GitHub License

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 specifiers
  • dep_logic.markers - PEP 508 environment markers
  • dep_logic.tags - PEP 425 platform tags

Caveats

Logic operations with ===<string> specifiers is partially supported.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dep_logic-0.4.3.tar.gz (34.8 kB view details)

Uploaded Source

Built Distribution

dep_logic-0.4.3-py3-none-any.whl (33.6 kB view details)

Uploaded Python 3

File details

Details for the file dep_logic-0.4.3.tar.gz.

File metadata

  • Download URL: dep_logic-0.4.3.tar.gz
  • Upload date:
  • Size: 34.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.0 CPython/3.12.4

File hashes

Hashes for dep_logic-0.4.3.tar.gz
Algorithm Hash digest
SHA256 e4768f0a26c8c1c0e39fd520f3e0bd099ca528ec6a8f20359fbc89ffcdf8da45
MD5 7b79b87c681de35029f5eb2a84dcc4d7
BLAKE2b-256 faf3111eff9a04e309d2cea122d083b3646229f8c5231a3a11a3155a304b1909

See more details on using hashes here.

Provenance

File details

Details for the file dep_logic-0.4.3-py3-none-any.whl.

File metadata

  • Download URL: dep_logic-0.4.3-py3-none-any.whl
  • Upload date:
  • Size: 33.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.0 CPython/3.12.4

File hashes

Hashes for dep_logic-0.4.3-py3-none-any.whl
Algorithm Hash digest
SHA256 03f2740fc40e2848f2a4c77baddcc8f5e3773c304da947815306d1e616f3942c
MD5 f8f64bf2edb5a5251e10643a9d7c661d
BLAKE2b-256 ea4497b7196b39bbf8e901587ebef2fe6cb032c18d194d96afa505a12ad95237

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page