From 68d0cd3755263e3bf923c833e10b30bdeaa92a7d Mon Sep 17 00:00:00 2001 From: Erwin Lejeune Date: Tue, 22 Dec 2020 18:58:00 +0100 Subject: [PATCH 01/12] prepare for packaging on pypi --- .github/workflows/build.yml | 11 ++++++++++- .github/workflows/format.yml | 11 ++++++++++- .github/workflows/tests.yml | 22 ++++++++++++++++++++-- setup.py | 21 +++++++++++++++++++++ 4 files changed, 61 insertions(+), 4 deletions(-) create mode 100644 setup.py diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b510c1f..ea13592 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -4,7 +4,16 @@ on: [push] jobs: build: - runs-on: ubuntu-latest + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + python-version: [3.6, 3.7, 3.8, pypy-3.6] + exclude: + - os: macos-latest + python-version: 3.8 + - os: windows-latest + python-version: 3.6 steps: - uses: actions/checkout@v2 diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index 08d8a90..5bad960 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -4,7 +4,16 @@ on: branches: [main] jobs: format: - runs-on: ubuntu-latest + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + python-version: [3.6, 3.7, 3.8, pypy-3.6] + exclude: + - os: macos-latest + python-version: 3.8 + - os: windows-latest + python-version: 3.6 steps: - uses: actions/checkout@v2 with: diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 2f52033..afe9fdd 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -4,7 +4,16 @@ on: [push] jobs: build: - runs-on: ubuntu-latest + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + python-version: [3.6, 3.7, 3.8, pypy-3.6] + exclude: + - os: macos-latest + python-version: 3.8 + - os: windows-latest + python-version: 3.6 steps: - uses: actions/checkout@v2 @@ -34,7 +43,16 @@ jobs: flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics test: - runs-on: ubuntu-latest + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + python-version: [3.6, 3.7, 3.8, pypy-3.6] + exclude: + - os: macos-latest + python-version: 3.8 + - os: windows-latest + python-version: 3.6 steps: - uses: actions/checkout@v2 - name: Set up Python 3.7 diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..7092d26 --- /dev/null +++ b/setup.py @@ -0,0 +1,21 @@ +import setuptools + +with open("README.md", "r", encoding="utf-8") as fh: + long_description = fh.read() + +setuptools.setup( + name="pythonpddl-guilyx", # Replace with your own username + version="0.2.0", + author="Erwin Lejeune", + author_email="erwinlejeune.pro@gmail.com", + description="PythonPDDL is a PDDL planner built on top of a Julia parser", + long_description=long_description, + long_description_content_type="text/markdown", + url="https://github.com/apla-toolbox/pythonpddl", + packages=setuptools.find_packages(), + classifiers=[ + "Programming Language :: Python :: 3", + "License :: OSI Approved :: Apache Software License", + "Operating System :: OS Independent", + ], + python_requires='>=3.6', From 0964a8c7178c88e4caa489420040c92f98a5d417 Mon Sep 17 00:00:00 2001 From: Erwin Lejeune Date: Tue, 22 Dec 2020 19:01:35 +0100 Subject: [PATCH 02/12] remove windows from ci --- .github/workflows/build.yml | 6 ++---- .github/workflows/format.yml | 6 ++---- .github/workflows/tests.yml | 6 ++---- 3 files changed, 6 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ea13592..2de6e9b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,13 +7,11 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-latest, macos-latest, windows-latest] - python-version: [3.6, 3.7, 3.8, pypy-3.6] + os: [ubuntu-latest, macos-latest] + python-version: [3.6, 3.7, 3.8] exclude: - os: macos-latest python-version: 3.8 - - os: windows-latest - python-version: 3.6 steps: - uses: actions/checkout@v2 diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index 5bad960..7a47509 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -7,13 +7,11 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-latest, macos-latest, windows-latest] - python-version: [3.6, 3.7, 3.8, pypy-3.6] + os: [ubuntu-latest, macos-latest] + python-version: [3.6, 3.7, 3.8] exclude: - os: macos-latest python-version: 3.8 - - os: windows-latest - python-version: 3.6 steps: - uses: actions/checkout@v2 with: diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index afe9fdd..4e81d27 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -7,13 +7,11 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-latest, macos-latest, windows-latest] - python-version: [3.6, 3.7, 3.8, pypy-3.6] + os: [ubuntu-latest, macos-latest] + python-version: [3.6, 3.7, 3.8] exclude: - os: macos-latest python-version: 3.8 - - os: windows-latest - python-version: 3.6 steps: - uses: actions/checkout@v2 From f80426fa25a46bb64f6547e0804165d6727322f1 Mon Sep 17 00:00:00 2001 From: Erwin Lejeune Date: Tue, 22 Dec 2020 19:02:41 +0100 Subject: [PATCH 03/12] fix setup.py --- setup.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index 7092d26..95364e2 100644 --- a/setup.py +++ b/setup.py @@ -4,7 +4,7 @@ long_description = fh.read() setuptools.setup( - name="pythonpddl-guilyx", # Replace with your own username + name="pythonpddl-guilyx", # Replace with your own username version="0.2.0", author="Erwin Lejeune", author_email="erwinlejeune.pro@gmail.com", @@ -16,6 +16,7 @@ classifiers=[ "Programming Language :: Python :: 3", "License :: OSI Approved :: Apache Software License", - "Operating System :: OS Independent", + "Operating System :: Ubuntu, MacOS", ], - python_requires='>=3.6', + python_requires=">=3.6", +) From 58bfbbaed1980a19a070fb142ce6b51a2960290b Mon Sep 17 00:00:00 2001 From: Erwin Lejeune Date: Tue, 22 Dec 2020 21:47:18 +0100 Subject: [PATCH 04/12] change package name --- README.md | 18 +++--------------- {src => jupyddl}/__init__.py | 0 {src => jupyddl}/a_star.py | 0 {src => jupyddl}/automated_planner.py | 0 {src => jupyddl}/bfs.py | 0 {src => jupyddl}/dfs.py | 0 {src => jupyddl}/dijkstra.py | 0 {src => jupyddl}/heuristics.py | 0 {src => jupyddl}/node.py | 0 setup.py | 16 +++++++++++++--- 10 files changed, 16 insertions(+), 18 deletions(-) rename {src => jupyddl}/__init__.py (100%) rename {src => jupyddl}/a_star.py (100%) rename {src => jupyddl}/automated_planner.py (100%) rename {src => jupyddl}/bfs.py (100%) rename {src => jupyddl}/dfs.py (100%) rename {src => jupyddl}/dijkstra.py (100%) rename {src => jupyddl}/heuristics.py (100%) rename {src => jupyddl}/node.py (100%) diff --git a/README.md b/README.md index 16523eb..97e4164 100644 --- a/README.md +++ b/README.md @@ -45,23 +45,15 @@ $ julia --color=yes -e 'using Pkg; Pkg.add(Pkg.PackageSpec(path="https://github. ```bash $ python3 -m pip install --upgrade pip -$ git clone https://github.com/APLA-Toolbox/PythonPDDL -$ cd PythonPDDL -$ python3 -m pip install -r requirements.txt +$ python3 -m pip install jupyddl ``` -# Usage - -Navigate to the root directory and you can run the tool by using : `python3 main.py "data/domain.pddl" "data/problem.pddl"` - # REFL Mode -- Clone the repository: `git clone https://github.com/APLA-Toolbox/PythonPDDL` -- Move to the repository folder: `cd PythonPDDL` - Run `python3` in the terminal. - Use the AutomatedPlanner class to do what you want: ```python -from src.automated_planner import AutomatedPlanner # takes some time because it has to instantiate the Julia interface +from jupyddl import AutomatedPlanner # takes some time because it has to instantiate the Julia interface apl = AutomatedPlanner("data/domain.pddl", "data/problem.pddl) apl.initial_state @@ -85,15 +77,11 @@ print(apl.get_actions_from_path(path)) [, , ] ``` -# Script mode - -UC - # Contribute Open an issue to state clearly the contribution you want to make. Upon aproval send in a PR with the Issue referenced. (Implement Issue #No / Fix Issue #No). -# Contributors +# Maintainers - Erwin Lejeune - Sampreet Sarkar diff --git a/src/__init__.py b/jupyddl/__init__.py similarity index 100% rename from src/__init__.py rename to jupyddl/__init__.py diff --git a/src/a_star.py b/jupyddl/a_star.py similarity index 100% rename from src/a_star.py rename to jupyddl/a_star.py diff --git a/src/automated_planner.py b/jupyddl/automated_planner.py similarity index 100% rename from src/automated_planner.py rename to jupyddl/automated_planner.py diff --git a/src/bfs.py b/jupyddl/bfs.py similarity index 100% rename from src/bfs.py rename to jupyddl/bfs.py diff --git a/src/dfs.py b/jupyddl/dfs.py similarity index 100% rename from src/dfs.py rename to jupyddl/dfs.py diff --git a/src/dijkstra.py b/jupyddl/dijkstra.py similarity index 100% rename from src/dijkstra.py rename to jupyddl/dijkstra.py diff --git a/src/heuristics.py b/jupyddl/heuristics.py similarity index 100% rename from src/heuristics.py rename to jupyddl/heuristics.py diff --git a/src/node.py b/jupyddl/node.py similarity index 100% rename from src/node.py rename to jupyddl/node.py diff --git a/setup.py b/setup.py index 95364e2..5c8d525 100644 --- a/setup.py +++ b/setup.py @@ -1,22 +1,32 @@ import setuptools +with open('requirements.txt') as f: + required = f.read().splitlines() + with open("README.md", "r", encoding="utf-8") as fh: long_description = fh.read() + setuptools.setup( - name="pythonpddl-guilyx", # Replace with your own username - version="0.2.0", + name="jupyddl", # Replace with your own username + version="0.2.1", author="Erwin Lejeune", author_email="erwinlejeune.pro@gmail.com", - description="PythonPDDL is a PDDL planner built on top of a Julia parser", + description="Jupyddl is a PDDL planner built on top of a Julia parser", long_description=long_description, long_description_content_type="text/markdown", url="https://github.com/apla-toolbox/pythonpddl", packages=setuptools.find_packages(), + install_requires=required, classifiers=[ + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3", "License :: OSI Approved :: Apache Software License", "Operating System :: Ubuntu, MacOS", + "Framework :: Pytest", ], python_requires=">=3.6", ) From d83b79c636272118eed62e28d21fb3952201f510 Mon Sep 17 00:00:00 2001 From: guilyx Date: Tue, 22 Dec 2020 20:48:44 +0000 Subject: [PATCH 05/12] Apply formatting changes --- setup.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 5c8d525..2112fe4 100644 --- a/setup.py +++ b/setup.py @@ -1,11 +1,11 @@ import setuptools -with open('requirements.txt') as f: +with open("requirements.txt") as f: required = f.read().splitlines() with open("README.md", "r", encoding="utf-8") as fh: long_description = fh.read() - + setuptools.setup( name="jupyddl", # Replace with your own username From 2da9c8c2fa1fc685c5d8e41d389038b3fb2043a1 Mon Sep 17 00:00:00 2001 From: Erwin Lejeune Date: Tue, 22 Dec 2020 21:51:29 +0100 Subject: [PATCH 06/12] fix setup.py --- setup.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 5c8d525..a00e783 100644 --- a/setup.py +++ b/setup.py @@ -9,7 +9,7 @@ setuptools.setup( name="jupyddl", # Replace with your own username - version="0.2.1", + version="0.2.2", author="Erwin Lejeune", author_email="erwinlejeune.pro@gmail.com", description="Jupyddl is a PDDL planner built on top of a Julia parser", @@ -25,7 +25,8 @@ "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3", "License :: OSI Approved :: Apache Software License", - "Operating System :: Ubuntu, MacOS", + "Operating System :: Unix", + "Operating System :: MacOS", "Framework :: Pytest", ], python_requires=">=3.6", From efb983f596987119afeac24b4d249f61bdddebb2 Mon Sep 17 00:00:00 2001 From: Erwin Lejeune Date: Tue, 22 Dec 2020 23:36:05 +0100 Subject: [PATCH 07/12] upgrade to 0.2.3 --- .github/workflows/format.yml | 9 +-------- jupyddl/__init__.py | 2 +- setup.py | 2 +- 3 files changed, 3 insertions(+), 10 deletions(-) diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index 7a47509..08d8a90 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -4,14 +4,7 @@ on: branches: [main] jobs: format: - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ubuntu-latest, macos-latest] - python-version: [3.6, 3.7, 3.8] - exclude: - - os: macos-latest - python-version: 3.8 + runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 with: diff --git a/jupyddl/__init__.py b/jupyddl/__init__.py index 8b13789..cd9d7d1 100644 --- a/jupyddl/__init__.py +++ b/jupyddl/__init__.py @@ -1 +1 @@ - +from .automated_planner import AutomatedPlanner diff --git a/setup.py b/setup.py index ddedacd..86616c7 100644 --- a/setup.py +++ b/setup.py @@ -9,7 +9,7 @@ setuptools.setup( name="jupyddl", # Replace with your own username - version="0.2.2", + version="0.2.3", author="Erwin Lejeune", author_email="erwinlejeune.pro@gmail.com", description="Jupyddl is a PDDL planner built on top of a Julia parser", From 5a491bd67ca22897e2b2ce7c5cf9f0602eb51da6 Mon Sep 17 00:00:00 2001 From: Erwin Lejeune Date: Wed, 23 Dec 2020 01:21:18 +0100 Subject: [PATCH 08/12] improve lint --- tests/test_automated_planner.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_automated_planner.py b/tests/test_automated_planner.py index bc4538f..cc18d0c 100644 --- a/tests/test_automated_planner.py +++ b/tests/test_automated_planner.py @@ -28,9 +28,9 @@ def test_execute_action(): def test_state_has_term(): apla = AutomatedPlanner("data/domain.pddl", "data/problem.pddl") is_goal = apla.state_has_term(apla.initial_state, apla.goals[0]) - assert is_goal == False + assert not is_goal def test_state_assertion(): apla = AutomatedPlanner("data/domain.pddl", "data/problem.pddl") - assert apla.satisfies(apla.problem.goal, apla.initial_state) == False + assert not apla.satisfies(apla.problem.goal, apla.initial_state) From 6d0f7a64aff2937873316257e481a568b4ca672a Mon Sep 17 00:00:00 2001 From: Erwin Lejeune Date: Wed, 23 Dec 2020 01:22:14 +0100 Subject: [PATCH 09/12] remove warning --- jupyddl/__init__.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/jupyddl/__init__.py b/jupyddl/__init__.py index cd9d7d1..2d1aedd 100644 --- a/jupyddl/__init__.py +++ b/jupyddl/__init__.py @@ -1 +1,4 @@ from .automated_planner import AutomatedPlanner + +if __name__ == "__main__": + _ = AutomatedPlanner("data/domain.pddl", "data/problem.pddl") From 8f888e9c79d0ef4166bd03f767ab15d7f2bef967 Mon Sep 17 00:00:00 2001 From: Erwin Lejeune Date: Wed, 23 Dec 2020 01:23:28 +0100 Subject: [PATCH 10/12] bump to 0.2.4 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 86616c7..730e7b8 100644 --- a/setup.py +++ b/setup.py @@ -9,7 +9,7 @@ setuptools.setup( name="jupyddl", # Replace with your own username - version="0.2.3", + version="0.2.4", author="Erwin Lejeune", author_email="erwinlejeune.pro@gmail.com", description="Jupyddl is a PDDL planner built on top of a Julia parser", From be261cf23a478224f2da1ad4bf1ace4e5c680903 Mon Sep 17 00:00:00 2001 From: guilyx Date: Wed, 23 Dec 2020 00:24:11 +0000 Subject: [PATCH 11/12] Apply formatting changes --- jupyddl/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jupyddl/__init__.py b/jupyddl/__init__.py index 2d1aedd..ae6baae 100644 --- a/jupyddl/__init__.py +++ b/jupyddl/__init__.py @@ -1,4 +1,4 @@ from .automated_planner import AutomatedPlanner if __name__ == "__main__": - _ = AutomatedPlanner("data/domain.pddl", "data/problem.pddl") + _ = AutomatedPlanner("data/domain.pddl", "data/problem.pddl") From 6cb23952753f2aee3869d8e3681fc062336741ec Mon Sep 17 00:00:00 2001 From: Erwin Lejeune Date: Wed, 23 Dec 2020 01:27:54 +0100 Subject: [PATCH 12/12] remove elses when return in if --- jupyddl/automated_planner.py | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/jupyddl/automated_planner.py b/jupyddl/automated_planner.py index 7403bbc..6729bd2 100644 --- a/jupyddl/automated_planner.py +++ b/jupyddl/automated_planner.py @@ -47,8 +47,7 @@ def satisfies(self, asserted_state, state): def state_has_term(self, state, term): if self.pddl.has_term_in_state(self.domain, state, term): return True - else: - return False + return False def __flatten_goal(self): return self.pddl.flatten_goal(self.problem) @@ -74,8 +73,7 @@ def get_actions_from_path(self, path): cost = self.pddl.get_value(path[-1].state, "total-cost") if not cost: return actions - else: - return (actions, cost) + return (actions, cost) def get_state_def_from_path(self, path): if not path: @@ -92,8 +90,7 @@ def breadth_first_search(self, time_it=False): path = self.__retrace_path(last_node) if time_it: return path, total_time - else: - return path, None + return path, None def depth_first_search(self, time_it=False): dfs = DepthFirstSearch(self) @@ -101,8 +98,7 @@ def depth_first_search(self, time_it=False): path = self.__retrace_path(last_node) if time_it: return path, total_time - else: - return path, None + return path, None def dijktra_best_first_search(self, time_it=False): dijkstra = DijkstraBestFirstSearch(self) @@ -110,8 +106,7 @@ def dijktra_best_first_search(self, time_it=False): path = self.__retrace_path(last_node) if time_it: return path, total_time - else: - return path, None + return path, None def astar_best_first_search(self, time_it=False, heuristic=goal_count_heuristic): astar = AStarBestFirstSearch(self, heuristic) @@ -119,5 +114,4 @@ def astar_best_first_search(self, time_it=False, heuristic=goal_count_heuristic) path = self.__retrace_path(last_node) if time_it: return path, total_time - else: - return path, None + return path, None