dep-logic
Python dependency specifications supporting logical operations
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-logicuv
uv add dep-logicpoetry
poetry add dep-logicInstalling 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
Tags
More Build Tools packages
Provides reusable utilities for Python…
permissive · top 100 on PyPI
tqdmWraps any iterable to display a real-time…
copyleft · top 100 on PyPI
pippip is the standard installer for Python…
permissive · top 100 on PyPI
hatchlingHatchling is a standards-compliant Python build…
permissive · top 100 on PyPI
grpcio-toolsGenerates Python gRPC service stubs and message…
permissive · top 1,000 on PyPI
pre-commitpre-commit is a framework for installing and…
permissive · top 1,000 on PyPI
logical-unificationLogical unification in Python with support for…
permissive · top 5,000 on PyPI
requirementslibParses, builds, and converts between Pipfile…
permissive · top 15,000 on PyPI
parverparver parses and manipulates PEP 440 version…
permissive · top 5,000 on PyPI
feufeu checks package availability, resolves…
permissive · top 5,000 on PyPI
packversProvides core utilities for Python package…
permissive · top 15,000 on PyPI
verlib2Provides standalone version comparison and…
unclear · top 15,000 on PyPI
setuptools-git-versioningAutomatically generates PEP 440-compliant…
permissive · top 5,000 on PyPI
looseversionProvides a drop-in replacement for the…
permissive · top 5,000 on PyPI
skia-pathopsPython bindings for Google Skia's Path Ops…
permissive · top 15,000 on PyPI