diff --git a/arcade/__init__.py b/arcade/__init__.py index e10cf5a079..dbf9f2bad7 100644 --- a/arcade/__init__.py +++ b/arcade/__init__.py @@ -192,10 +192,12 @@ def configure_logging(level: int | None = None): from .tilemap import load_tilemap from .tilemap import TileMap -if sys.platform != "emscripten": +try: from .pymunk_physics_engine import PymunkPhysicsEngine from .pymunk_physics_engine import PymunkPhysicsObject from .pymunk_physics_engine import PymunkException +except ImportError: + pass from .version import VERSION diff --git a/arcade/hitbox/__init__.py b/arcade/hitbox/__init__.py index d8881c4bff..01086e7a9b 100644 --- a/arcade/hitbox/__init__.py +++ b/arcade/hitbox/__init__.py @@ -1,7 +1,6 @@ from PIL.Image import Image from arcade.types import Point2List -from arcade.utils import is_pyodide from .base import HitBox, HitBoxAlgorithm, RotatableHitBox from .bounding_box import BoundingHitBoxAlgorithm @@ -10,12 +9,15 @@ #: The simple hit box algorithm. algo_simple = SimpleHitBoxAlgorithm() -#: The detailed hit box algorithm. -if not is_pyodide(): +#: The detailed hit box algorithm. This depends on pymunk and will fallback to the simple algorithm. +try: from .pymunk import PymunkHitBoxAlgorithm - algo_detailed = PymunkHitBoxAlgorithm() +except ImportError: + print("WARNING: Running without PyMunk. The detailed hitbox algorithm will fallback to simple") + algo_detailed = SimpleHitBoxAlgorithm() + #: The bounding box hit box algorithm. algo_bounding_box = BoundingHitBoxAlgorithm() diff --git a/pyproject.toml b/pyproject.toml index ec18226f4f..dc46ffefff 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -21,8 +21,7 @@ classifiers = [ ] dependencies = [ "pyglet==3.0.dev1", - "pillow~=12.0.0", - "pymunk~=7.2.0", + "pillow>=11.3.0", "pytiled-parser~=2.2.9", ] dynamic = ["version"] @@ -36,6 +35,9 @@ Source = "https://github.com/pythonarcade/arcade" Book = "https://learn.arcade.academy" [dependency-groups] +extras = [ + "pymunk~=7.2.0" +] # Used for dev work dev = [ "sphinx==8.1.3", # April 2024 | Updated 2024-07-15, 7.4+ is broken with sphinx-autobuild @@ -62,8 +64,10 @@ dev = [ "click==8.1.7", # Temp fix until we bump typer "typer==0.12.5", # Needed for make.py "wheel", - "bottle" # Used for web testing playground + "bottle", # Used for web testing playground + {include-group = "extras"} ] + # Testing only testing_libraries = ["pytest", "pytest-mock", "pytest-cov", "pyyaml==6.0.1"] diff --git a/webplayground/example.tpl b/webplayground/example.tpl index 1288c96c7e..1c686f9e61 100644 --- a/webplayground/example.tpl +++ b/webplayground/example.tpl @@ -4,7 +4,7 @@
% title = name.split(".")[-1]