Skip to content

Commit

Permalink
Merge pull request #7 from ataitler/packaging
Browse files Browse the repository at this point in the history
Packaging
  • Loading branch information
ataitler authored Feb 16, 2023
2 parents 8419fa2 + d13a079 commit cebd1cb
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 79 deletions.
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
recursive-include rddlrepository/Archive *.rddl
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@

This repository is a collection of all verified RDDL files.
Specifically it is an archive for the problem used in probabilistic and learning track of the International Planning Competitions.

This repository contains also visualizers for the pyRDDLGym framework only, for appropriate domains.
2 changes: 1 addition & 1 deletion rddlrepository/Main.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

def main():
manager = RDDLRepoManager(rebuild=True)
manager.list_problems()
# manager.list_problems()
# envInfo = manager.get_problem('CooperativeRecon_ippc2018')
envInfo = manager.get_problem('RaceCar')
envInfo.list_instances()
Expand Down
3 changes: 3 additions & 0 deletions rddlrepository/Manager/ErrorHandling.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,6 @@ class RDDLRepoProblemDuplication(ValueError):

class RDDLRepoUnresolvedDependency(ValueError):
pass

class RDDLRepoManifestEmpty(ValueError):
pass
5 changes: 4 additions & 1 deletion rddlrepository/Manager/ProblemInfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,16 @@ def get_visualizer(self):
raise RDDLRepoUnresolvedDependency(viz_backend_package_name + " is not installed")

path_to_viz = self.loc.split('/')
print(self.loc)
repo_root = path_to_viz.index('Archive')
path_to_viz = '.'.join(path_to_viz[repo_root:])
# repo_root = path_to_viz.index('rddlrepository')
path_to_viz = '.'.join(path_to_viz[repo_root-1:])
viz = None
viz_info = self.viz
if viz_info:
module, viz_class_name = viz_info.strip().split('.')
viz_package_name = path_to_viz + '.' + module
print(viz_package_name, viz_class_name)
viz_package = __import__(viz_package_name, {}, {}, viz_class_name)
viz = getattr(viz_package, viz_class_name)
return viz
8 changes: 6 additions & 2 deletions rddlrepository/Manager/RDDLRepoManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import importlib
import csv

from .ErrorHandling import RDDLRepoDomainNotExist, RDDLRepoProblemDuplication
from .ErrorHandling import RDDLRepoDomainNotExist, RDDLRepoProblemDuplication, RDDLRepoManifestEmpty
from .ProblemInfo import ProblemInfo

HEADER = ['name', 'description', 'location', 'instances', 'viz']
Expand All @@ -19,12 +19,16 @@ def __init__(self, rebuild=False):
self._build_repo() # build repo and load to dict

def list_problems(self):
if len(self.archiver_dict) == 0:
raise RDDLRepoManifestEmpty()
for key, values in self.archiver_dict.items():
print(key + ": " + values[1])

def get_problem(self, name):
if name in self.archiver_dict.keys():
return ProblemInfo(self.archiver_dict[name])
else:
raise RDDLRepoDomainNotExist('Domain: ' + name + ' does not exists in the repository')

def _build_repo(self):
root_path = os.path.dirname(os.path.abspath(__file__))
Expand All @@ -46,7 +50,7 @@ def _build_repo(self):
continue
if "__init__.py" in files:
d = dir.split('/')
module = 'Archive' + '.'.join(d)
module = 'rddlrepository.Archive' + '.'.join(d)
mymodule = importlib.import_module(module)
if mymodule.info['name'] in self.archiver_dict.keys():
raise RDDLRepoProblemDuplication()
Expand Down
73 changes: 0 additions & 73 deletions rddlrepository/Manager/manifest.csv

This file was deleted.

23 changes: 21 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,30 @@
# along with rddlrepository. If not, see <https://opensource.org/licenses/MIT>.

from setuptools import setup, find_packages
import os
import glob


# def package_files(directory):
# paths = []
# for (path, directories, filenames) in os.walk(directory):
# for filename in filenames:
# paths.append(os.path.join('..', path, filename))
# return paths
#
# data_files = package_files('Archive')
# print(data_files)
# data_files = []
# directories = glob.glob('Archive/')
# for directory in directories:
# files = glob.glob(directory+'*')
# data_files.append((directory, files))
# print(files)


setup(
name='rddlrepository',
version='0.1',
version='0.20',
author="Ayal Taitler, Scott Sanner, Michael Gimelfarb",
author_email="[email protected], [email protected], [email protected]",
description="Home for all things RDDL",
Expand All @@ -26,7 +46,6 @@
install_requires=['pillow>=9.2.0', 'matplotlib>=3.5.0', 'numpy>=1.22'],
python_requires=">=3.8",
include_package_data=True,
package_data={'': [ ]},
classifiers=[
"Development Status :: 3 - Alpha",
"Intended Audience :: Science/Research",
Expand Down

0 comments on commit cebd1cb

Please sign in to comment.