skillfed

dep-logic

Python dependency specifications supporting logical operations

dep-logic v0.7.1 11.9M downloads/30d#1,352 on PyPI
Permissive license Apache-2.0 Active released

What it is and what it does

dep-logic is a lightweight utility for manipulating Python dependency specifications using logical operations. It parses PEP 440 version specifiers and PEP 508 environment markers, then lets you combine them with AND and OR operators to compute intersections, unions, and simplified constraint expressions. The library wraps PyPA's packaging module and aims to provide PEP-compliant behavior as an alternative to heavier tools like poetry-core.

You'd use this when building dependency resolvers, constraint solvers, or tools that need to reason about version ranges and platform requirements programmatically. It handles three sub-modules: specifiers for version ranges, markers for environment conditions, and tags for platform identifiers. The main limitation is partial support for `===` (arbitrary equality) specifiers.

Use it for:

  • Combine version constraints from multiple sources to compute the intersection of acceptable versions.
  • Simplify or normalize environment marker expressions for dependency resolution logic.
  • Build a dependency resolver that needs to reason about version ranges and platform requirements.
  • Parse and manipulate PEP 440 and PEP 508 syntax in a tool or library without heavy dependencies.
  • Test whether a given version or environment satisfies a set of logical constraints.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Performs logical operations (AND, OR) on PEP 440 version specifiers and PEP 508 environment markers, allowing you to combine, intersect, or union dependency constraints programmatically.

Yes. Low install friction, active maintenance, no known vulnerabilities, and permissive licensing make it a safe choice. Install it if you need to perform logical operations on version specifiers or environment markers in a dependency-aware tool or resolver; skip it if you only need to parse or validate specs without combining them.

Install

dep-logic on PyPI

pip

pip install dep-logic

uv

uv add dep-logic

poetry

poetry add dep-logic

Installing dep-logic

Before you install

Low friction: pure Python wheel with a single runtime dependency (packaging). Active maintenance with a release 4 days ago.

License in practice

Apache-2.0 permissive license allows commercial use, modification, and distribution with minimal restrictions.

Quickstart

pip install dep-logic

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

Requires Python 3.10 or later.

Verify before relying

  • Whether the `===` specifier caveat affects typical use cases or is a rare edge case.
  • Performance characteristics when combining large numbers of specifiers or markers.
  • Whether the package handles all PEP 508 marker syntax edge cases beyond the documented examples.

Package facts

License Apache-2.0 (permissive)
Python support supports the current Python release (>=3.10)
Install friction low — pure-Python wheel
Runtime dependencies 1 — packaging
Maintenance actively maintained — 4 days since the last release
First released
Downloads 11,917,040/month — #1,352 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: dep_logic-0.7.1-py3-none-any.whl

Keywords: dependency, specification, logic, packaging

Intended Audience :: DevelopersLicense :: OSI Approved :: Apache Software LicenseProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13

Tags

pep 440 version specifier logicpep 508 environment marker operationsdependency constraint combiningversion range intersectionpython dependency parsingmarker logical operationsdependency specification algebra
dependency-resolutionpep-compliance

More Build Tools packages