Skip to main content

Answer Set Programming with a friendly interface.

Project description

ASPish - Answer Set Programming for Python

ASPish is a library that aims to provide some parts of ASP (Anser Set Programming) in a Python-friendly way. All the heavy lifting is done by clingo, a mature implementation of ASP. This library merely provides an interface that allows for a more streamlined usage from Python than the official Python bindings.

ASP can be approximately viewed as the combination of query language that extends datalog, and a satisfiability solver. Both are integrated into a single coherent language which makes ASP particularly convenient when dealing with relational data.

This project is in early stages and is not stable.

Basic Usage

from aspish import Solver, predicate, var

# declarations
edge = predicate('edge', ('x', 'y'))
path = predicate('path', ('x', 'y'))

solver = Solver()
X, Y, Z = map(var, 'XYZ')

# add facts
solver.add(
    edge(1, 2),
    edge(2, 3)
)

# add rules
solver.add(
    path(X, Y) <= edge(X, Y),
    path(X, Y) <= (
        edge(X, Z),
        path(Z, Y)
    )
)

# run
solver.solve()
solver.get(path)

# returns
[path(x=1, y=2), path(x=2, y=3), path(x=1, y=3)]

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aspish-0.7.0.tar.gz (6.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

aspish-0.7.0-py3-none-any.whl (9.2 kB view details)

Uploaded Python 3

File details

Details for the file aspish-0.7.0.tar.gz.

File metadata

  • Download URL: aspish-0.7.0.tar.gz
  • Upload date:
  • Size: 6.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.3.2 CPython/3.14.3 Darwin/24.6.0

File hashes

Hashes for aspish-0.7.0.tar.gz
Algorithm Hash digest
SHA256 28ad4273aef60c371b8721ae7464edf06b9fc847320633287d16a73940c73fac
MD5 d67f36fb02075cea9df6f91664f6fc70
BLAKE2b-256 724f9a1528cc00cb4379d28931032efd1ed13a742b29fe4113f04c9a82554424

See more details on using hashes here.

File details

Details for the file aspish-0.7.0-py3-none-any.whl.

File metadata

  • Download URL: aspish-0.7.0-py3-none-any.whl
  • Upload date:
  • Size: 9.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.3.2 CPython/3.14.3 Darwin/24.6.0

File hashes

Hashes for aspish-0.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e63d1b59394f23fef59c47667c48ead9a59d227ebec486b81c380df8c5806acb
MD5 b34e89c5256c02080b383c474fe072a0
BLAKE2b-256 8dc65d82377d6332f6e7aa10894d508fb9a948ee1805386ad0705a20a4720e08

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page