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, function_, var

# declarations
edge = function_('edge', ('x', 'y'))
path = function_('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.8.0.tar.gz (7.3 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.8.0-py3-none-any.whl (9.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: aspish-0.8.0.tar.gz
  • Upload date:
  • Size: 7.3 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.8.0.tar.gz
Algorithm Hash digest
SHA256 014e274773dca14370df66aa312b2af7263fa47aa956cf3b3bc86a54f2bf9a21
MD5 7d88f819b097cc6ad6ae9b53fe4007ef
BLAKE2b-256 8b14ec117ab6591aaf4ca2e6473a03a5230c20e9ff4367bd4db3359f63112d1b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: aspish-0.8.0-py3-none-any.whl
  • Upload date:
  • Size: 9.3 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.8.0-py3-none-any.whl
Algorithm Hash digest
SHA256 65b2649194fc0f2192a71a043e2dfe412e5a534e4db9920913a76db0d373a297
MD5 df05cd544498c52e7e17c6d7dc685c54
BLAKE2b-256 8ad89b60601f7410bfdb3801aaad3107a6f6b39019850eac9aeadaf81033d1da

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