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, namelytuprolog.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, namelytuprolog.theory.serialize
, -
a module for using Prolog via a command-line interface, namely
tuprolog.repl
.
How to do stuff
Prerequisites
-
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
-
Install Java (JDK preferred), and ensure the
JAVA_HOME
variable is correctly set -
Ensure Java and Python are both either 64bit or 32bit
-
If you have installed some prior development version of 2PPy (e.g.
tuppy
ortuprolog
), uninstall them viapip 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
-
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
-
Restore JVM dependencies via
download-jars.sh
, by running:./download-jars.sh
Notice that this command requires
curl
andwget
to be installed on your system (wget
may be lacking on Mac OS and Windows)
How to use 2PPy as a library
-
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
-
Import
tuprolog.*
modules in your Python scripts -
Profit
How to use 2PPy as an executable
-
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
-
Run
tuprolog
module viapython -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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file 2ppy-0.4.1.tar.gz
.
File metadata
- Download URL: 2ppy-0.4.1.tar.gz
- Upload date:
- Size: 25.7 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ee3ed3a4f53ffe8a9fe96b7a47090c0487ab3fa051e52f93e8ae7ad401600f57 |
|
MD5 | 331526bdae1b2b870bf5b91fd659b9df |
|
BLAKE2b-256 | 82853942ba5689e722181819e58fe26b7b00c5160e646fa317afb1640c8be782 |
File details
Details for the file 2ppy-0.4.1-py3-none-any.whl
.
File metadata
- Download URL: 2ppy-0.4.1-py3-none-any.whl
- Upload date:
- Size: 25.7 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 33aaa3e7901b33f8815444da800caf5f9910341c621c962c33d6dd5e1f4d500f |
|
MD5 | 5497d8547710e6bb726352aae8e78e9b |
|
BLAKE2b-256 | 2e39f788a94db923a38f58aa79473caf67d871bec568e5572b11f3239eb38814 |