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.9.tar.gz (35.5 kB view details)

Uploaded Source

Built Distribution

dep_logic-0.4.9-py3-none-any.whl (34.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: dep_logic-0.4.9.tar.gz
  • Upload date:
  • Size: 35.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.6

File hashes

Hashes for dep_logic-0.4.9.tar.gz
Algorithm Hash digest
SHA256 5d455ea2a3da4fea2be6186d886905c57eeeebe3ea7fa967f599cb8e0f01d5c9
MD5 05560f14c6f7dceca64bbb5a460215f7
BLAKE2b-256 46c6810b34258a5f4be719a74f011e4b6a3bf4fd1fe38a400fe2682f3d87576f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: dep_logic-0.4.9-py3-none-any.whl
  • Upload date:
  • Size: 34.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.6

File hashes

Hashes for dep_logic-0.4.9-py3-none-any.whl
Algorithm Hash digest
SHA256 06faa33814e5ff881922f644284a608d7da7946462760f710217d829ae864a0e
MD5 d9e10e0eaa9acf2b0c29156fc3a287a2
BLAKE2b-256 83cc1e7319e8e36de89a5d74c402197389f0596041ebcff8032f3f48d1064fdb

See more details on using hashes here.

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