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

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dep_logic-0.6.0-py3-none-any.whl (35.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: dep_logic-0.6.0.tar.gz
  • Upload date:
  • Size: 36.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for dep_logic-0.6.0.tar.gz
Algorithm Hash digest
SHA256 0468874dd86caafd67f28e19257ef86c96f19b2236994f9fe9d793f9d92a6433
MD5 6f60eb494ceac2abcc797f3ee4106d40
BLAKE2b-256 fa36fda3791e19337f2cd5949cf695394f24b0ccd51c1c76e9ab7b99a355e3dc

See more details on using hashes here.

Provenance

The following attestation bundles were made for dep_logic-0.6.0.tar.gz:

Publisher: release.yml on pdm-project/dep-logic

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

  • Download URL: dep_logic-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 35.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for dep_logic-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f5aee31397cbddf9c197b88144ba51b178b4491adab4446deb0863cb58eeca04
MD5 fc6458a878cbe63301cd97b1b93f0aee
BLAKE2b-256 5addb01ce33bdb456cd281a3e252a88ef3e7ac4269e119fe0f32c3247c4d8ee2

See more details on using hashes here.

Provenance

The following attestation bundles were made for dep_logic-0.6.0-py3-none-any.whl:

Publisher: release.yml on pdm-project/dep-logic

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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