diff --git a/MANIFEST.in b/MANIFEST.in index 3c75c97..0d43b96 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,6 +1,18 @@ +# Include the CMakeLists.txt file include CMakeLists.txt + +# Recursively include everything in the src directory recursive-include src * + +# Include all files in the environments, config, and scenarios directories within the magent2 package +recursive-include magent2/environments * +recursive-include magent2/config * +recursive-include magent2/scenarios * + +# Include dynamic library files include *.dylib include *.dll include *.so + +# Include gif files include *.gif diff --git a/docs/scripts/gen_mds.py b/docs/scripts/gen_mds.py index 7364cc9..30d3448 100644 --- a/docs/scripts/gen_mds.py +++ b/docs/scripts/gen_mds.py @@ -43,11 +43,7 @@ f"{file_name}.md", ) - front_matter = f"""--- -autogenerated: -title: {file_name} ---- -""" + front_matter = f"---\n" f"autogenerated: \n" f"title: {file_name}\n" f"---\n" title = f"# {file_name}" if docstring is None or docstring == "": diff --git a/magent2/gridworld.py b/magent2/gridworld.py index 6d96329..5e19dcd 100644 --- a/magent2/gridworld.py +++ b/magent2/gridworld.py @@ -912,4 +912,4 @@ def __init__(self, radius, angle): raise Exception("the angle of a sector should be smaller than 180 degree") def __str__(self): - return f"sector({self.radius:g}, {self.angle:g})" + return f"sector({self.radius: g}, {self.angle: g})" diff --git a/setup.py b/setup.py index 71116c6..3048f2f 100644 --- a/setup.py +++ b/setup.py @@ -118,4 +118,6 @@ def build_extensions(self): packages=setuptools.find_packages(), ext_modules=[CMakeExtension("magent2.libmagent", ".", [])], cmdclass={"build_ext": CMakeBuild}, + package_data={"magent2": ["environments/*", "config/*", "scenarios/*"]}, + include_package_data=True, ) diff --git a/tests/test_magent2.py b/tests/test_magent2.py new file mode 100644 index 0000000..8f4b44d --- /dev/null +++ b/tests/test_magent2.py @@ -0,0 +1,27 @@ +import importlib + +import magent2 + + +def test_version(): + assert hasattr(magent2, "__version__"), "Version should not be None" + assert isinstance(magent2.__version__, str), "Version should be a string" + + +def test_import_environments(): + envs = [ + "adversarial_pursuit_v4", + "battle_v4", + "battlefield_v5", + "combined_arms_v6", + "gather_v5", + "magent_env", + "tiger_deer_v4", + ] + + for env in envs: + try: + # Dynamically import the environment module + importlib.import_module(f"magent2.environments.{env}") + except ImportError: + assert False, f"{env} should be importable"