--- id: dep-logic version: "0.7.1" license: Apache-2.0 license_treatment: permissive maintenance: active --- # dep-logic — Python dependency specifications supporting logical operations License: permissive · Maintenance: active · Downloads: 11.9M/mo ## 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 above — 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 pip install dep-logic uv add dep-logic 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_current - Install friction: low - Maintenance: active - Downloads: 11.9M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags pep 440 version specifier logic, pep 508 environment marker operations, dependency constraint combining, version range intersection, python dependency parsing, marker logical operations, dependency specification algebra, dependency-resolution, pep-compliance [View on SkillFed](https://skillfed.io/packages/dep-logic) · [View on PyPI](https://pypi.org/project/dep-logic/)