Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update setup.py and MANIFEST.in to include environment files and add … #38

Merged
merged 4 commits into from
Aug 16, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -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

# Include gif files
include *.gif
7 changes: 7 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,4 +118,11 @@ def build_extensions(self):
packages=setuptools.find_packages(),
ext_modules=[CMakeExtension("magent2.libmagent", ".", [])],
cmdclass={"build_ext": CMakeBuild},
install_requires=[
'pettingzoo',
mwydmuch marked this conversation as resolved.
Show resolved Hide resolved
],
package_data={
'magent2': ['environments/*', 'config/*', 'scenarios/*']
},
include_package_data=True,
)
36 changes: 36 additions & 0 deletions tests/test_magent2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import magent2
import pettingzoo
import importlib

envs = [
"adversarial_pursuit_v4",
"battle_v4",
"battlefield_v5",
"combined_arms_v6",
"gather_v5",
"magent_env",
"tiger_deer_v4",
]

for env in envs:
mwydmuch marked this conversation as resolved.
Show resolved Hide resolved
try:
# Dynamically import the environment module
module = importlib.import_module(f"magent2.environments.{env}")
except ImportError:
assert False, f"{env} should be importable"


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():
# These assert statements check if the imported modules are not None
assert importlib.import_module("magent2.environments.adversarial_pursuit_v4") is not None, "adversarial_pursuit_v4 should be importable"
assert importlib.import_module("magent2.environments.battle_v4") is not None, "battle_v4 should be importable"
assert importlib.import_module("magent2.environments.battlefield_v5") is not None, "battlefield_v5 should be importable"
assert importlib.import_module("magent2.environments.combined_arms_v6") is not None, "combined_arms_v6 should be importable"
assert importlib.import_module("magent2.environments.gather_v5") is not None, "gather_v5 should be importable"
assert importlib.import_module("magent2.environments.magent_env") is not None, "magent_env should be importable"
assert importlib.import_module("magent2.environments.tiger_deer_v4") is not None, "tiger_deer_v4 should be importable"