# 2PPy (tuProlog in Python)
Experimental porting of [2P-Kt](https://github.com/tuProlog/2p-kt) on Python, via [JPype](https://jpype.readthedocs.io).
> 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](https://github.com/pyenv/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
```bash
pip uninstall tuppy tuprolog
```
On __Mac OS__ this may not work as expected.
Consider running the following command instead:
```bash
python3 -m pip uninstall tuppy tuprolog
```
### How to develop 2PPy
5. Restore Python dependencies via PIP, by running:
```bash
pip install -r requirements.txt
```
On __Mac OS__ this may not work as expected.
Consider running the following command instead:
```bash
python3 -m pip -r requirements.txt
```
6. Restore JVM dependencies via `download-jars.sh`, by running:
```bash
./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
5. Install 2PPy from Pypi by running:
```bash
pip install 2ppy
```
On __Mac OS__ this may not work as expected.
Consider running the following command instead:
```bash
python3 -m pip install 2ppy
```
6. Import `tuprolog.*` modules in your Python scripts
7. Profit
### How to use 2PPy as an executable
5. Install 2PPy from Pypi by running:
```bash
pip install 2ppy
```
On __Mac OS__ this may not work as expected.
Consider running the following command instead:
```bash
python3 -m pip install 2ppy
```
6. Run `tuprolog` module via
```bash
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.
Raw data
{
"_id": null,
"home_page": "https://github.com/tuProlog/2ppy",
"name": "2ppy",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.6, <4",
"maintainer_email": "",
"keywords": "prolog,symbolic ai,ecosystem,tuprolog,2p,python",
"author": "Giovanni Ciatto",
"author_email": "giovanni.ciatto@unibo.it",
"download_url": "https://files.pythonhosted.org/packages/02/9d/eb6fc52e24599cb44da3840acc68eef59a2c88a1658b81014f11866986ab/2ppy-0.4.0.tar.gz",
"platform": "Independant",
"description": "# 2PPy (tuProlog in Python)\n\nExperimental porting of [2P-Kt](https://github.com/tuProlog/2p-kt) on Python, via [JPype](https://jpype.readthedocs.io).\n\n> This is a __work in progress__. 2PPy is not ready for general availability, yet.\n\n## Introduction\n\nObject-oriented and modular ecosystem for symbolic AI and logic programming, currently featuring:\n\n* a module for logic terms and clauses representation, namely `tuprolog.core`,\n\n* a module for logic unification, namely `tuprolog.unify`,\n\n* a module for in-memory indexing and storing logic theories, as well as other sorts of collections of logic clauses, namely `tuprolog.theory`,\n\n* a module providing generic API for resolution of logic queries, namely `tuprolog.solve`, currently implementing a Prolog solver\n\n* two parsing modules: one aimed at parsing terms, namely `tuprolog.core.parsing`, and the other aimed at parsing theories, namely `tuprolog.theory.parsing`,\n\n* two serialisation-related modules: one aimed at (de)serialising terms and clauses, namely `tuprolog.core.serialize`, and the \nother aimed at (de)serialising terms theories, namely `tuprolog.theory.serialize`,\n\n* a module for using Prolog via a command-line interface, namely `tuprolog.repl`.\n\n## How to do stuff\n\n### Prerequisites\n\n1. Install Python 3 (look into the `.python-version` to know the exact version)\n * I suggest using [Pyenv](https://github.com/pyenv/pyenv) to easily handle multiple Python versions on the same machine\n * Ensure PIP works fine\n\n2. Install Java (JDK preferred), and **ensure the `JAVA_HOME` variable is correctly set**\n\n3. Ensure Java and Python are both either 64bit or 32bit\n\n4. If you have installed some prior development version of 2PPy (e.g. `tuppy` or `tuprolog`), uninstall them via\n ```bash\n pip uninstall tuppy tuprolog\n ```\n On __Mac OS__ this may not work as expected.\n Consider running the following command instead:\n ```bash\n python3 -m pip uninstall tuppy tuprolog\n ```\n\n### How to develop 2PPy\n\n5. Restore Python dependencies via PIP, by running:\n ```bash\n pip install -r requirements.txt\n ```\n On __Mac OS__ this may not work as expected.\n Consider running the following command instead:\n ```bash\n python3 -m pip -r requirements.txt\n ```\n\n6. Restore JVM dependencies via `download-jars.sh`, by running:\n ```bash\n ./download-jars.sh\n ```\n Notice that this command requires `curl` and `wget` to be installed on your system (`wget` may be lacking on __Mac OS__ and Windows)\n\n### How to use 2PPy as a library\n\n5. Install 2PPy from Pypi by running:\n ```bash\n pip install 2ppy\n ```\n On __Mac OS__ this may not work as expected.\n Consider running the following command instead:\n ```bash\n python3 -m pip install 2ppy\n ```\n \n6. Import `tuprolog.*` modules in your Python scripts\n\n7. Profit\n\n### How to use 2PPy as an executable\n\n5. Install 2PPy from Pypi by running:\n ```bash\n pip install 2ppy\n ```\n On __Mac OS__ this may not work as expected.\n Consider running the following command instead:\n ```bash\n python3 -m pip install 2ppy\n ```\n \n6. Run `tuprolog` module via\n ```bash\n python -m tuprolog\n ```\n\nFor the moment, running 2PPy means starting an interactive Python shell with pre-loaded `tuprolog.*` modules.\n\nEventually `python -m tuprolog` will launch a command-line logic solver.\n\n\n",
"bugtrack_url": null,
"license": "Apache 2.0 License",
"summary": "Python-based implementation of tuProlog -- the open ecosystem for symbolic AI --, based on 2P-Kt",
"version": "0.4.0",
"split_keywords": [
"prolog",
"symbolic ai",
"ecosystem",
"tuprolog",
"2p",
"python"
],
"urls": [
{
"comment_text": "",
"digests": {
"md5": "5066c3fc69d1c9b95832198c338664c5",
"sha256": "ad308beb4a71b3356d2d798a6acaa872294ea0182a60f5a7e95f7f9c4ad08b83"
},
"downloads": -1,
"filename": "2ppy-0.4.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "5066c3fc69d1c9b95832198c338664c5",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6, <4",
"size": 26215829,
"upload_time": "2022-01-02T09:09:24",
"upload_time_iso_8601": "2022-01-02T09:09:24.479436Z",
"url": "https://files.pythonhosted.org/packages/48/30/607d05ac0f5f587e55a64de87977b8b09c209ec65ecb8d2d94aaa1a84b96/2ppy-0.4.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"md5": "49ad506cb2a9df63cba0f210379d40ea",
"sha256": "5565f7e682e1c0bf471e5890dc0c9dbb268834cf04c123df8e50e8c115586647"
},
"downloads": -1,
"filename": "2ppy-0.4.0.tar.gz",
"has_sig": false,
"md5_digest": "49ad506cb2a9df63cba0f210379d40ea",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6, <4",
"size": 26202938,
"upload_time": "2022-01-02T09:09:27",
"upload_time_iso_8601": "2022-01-02T09:09:27.598554Z",
"url": "https://files.pythonhosted.org/packages/02/9d/eb6fc52e24599cb44da3840acc68eef59a2c88a1658b81014f11866986ab/2ppy-0.4.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2022-01-02 09:09:27",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "tuProlog",
"github_project": "2ppy",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "JPype1",
"specs": [
[
"==",
"1.3.0"
]
]
},
{
"name": "build",
"specs": [
[
">=",
"0.6.0"
]
]
},
{
"name": "twine",
"specs": [
[
">=",
"3.4.2"
]
]
}
],
"lcname": "2ppy"
}