Skip to main content

CLIPS Python bindings

Project description

Python CFFI bindings for the ‘C’ Language Integrated Production System CLIPS 6.41.

Source:

https://github.com/noxdafox/clipspy

Documentation:

https://clipspy.readthedocs.io

Download:

https://pypi.python.org/pypi/clipspy

Build Status Documentation Status

Initially developed at NASA’s Johnson Space Center, CLIPS is a rule-based programming language useful for creating expert and production systems where a heuristic solution is easier to implement and maintain than an imperative one. CLIPS is designed to facilitate the development of software to model human knowledge or expertise.

CLIPSPy brings CLIPS capabilities within the Python ecosystem.

Installation

Linux

On Linux CLIPSPy is packaged for x86_64 architecture as a wheel according to PEP-513 guidelines. Most of the distributions should be supported.

$ pip install clipspy

MacOsx

Apple Silicon is supported for Python versions greater than 3.11.

$ pip install clipspy

Windows

CLIPSPy comes as a wheel for most of the Python versions and architectures.

> pip install clipspy

Building from sources

The provided Makefiles take care of retrieving the CLIPS source code and compiling the Python bindings together with it.

$ make
# make install

Please check the documentation for more information regarding building CLIPSPy from sources.

Example

import clips

DEFTEMPLATE_STRING = """
(deftemplate person
  (slot name (type STRING))
  (slot surname (type STRING))
  (slot birthdate (type SYMBOL)))
"""

DEFRULE_STRING = """
(defrule hello-world
  "Greet a new person."
  (person (name ?name) (surname ?surname))
  =>
  (println "Hello " ?name " " ?surname))
"""

environment = clips.Environment()

# define constructs
environment.build(DEFTEMPLATE_STRING)
environment.build(DEFRULE_STRING)

# retrieve the fact template
template = environment.find_template('person')

# assert a new fact through its template
fact = template.assert_fact(name='John',
                            surname='Doe',
                            birthdate=clips.Symbol('01/01/1970'))

# fact slots can be accessed as dictionary elements
assert fact['name'] == 'John'

# execute the activations in the agenda
environment.run()

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

clipspy-1.0.3.tar.gz (28.3 kB view hashes)

Uploaded Source

Built Distributions

clipspy-1.0.3-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (611.7 kB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ x86-64

clipspy-1.0.3-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (611.7 kB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ x86-64

clipspy-1.0.3-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (611.7 kB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ x86-64

clipspy-1.0.3-pp37-pypy37_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (611.8 kB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ x86-64

clipspy-1.0.3-cp312-cp312-win_amd64.whl (718.3 kB view hashes)

Uploaded CPython 3.12 Windows x86-64

clipspy-1.0.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (894.2 kB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64

clipspy-1.0.3-cp312-cp312-macosx_11_0_universal2.whl (1.0 MB view hashes)

Uploaded CPython 3.12 macOS 11.0+ universal2 (ARM64, x86-64)

clipspy-1.0.3-cp311-cp311-win_amd64.whl (718.5 kB view hashes)

Uploaded CPython 3.11 Windows x86-64

clipspy-1.0.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (891.6 kB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

clipspy-1.0.3-cp311-cp311-macosx_11_0_universal2.whl (1.0 MB view hashes)

Uploaded CPython 3.11 macOS 11.0+ universal2 (ARM64, x86-64)

clipspy-1.0.3-cp310-cp310-win_amd64.whl (718.5 kB view hashes)

Uploaded CPython 3.10 Windows x86-64

clipspy-1.0.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (891.6 kB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

clipspy-1.0.3-cp310-cp310-macosx_11_0_x86_64.whl (557.5 kB view hashes)

Uploaded CPython 3.10 macOS 11.0+ x86-64

clipspy-1.0.3-cp39-cp39-win_amd64.whl (718.5 kB view hashes)

Uploaded CPython 3.9 Windows x86-64

clipspy-1.0.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (891.6 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

clipspy-1.0.3-cp39-cp39-macosx_11_0_x86_64.whl (557.5 kB view hashes)

Uploaded CPython 3.9 macOS 11.0+ x86-64

clipspy-1.0.3-cp38-cp38-win_amd64.whl (718.5 kB view hashes)

Uploaded CPython 3.8 Windows x86-64

clipspy-1.0.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (891.7 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

clipspy-1.0.3-cp38-cp38-macosx_11_0_x86_64.whl (557.5 kB view hashes)

Uploaded CPython 3.8 macOS 11.0+ x86-64

clipspy-1.0.3-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (889.9 kB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.17+ x86-64

clipspy-1.0.3-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (889.9 kB view hashes)

Uploaded CPython 3.6m manylinux: glibc 2.17+ x86-64

Supported by

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