From 4d7a1bb94dd72afd2dbf8d753984d304eb5835b2 Mon Sep 17 00:00:00 2001 From: Stephen Smith Date: Tue, 17 Nov 2026 21:19:29 +0000 Subject: [PATCH 1/4] Build and test on macOS in CI The wrapper is now built on a macos-15 runner for Apple Silicon (natively) and Intel (cross-compiled with CMAKE_OSX_ARCHITECTURES), deployment target 11.0, so the PyPI packages include aarch64-darwin and x86_64-darwin binaries. CI checks the wheel contains all four platforms and runs the tests on macOS (Python 3.10-3.14). The release workflow builds the same binaries. --- .github/workflows/main.yml | 47 +++++++++++++++++++++++++++++------ .github/workflows/publish.yml | 28 +++++++++++++++++---- docs/changelog.md | 3 +++ 3 files changed, 66 insertions(+), 12 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e628e24..72828bc 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -14,7 +14,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-22.04, windows-2022] + os: [ubuntu-22.04, windows-2022, macos-15] steps: - uses: actions/checkout@v4 @@ -23,7 +23,7 @@ jobs: uses: actions/setup-python@v5 with: python-version: '3.x' - architecture: 'x64' + architecture: ${{ runner.os == 'macOS' && 'arm64' || 'x64' }} - name: Compile wrapper on Windows if: startsWith(runner.os, 'Windows') @@ -34,13 +34,31 @@ jobs: cmake --build . --config Release cd .. - - name: Compile wrapper on Linux / macOS - if: startsWith(runner.os, 'Linux') || startsWith(runner.os, 'macOS') + - name: Compile wrapper on Linux + if: runner.os == 'Linux' run: | docker build -f DockerFile -t pythonfmu3-wrapper --target build . + - name: Compile wrapper on macOS (Apple Silicon and Intel) + if: runner.os == 'macOS' + run: | + # One runner builds both architectures: arm64 natively, x86_64 by cross-compiling. + # CMake puts each in its FMI platform folder (aarch64-darwin, x86_64-darwin). + for arch in arm64 x86_64; do + cmake -S pythonfmu3/pythonfmu-export -B build-$arch -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_OSX_ARCHITECTURES=$arch -DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 + cmake --build build-$arch --config Release + done + for platform in aarch64-darwin x86_64-darwin; do + for lib in libpythonfmu-export.dylib libpythonfmu-backend.dylib; do + test -f pythonfmu3/resources/binaries/$platform/$lib || { echo "missing $platform/$lib"; exit 1; } + done + done + lipo -archs pythonfmu3/resources/binaries/aarch64-darwin/libpythonfmu-export.dylib + lipo -archs pythonfmu3/resources/binaries/x86_64-darwin/libpythonfmu-export.dylib + - name: Create container and copy out artifact - if : startsWith(runner.os, 'Linux') || startsWith(runner.os, 'macOS') + if: runner.os == 'Linux' run: | docker create --name extract pythonfmu3-wrapper docker cp extract:/io/pythonfmu3/resources $GITHUB_WORKSPACE/pythonfmu3 @@ -76,6 +94,18 @@ jobs: python -m pip install build python -m build + - name: Check the wheel has every platform's binaries + run: | + python - <<'PY' + import glob, zipfile + wheel = glob.glob("dist/*.whl")[0] + names = zipfile.ZipFile(wheel).namelist() + expected = ["x86_64-linux", "x86_64-windows", "aarch64-darwin", "x86_64-darwin"] + missing = [p for p in expected if not any(n.startswith(f"pythonfmu3/resources/binaries/{p}/") for n in names)] + print(wheel, "missing:", missing or "none") + raise SystemExit(1 if missing else 0) + PY + - name: Archive production artifacts uses: actions/upload-artifact@v4 with: @@ -88,8 +118,11 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-22.04, windows-2022] + os: [ubuntu-22.04, windows-2022, macos-15] python-version: ['3.9', '3.10', '3.11', '3.12', '3.13', '3.14'] + exclude: + - os: macos-15 # setup-python has no arm64 build of Python 3.9 + python-version: '3.9' timeout-minutes: 15 steps: @@ -99,7 +132,7 @@ jobs: uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - architecture: 'x64' + architecture: ${{ runner.os == 'macOS' && 'arm64' || 'x64' }} - name: Download python package uses: actions/download-artifact@v4 diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 0ca1e21..47e4033 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -10,7 +10,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-22.04, windows-2022] + os: [ubuntu-22.04, windows-2022, macos-15] steps: - uses: actions/checkout@v4 @@ -18,7 +18,7 @@ jobs: uses: actions/setup-python@v5 with: python-version: '3.x' - architecture: 'x64' + architecture: ${{ runner.os == 'macOS' && 'arm64' || 'x64' }} - name: Compile wrapper on Windows if: startsWith(runner.os, 'Windows') run: | @@ -27,13 +27,31 @@ jobs: cmake $Env:github_workspace/pythonfmu3/pythonfmu-export -DCMAKE_BUILD_TYPE=Release -A x64 cmake --build . --config Release cd .. - - name: Compile wrapper on Linux / macOS - if: startsWith(runner.os, 'Linux') || startsWith(runner.os, 'macOS') + - name: Compile wrapper on Linux + if: runner.os == 'Linux' run: | docker build -f DockerFile -t pythonfmu3-wrapper --target build . + - name: Compile wrapper on macOS (Apple Silicon and Intel) + if: runner.os == 'macOS' + run: | + # One runner builds both architectures: arm64 natively, x86_64 by cross-compiling. + # CMake puts each in its FMI platform folder (aarch64-darwin, x86_64-darwin). + for arch in arm64 x86_64; do + cmake -S pythonfmu3/pythonfmu-export -B build-$arch -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_OSX_ARCHITECTURES=$arch -DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 + cmake --build build-$arch --config Release + done + for platform in aarch64-darwin x86_64-darwin; do + for lib in libpythonfmu-export.dylib libpythonfmu-backend.dylib; do + test -f pythonfmu3/resources/binaries/$platform/$lib || { echo "missing $platform/$lib"; exit 1; } + done + done + lipo -archs pythonfmu3/resources/binaries/aarch64-darwin/libpythonfmu-export.dylib + lipo -archs pythonfmu3/resources/binaries/x86_64-darwin/libpythonfmu-export.dylib + - name: Create container and copy out artifact - if : startsWith(runner.os, 'Linux') || startsWith(runner.os, 'macOS') + if: runner.os == 'Linux' run: | docker create --name extract pythonfmu3-wrapper docker cp extract:/io/pythonfmu3/resources $GITHUB_WORKSPACE/pythonfmu3 diff --git a/docs/changelog.md b/docs/changelog.md index 315e524..b909dd4 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -3,6 +3,9 @@ ## 1.2.0 (unreleased) ### Added +- **macOS binaries:** the PyPI packages now include the native library for Apple Silicon + (`aarch64-darwin`) and Intel Macs (`x86_64-darwin`), so FMUs build on macOS without + compiling anything. CI also runs the tests on macOS. - **MCP server for AI agents** (`pythonfmu3 mcp`): Claude, GitHub Copilot in VS Code, Cursor and other MCP clients can write, check, simulate and build FMUs, using the same checks and simulators as the Studio. Install with `pip install "pythonfmu3[mcp]"` From 7325882ea7a2b89f9b655280cd24b4a87239de53 Mon Sep 17 00:00:00 2001 From: Stephen Smith Date: Tue, 17 Nov 2026 21:33:45 +0000 Subject: [PATCH 2/4] Test supported Python versions only Python 3.9 and 3.10 have reached end of life and 3.15 is out. Run every supported version (3.11-3.15) on Linux, and the oldest and newest on Windows and macOS: 9 test jobs instead of 17. --- .github/workflows/main.yml | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 72828bc..070bfe2 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -118,11 +118,14 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-22.04, windows-2022, macos-15] - python-version: ['3.9', '3.10', '3.11', '3.12', '3.13', '3.14'] - exclude: - - os: macos-15 # setup-python has no arm64 build of Python 3.9 - python-version: '3.9' + # Every supported Python on Linux; the oldest and newest on Windows and macOS. + os: [ubuntu-22.04] + python-version: ['3.11', '3.12', '3.13', '3.14', '3.15'] + include: + - {os: windows-2022, python-version: '3.11'} + - {os: windows-2022, python-version: '3.15'} + - {os: macos-15, python-version: '3.11'} + - {os: macos-15, python-version: '3.15'} timeout-minutes: 15 steps: From 02145cb722a1d5da77044164799d2b5cd15a41d4 Mon Sep 17 00:00:00 2001 From: Stephen Smith Date: Tue, 17 Nov 2026 21:39:20 +0000 Subject: [PATCH 3/4] Check release wheels for binaries; look for newer Pythons The release workflow now refuses to upload a wheel that is missing binaries for any of x86_64-linux, x86_64-windows, aarch64-darwin or x86_64-darwin. The libpython search used by native importers now covers Python 3.8 to 3.20, so 3.15 and later are found by name. Adds the Python 3.15 classifier. --- .github/workflows/publish.yml | 9 +++++++++ docs/install.md | 2 +- pyproject.toml | 1 + pythonfmu3/pythonfmu-export/src/shim/shim_loader.cpp | 4 ++-- 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 47e4033..cd8e272 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -87,4 +87,13 @@ jobs: TWINE_PASSWORD: ${{ secrets.PYPI_PYTHONFMU_API_TOKEN }} run: | python -m build + python - <<'PY' + import glob, zipfile + wheel = glob.glob("dist/*.whl")[0] + names = zipfile.ZipFile(wheel).namelist() + expected = ["x86_64-linux", "x86_64-windows", "aarch64-darwin", "x86_64-darwin"] + missing = [p for p in expected if not any(n.startswith(f"pythonfmu3/resources/binaries/{p}/") for n in names)] + print(wheel, "missing binaries:", missing or "none") + raise SystemExit(1 if missing else 0) + PY twine upload dist/* diff --git a/docs/install.md b/docs/install.md index e539a76..2af2e5f 100644 --- a/docs/install.md +++ b/docs/install.md @@ -49,7 +49,7 @@ this order: `export PYTHONFMU_PYTHON_LIBRARY=/usr/lib/x86_64-linux-gnu/libpython3.12.so.1.0`; 2. the library of the Python that built the FMU (recorded in `resources/pythonfmu_libpython.txt`); -3. standard library names for Python 3.8 to 3.14 (and the usual Homebrew and +3. standard library names for Python 3.8 to 3.20, newest first (and the usual Homebrew and python.org framework locations on macOS). If none can be loaded, instantiation fails with a message listing the paths tried. diff --git a/pyproject.toml b/pyproject.toml index 1ff0587..2395cd7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -30,6 +30,7 @@ classifiers = [ "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", "Programming Language :: Python :: 3.14", + "Programming Language :: Python :: 3.15", "Topic :: Scientific/Engineering", ] dependencies = [] diff --git a/pythonfmu3/pythonfmu-export/src/shim/shim_loader.cpp b/pythonfmu3/pythonfmu-export/src/shim/shim_loader.cpp index ab09d26..c1d848c 100644 --- a/pythonfmu3/pythonfmu-export/src/shim/shim_loader.cpp +++ b/pythonfmu3/pythonfmu-export/src/shim/shim_loader.cpp @@ -15,7 +15,7 @@ // - the PYTHONFMU_PYTHON_LIBRARY environment variable (a full path), // - resources/pythonfmu_libpython.txt (written by the builder: the library of the // Python that built the FMU, one candidate path per line), -// - common library names for Python 3.8 - 3.14. +// - common library names for Python 3.8 - 3.20 (newest first). #include "shim/shim_loader.hpp" @@ -83,7 +83,7 @@ std::vector libpythonCandidates(const std::string& resources) if (!line.empty()) candidates.push_back(line); } } - for (int minor = 14; minor >= 8; --minor) { + for (int minor = 20; minor >= 8; --minor) { const std::string v = "3." + std::to_string(minor); #ifdef __APPLE__ candidates.push_back("libpython" + v + ".dylib"); From 93203092bc24ea3be22a6fafd6e990aed24debb5 Mon Sep 17 00:00:00 2001 From: Stephen Smith Date: Tue, 17 Nov 2026 21:56:09 +0000 Subject: [PATCH 4/4] Prepare 1.3.0 1.2.0 was released with the MCP server only, so date its changelog entry and move Jupyter support, llms.txt and the macOS binaries to 1.3.0, with the docs and CI changes. Version 1.3.0. --- docs/changelog.md | 26 ++++++++++++++++++-------- pythonfmu3/_version.py | 2 +- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/docs/changelog.md b/docs/changelog.md index b909dd4..add1d6d 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -1,23 +1,33 @@ # Changelog -## 1.2.0 (unreleased) +## 1.3.0 (unreleased) ### Added -- **macOS binaries:** the PyPI packages now include the native library for Apple Silicon - (`aarch64-darwin`) and Intel Macs (`x86_64-darwin`), so FMUs build on macOS without - compiling anything. CI also runs the tests on macOS. -- **MCP server for AI agents** (`pythonfmu3 mcp`): Claude, GitHub Copilot in VS Code, - Cursor and other MCP clients can write, check, simulate and build FMUs, using the same - checks and simulators as the Studio. Install with `pip install "pythonfmu3[mcp]"` - (Python 3.10+). See [AI agents (MCP)](mcp.md). - **Jupyter support** (`%load_ext pythonfmu3`): the `%%fmu` cell magic saves, checks and displays a model; `simulate()` returns pandas DataFrames; `build()` builds the FMU; and `pythonfmu3.notebook.FMU` inspects and simulates any FMU. Install with `pip install "pythonfmu3[notebook]"`. See [Jupyter notebooks](notebooks.md) and `examples/notebooks/getting_started.ipynb`. +- **macOS binaries:** the PyPI packages now include the native library for Apple Silicon + (`aarch64-darwin`) and Intel Macs (`x86_64-darwin`), so FMUs build on macOS without + compiling anything. CI also runs the tests on macOS. - `llms.txt` and `llms-full.txt` on the documentation site, so AI assistants can learn the PythonFMU3 API and its rules. +### Changed +- Clearer documentation: a variables guide (causality and variability), what the importer + calls in your class, build options, per-platform installation, and dependencies. +- CI tests every supported Python version (3.11 to 3.15) on Linux, and the oldest and + newest on Windows and macOS. + +## 1.2.0 (2026-11-16) + +### Added +- **MCP server for AI agents** (`pythonfmu3 mcp`): Claude, GitHub Copilot in VS Code, + Cursor and other MCP clients can write, check, simulate and build FMUs, using the same + checks and simulators as the Studio. Install with `pip install "pythonfmu3[mcp]"` + (Python 3.10+). See [AI agents (MCP)](mcp.md). + ## 1.1.0 (2026-11-14) ### Added diff --git a/pythonfmu3/_version.py b/pythonfmu3/_version.py index c68196d..67bc602 100644 --- a/pythonfmu3/_version.py +++ b/pythonfmu3/_version.py @@ -1 +1 @@ -__version__ = "1.2.0" +__version__ = "1.3.0"