Skip to content

Commit 5238d5c

Browse files
authored
Merge pull request #6 from pathsim/feat/pyodide-compat
Gate jsbsim behind sys_platform marker for Pyodide compatibility
2 parents 6ce68c1 + bc9d8f0 commit 5238d5c

2 files changed

Lines changed: 16 additions & 5 deletions

File tree

pyproject.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,11 @@ dependencies = [
2929
"pathsim",
3030
"numpy>=1.15",
3131
"scipy>=1.2",
32-
"jsbsim>=1.2.4"
32+
# JSBSim ships native code that can't be installed in Pyodide. The
33+
# marker resolves to a normal eager install on every real platform and
34+
# is skipped on Emscripten so the pure-Python parts of the toolbox
35+
# (`pathsim_flight.atmosphere`, `.utils`) still install in the browser.
36+
"jsbsim>=1.2.4; sys_platform != 'emscripten'",
3337
]
3438

3539
[project.optional-dependencies]

src/pathsim_flight/__init__.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,14 @@
1212

1313
__all__ = ["__version__"]
1414

15-
# For direct block import from main package
16-
from .atmosphere import *
17-
from .jsbsim import *
18-
from .utils import *
15+
# Pure-Python submodules — eager.
16+
from .atmosphere import * # noqa: F401,F403
17+
from .utils import * # noqa: F401,F403
18+
19+
# `jsbsim` wraps the native JSBSim Python bindings, which can't load in
20+
# Pyodide. Re-export the wrapper only when the import succeeds; on a normal
21+
# pip install it loads eagerly.
22+
try:
23+
from .jsbsim import * # noqa: F401,F403
24+
except ImportError:
25+
pass

0 commit comments

Comments
 (0)