Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 3 additions & 1 deletion arcade/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
10 changes: 6 additions & 4 deletions arcade/hitbox/__init__.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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()
Expand Down
10 changes: 7 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand All @@ -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
Expand All @@ -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"]

Expand Down
7 changes: 3 additions & 4 deletions webplayground/example.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<head>
% title = name.split(".")[-1]
<title>{{title}}</title>
<script src="https://cdn.jsdelivr.net/pyodide/v0.28.1/full/pyodide.js"></script>
<script src="https://cdn.jsdelivr.net/pyodide/v0.29.0/full/pyodide.js"></script>
</head>

<body>
Expand All @@ -13,9 +13,8 @@
let pyodide = await loadPyodide();
await pyodide.loadPackage("micropip");
const micropip = pyodide.pyimport("micropip");
await pyodide.loadPackage("pillow"); // Arcade needs Pillow
await micropip.install("pyglet==3.0.dev1", pre=true)
await micropip.install("http://localhost:8000/static/{{arcade_wheel}}");
await pyodide.loadPackage("pillow");
await micropip.install("http://localhost:8000/static/{{arcade_wheel}}", pre=true);

// We are importing like this because some example files have numbers in the name, and you can't use those in normal import statements
pyodide.runPython(`
Expand Down
2 changes: 1 addition & 1 deletion webplayground/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def main():

# Go to arcade and build a wheel
os.chdir(path_arcade)
subprocess.run(["python", "-m", "build", "--wheel", "--outdir", "dist"])
subprocess.run(["uv", "build"])
os.chdir(here)
shutil.copy(path_arcade_wheel, f"./{arcade_wheel_filename}")

Expand Down
Loading