{"id":1449,"library":"dep-logic","title":"Dep-Logic Python Library","description":"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.","status":"active","version":"0.5.2","language":"en","source_language":"en","source_url":"https://github.com/dashing-systems/dep-logic","tags":["dependency management","versioning","specifiers","packaging","logical operations"],"install":[{"cmd":"pip install dep-logic","lang":"bash","label":"Install stable version"}],"dependencies":[],"imports":[{"note":"Moved directly to the top-level 'dep_logic' package in v0.3.0.","wrong":"from dep_logic.specifier import Specifier","symbol":"Specifier","correct":"from dep_logic import Specifier"},{"note":"Moved directly to the top-level 'dep_logic' package in v0.3.0.","wrong":"from dep_logic.specifier import SpecifierSet","symbol":"SpecifierSet","correct":"from dep_logic import SpecifierSet"},{"symbol":"Dependency","correct":"from dep_logic import Dependency"}],"quickstart":{"code":"from dep_logic import Specifier, SpecifierSet, Dependency\n\n# Define specifiers\nspec1 = Specifier(\">=1.0.0,<2.0.0\")\nspec2 = Specifier(\"~=1.5.0\") # equivalent to >=1.5.0,==1.*,==1.5.*, <1.6.0 for a minor release\n\n# Perform logical operations\ncombined_spec_and = spec1 & spec2 # Intersection\ncombined_spec_or = spec1 | spec2  # Union\n\nprint(f\"Specifier 1: {spec1}\")\nprint(f\"Specifier 2: {spec2}\")\nprint(f\"Intersection (AND): {combined_spec_and}\")\nprint(f\"Union (OR): {combined_spec_or}\")\n\n# Check if a version satisfies a specifier\nassert combined_spec_and.contains(\"1.5.2\")\nassert not combined_spec_and.contains(\"1.0.0\")\n\n# Define a dependency\nmy_dependency = Dependency(\"my_package\", Specifier(\">=1.0.0,<2.0.0\"))\nprint(f\"Dependency: {my_dependency}\")","lang":"python","description":"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."},"warnings":[{"fix":"Update your imports from `from dep_logic.specifier import ...` to `from dep_logic import ...`","message":"The primary import path for `Specifier` and `SpecifierSet` changed from `dep_logic.specifier` to `dep_logic` directly.","severity":"breaking","affected_versions":"<0.3.0"},{"fix":"Refactor code using `DependencySpecifier` or old `Dependency` constructors to use the new `Dependency(name, specifier)` signature.","message":"The `Dependency` API was significantly reworked. The `DependencySpecifier` class was removed, and `Dependency` now takes a `name` and `specifier` directly upon initialization.","severity":"breaking","affected_versions":"<0.4.0"},{"fix":"Ensure that when creating `Dependency` objects, you always provide a `specifier` argument.","message":"The `specifier` attribute of `Dependency` objects became non-optional.","severity":"breaking","affected_versions":"<0.5.0"},{"fix":"Carefully consider the logical operation needed for your dependency constraints. Test with edge cases to ensure the combined specifier behaves as expected.","message":"Be 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.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-09T00:00:00.000Z","next_check":"2026-07-08T00:00:00.000Z"}