Registry / serialization / dep-logic

dep-logic

JSON →
library0.7.1pypypi✓ verified 31d ago

Dep-Logic is a Python library that provides a robust API for working with package version specifiers and dependencies, supporting logical operations (AND, OR) on them. It is currently at version 0.5.2 and sees active development with several releases per year.

pip install dep-logic
INSTALL
IMPORT
SIG · DEP-LOGIC
D
dep-logic
serializationpythonv0.7.1
Install
1.7s avg
Import
—
Disk
17MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v0.7.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 19MB
glibc
py 3.10–3.95 runs
installs and imports cleanly · install 1.7s · import 0.000s · 20MB
17MB installed
● package 17MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Specifier
✓ from dep_logic import Specifier
✗ from dep_logic import Specifier

This quickstart demonstrates how to create `Specifier` and `SpecifierSet` objects, perform logical AND/OR operations on them, check version containment, and define a `Dependency` object.

from dep_logic import Specifier, SpecifierSet, Dependency # Define specifiers spec1 = Specifier(">=1.0.0,<2.0.0") spec2 = Specifier("~=1.5.0") # equivalent to >=1.5.0,==1.*,==1.5.*, <1.6.0 for a minor release # Perform logical operations combined_spec_and = spec1 & spec2 # Intersection combined_spec_or = spec1 | spec2 # Union print(f"Specifier 1: {spec1}") print(f"Specifier 2: {spec2}") print(f"Intersection (AND): {combined_spec_and}") print(f"Union (OR): {combined_spec_or}") # Check if a version satisfies a specifier assert combined_spec_and.contains("1.5.2") assert not combined_spec_and.contains("1.0.0") # Define a dependency my_dependency = Dependency("my_package", Specifier(">=1.0.0,<2.0.0")) print(f"Dependency: {my_dependency}")
Debug
Known issues
breakingThe `Specifier` and `SpecifierSet` classes are no longer directly importable from the top-level `dep_logic` package. The previously suggested import path `from dep_logic import Specifier` (intended for versions >=0.3.0) is no longer valid, indicating a further change or reversion.
fix
Consult the library's documentation or source code to find the current import path for `Specifier` and `SpecifierSet`, as they are not available directly under `dep_logic`.
affects: >0.3.0
breakingThe `Dependency` API was significantly reworked. The `DependencySpecifier` class was removed, and `Dependency` now takes a `name` and `specifier` directly upon initialization.
fix
Refactor code using `DependencySpecifier` or old `Dependency` constructors to use the new `Dependency(name, specifier)` signature.
affects: <0.4.0
breakingThe `specifier` attribute of `Dependency` objects became non-optional.
fix
Ensure that when creating `Dependency` objects, you always provide a `specifier` argument.
affects: <0.5.0
gotchaBe aware of the difference between `&` (intersection/AND) and `|` (union/OR) for specifiers. Intersection requires a version to satisfy ALL combined conditions, while union requires it to satisfy ANY.
fix
Carefully consider the logical operation needed for your dependency constraints. Test with edge cases to ensure the combined specifier behaves as expected.
affects: All versions
Upgrade
Version history
0.7.1latest on PyPI · released Aug 10, 2026
Audit
Dependencies

No dependency data recorded yet.

Agent activity
12 hits · last 30 days
node
12
Resources
dep-logic — pip install dep-logic · libregistry