# 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": null,
"docs_url": null,
"requires_python": "<4,>=3.6",
"maintainer_email": null,
"keywords": "prolog, symbolic ai, ecosystem, tuprolog, 2p, python",
"author": "Giovanni Ciatto",
"author_email": "giovanni.ciatto@unibo.it",
"download_url": "https://files.pythonhosted.org/packages/82/85/3942ba5689e722181819e58fe26b7b00c5160e646fa317afb1640c8be782/2ppy-0.4.1.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",
"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.1",
"project_urls": {
"Bug Reports": "https://github.com/tuProlog/2ppy/issues",
"Homepage": "https://github.com/tuProlog/2ppy",
"Source": "https://github.com/tuProlog/2ppy"
},
"split_keywords": [
"prolog",
" symbolic ai",
" ecosystem",
" tuprolog",
" 2p",
" python"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "2e39f788a94db923a38f58aa79473caf67d871bec568e5572b11f3239eb38814",
"md5": "5497d8547710e6bb726352aae8e78e9b",
"sha256": "33aaa3e7901b33f8815444da800caf5f9910341c621c962c33d6dd5e1f4d500f"
},
"downloads": -1,
"filename": "2ppy-0.4.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "5497d8547710e6bb726352aae8e78e9b",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4,>=3.6",
"size": 25734534,
"upload_time": "2024-11-18T09:15:58",
"upload_time_iso_8601": "2024-11-18T09:15:58.892483Z",
"url": "https://files.pythonhosted.org/packages/2e/39/f788a94db923a38f58aa79473caf67d871bec568e5572b11f3239eb38814/2ppy-0.4.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "82853942ba5689e722181819e58fe26b7b00c5160e646fa317afb1640c8be782",
"md5": "331526bdae1b2b870bf5b91fd659b9df",
"sha256": "ee3ed3a4f53ffe8a9fe96b7a47090c0487ab3fa051e52f93e8ae7ad401600f57"
},
"downloads": -1,
"filename": "2ppy-0.4.1.tar.gz",
"has_sig": false,
"md5_digest": "331526bdae1b2b870bf5b91fd659b9df",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4,>=3.6",
"size": 25722652,
"upload_time": "2024-11-18T09:16:02",
"upload_time_iso_8601": "2024-11-18T09:16:02.245517Z",
"url": "https://files.pythonhosted.org/packages/82/85/3942ba5689e722181819e58fe26b7b00c5160e646fa317afb1640c8be782/2ppy-0.4.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-18 09:16:02",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "tuProlog",
"github_project": "2ppy",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "2ppy"
}