Skip to main content

Python-based implementation of tuProlog -- the open ecosystem for symbolic AI --, based on 2P-Kt

Project description

2PPy (tuProlog in Python)

Experimental porting of 2P-Kt on Python, via JPype.

This is a work in progress. 2PPy is not ready for general availability, yet.

Introduction

Object-oriented and modular ecosystem for symbolic AI and logic programming, currently featuring:

  • a module for logic terms and clauses representation, namely tuprolog.core,

  • a module for logic unification, namely tuprolog.unify,

  • a module for in-memory indexing and storing logic theories, as well as other sorts of collections of logic clauses, namely tuprolog.theory,

  • a module providing generic API for resolution of logic queries, namely tuprolog.solve, currently implementing a Prolog solver

  • two parsing modules: one aimed at parsing terms, namely tuprolog.core.parsing, and the other aimed at parsing theories, namely tuprolog.theory.parsing,

  • two serialisation-related modules: one aimed at (de)serialising terms and clauses, namely tuprolog.core.serialize, and the other aimed at (de)serialising terms theories, namely tuprolog.theory.serialize,

  • a module for using Prolog via a command-line interface, namely tuprolog.repl.

How to do stuff

Prerequisites

  1. Install Python 3 (look into the .python-version to know the exact version)

    • I suggest using Pyenv to easily handle multiple Python versions on the same machine
    • Ensure PIP works fine
  2. Install Java (JDK preferred), and ensure the JAVA_HOME variable is correctly set

  3. Ensure Java and Python are both either 64bit or 32bit

  4. If you have installed some prior development version of 2PPy (e.g. tuppy or tuprolog), uninstall them via

    pip uninstall tuppy tuprolog
    

    On Mac OS this may not work as expected. Consider running the following command instead:

    python3 -m pip uninstall tuppy tuprolog
    

How to develop 2PPy

  1. Restore Python dependencies via PIP, by running:

    pip install -r requirements.txt
    

    On Mac OS this may not work as expected. Consider running the following command instead:

    python3 -m pip -r requirements.txt
    
  2. Restore JVM dependencies via download-jars.sh, by running:

    ./download-jars.sh
    

    Notice that this command requires curl and wget to be installed on your system (wget may be lacking on Mac OS and Windows)

How to use 2PPy as a library

  1. Install 2PPy from Pypi by running:

    pip install 2ppy
    

    On Mac OS this may not work as expected. Consider running the following command instead:

    python3 -m pip install 2ppy
    
  2. Import tuprolog.* modules in your Python scripts

  3. Profit

How to use 2PPy as an executable

  1. Install 2PPy from Pypi by running:

    pip install 2ppy
    

    On Mac OS this may not work as expected. Consider running the following command instead:

    python3 -m pip install 2ppy
    
  2. Run tuprolog module via

    python -m tuprolog
    

For the moment, running 2PPy means starting an interactive Python shell with pre-loaded tuprolog.* modules.

Eventually python -m tuprolog will launch a command-line logic solver.

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

2ppy-0.3.3.tar.gz (24.7 MB view details)

Uploaded Source

Built Distribution

2ppy-0.3.3-py3-none-any.whl (24.7 MB view details)

Uploaded Python 3

File details

Details for the file 2ppy-0.3.3.tar.gz.

File metadata

  • Download URL: 2ppy-0.3.3.tar.gz
  • Upload date:
  • Size: 24.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10

File hashes

Hashes for 2ppy-0.3.3.tar.gz
Algorithm Hash digest
SHA256 91bb2a530bf9bcc906a607c00e1d574bd0a24db863351bcb7d6773237b1472cf
MD5 60dedc0d7bbe9b799dad21fcaa02aa3b
BLAKE2b-256 eea6ade2e94264bad86a1074a5fa5ea84c22ad786cedc81ab3ea0cc1ee58de42

See more details on using hashes here.

File details

Details for the file 2ppy-0.3.3-py3-none-any.whl.

File metadata

  • Download URL: 2ppy-0.3.3-py3-none-any.whl
  • Upload date:
  • Size: 24.7 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10

File hashes

Hashes for 2ppy-0.3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 634cfb98ce15f8d9629f64ed8b42e0e06b6307c10b3b65f769dda61bf0940f4f
MD5 74ad0354e51a5dbf9dc59ca554aba152
BLAKE2b-256 633e145c20817011dcdfce491d034a993daf2efd32e2d59ead35c14b3150f7de

See more details on using hashes here.

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