{"id":10229,"library":"simplesat","title":"Simplesat","description":"Simplesat is a Python library providing a prototype for SAT-based dependency handling, designed for resolving package and software dependencies using satisfiability algorithms. It is currently at version 0.9.2. The release cadence is irregular, with recent updates primarily focusing on Python version compatibility and bug fixes rather than rapid feature additions. The API is explicitly stated as being subject to change.","status":"maintenance","version":"0.9.2","language":"en","source_language":"en","source_url":"https://github.com/enthought/sat-solver","tags":["solver","satisfiability","dependency-resolution","constraints","pysat"],"install":[{"cmd":"pip install simplesat","lang":"bash","label":"Install latest version"}],"dependencies":[],"imports":[{"symbol":"Solver","correct":"from simplesat.solver import Solver"},{"symbol":"Repository","correct":"from simplesat.repository import Repository"},{"symbol":"Solvable","correct":"from simplesat.repository import Solvable"},{"note":"Constraint symbols like EQ, GE, LE, NE are in `simplesat.constraints` as of v0.9.x, not `simplesat.core.constraints`.","wrong":"from simplesat.core.constraints import EQ","symbol":"EQ","correct":"from simplesat.constraints import EQ"}],"quickstart":{"code":"from simplesat.constraints import EQ, GE\nfrom simplesat.repository import Repository, Solvable\nfrom simplesat.solver import Solver\n\n# Define some solvables (e.g., packages and their versions)\nfoo_1_0 = Solvable(\"foo\", \"1.0\")\nfoo_1_1 = Solvable(\"foo\", \"1.1\")\nbar_1_0 = Solvable(\"bar\", \"1.0\")\n\n# Create a repository of available solvables\nrepo = Repository([foo_1_0, foo_1_1, bar_1_0])\n\n# Initialize the solver with the repository\nsolver = Solver(repo)\n\n# Add constraints to the solver\nsolver.add_constraint(EQ(\"foo\", \"1.0\")) # Require 'foo' version '1.0'\nsolver.add_constraint(GE(\"bar\", \"1.0\")) # Require 'bar' version '1.0' or greater\n\n# Solve the problem\ntry:\n    solution = solver.solve()\n    print(f\"Solution found: {solution}\")\nexcept Exception as e:\n    print(f\"Failed to find a solution: {e}\")","lang":"python","description":"This quickstart demonstrates how to define solvables (e.g., software packages), create a repository, add constraints, and use the solver to find a compatible set of solvables."},"warnings":[{"fix":"Always pin exact versions of `simplesat` in production. Regularly review the GitHub repository's release notes for breaking changes before upgrading. Test your application thoroughly with new versions.","message":"The project summary explicitly states: 'This is a work in progress, do not expect any API not to change at this point.' This means breaking changes can occur between minor or even patch versions without a major version increment.","severity":"breaking","affected_versions":"<1.0.0"},{"fix":"Ensure your problem domain aligns with dependency resolution. Review the source code and examples for how 'Solvables' and 'Constraints' are intended to be modeled. For general CSPs, consider other libraries.","message":"Simplesat is specifically designed for 'SAT-based dependency handling' and might not behave as expected for general-purpose constraint satisfaction problems. Its focus is on package-like dependencies.","severity":"gotcha","affected_versions":"All"},{"fix":"Carefully review your constraints for implicit or explicit cycles. Use the more descriptive error messages (available from v0.9.2+) to pinpoint the source of the cycle. Rethink your dependency graph to break cycles.","message":"If your set of constraints leads to a cyclic dependency, the solver will likely report an unsatisfiable problem. While version 0.9.2 improved the error message for this specific case, it remains a common pitfall in constraint definition.","severity":"gotcha","affected_versions":"All"}],"env_vars":null,"last_verified":"2026-04-17T00:00:00.000Z","next_check":"2026-07-16T00:00:00.000Z","problems":[{"fix":"Upgrade to the latest version of `simplesat` (`pip install --upgrade simplesat`) or consult the documentation for your specific version to find the correct import path for constraint symbols.","cause":"This usually means you are using an older version of simplesat where the `EQ` symbol, or other constraint symbols, were not directly exposed from `simplesat.constraints` or the module path changed due to API instability.","error":"AttributeError: module 'simplesat.constraints' has no attribute 'EQ'"},{"fix":"Analyze your constraints for cycles. This error often indicates a logical flaw in how dependencies are defined (e.g., Package A requires B, B requires C, and C requires A). You must remove or modify the conflicting constraints to break the cycle.","cause":"The set of constraints you've provided forms a circular dependency, making it impossible for the solver to find a valid solution.","error":"simplesat.solver.SolverError: Unsatisfiable problem: detected cyclic dependencies"},{"fix":"Verify your `simplesat` version. If it's old, upgrade to the latest (`pip install --upgrade simplesat`). If the problem persists, check the official GitHub repository's `README.md` or source code for the correct module path for `Solver` in your specific version.","cause":"The `Solver` class was either renamed, moved to a different module, or does not exist in your installed version of `simplesat` due to an API change.","error":"ImportError: cannot import name 'Solver' from 'simplesat.solver'"}]}