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
52 changes: 44 additions & 8 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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')
Expand All @@ -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
Expand Down Expand Up @@ -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:
Expand All @@ -88,8 +118,14 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04, windows-2022]
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13', '3.14']
# 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:
Expand All @@ -99,7 +135,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
Expand Down
37 changes: 32 additions & 5 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ 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
- name: Setup Python 3.x
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: |
Expand All @@ -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
Expand Down Expand Up @@ -69,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/*
23 changes: 18 additions & 5 deletions docs/changelog.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,33 @@
# Changelog

## 1.2.0 (unreleased)
## 1.3.0 (unreleased)

### 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).
- **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
Expand Down
2 changes: 1 addition & 1 deletion docs/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []
Expand Down
2 changes: 1 addition & 1 deletion pythonfmu3/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "1.2.0"
__version__ = "1.3.0"
4 changes: 2 additions & 2 deletions pythonfmu3/pythonfmu-export/src/shim/shim_loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -83,7 +83,7 @@ std::vector<std::string> 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");
Expand Down
Loading