Skip to content
Open
Show file tree
Hide file tree
Changes from 9 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
37 changes: 13 additions & 24 deletions .github/actions/build-py/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,29 +16,22 @@ runs:
- name: Make artifact dir
shell: bash
run: |
if [ "${{ inputs.package }}" != "simulation" ]; then
cd pycode/memilio-${{ inputs.package }}/
# else stay in root directory
fi
cd pycode/memilio-${{ inputs.package }}/
mkdir wheelhouse
- name: Build Python Wheels
shell: bash
run: |
if [ "${{ inputs.package }}" != "simulation" ]; then
cd pycode/memilio-${{ inputs.package }}/
# else stay in root directory
fi
/opt/python/cp39-cp39/bin/python -m pip install --upgrade pip setuptools wheel
/opt/python/cp313-cp313/bin/python -m pip install --upgrade pip setuptools wheel
/opt/python/cp39-cp39/bin/python -m pip install scikit-build scikit-build-core
/opt/python/cp313-cp313/bin/python -m pip install scikit-build scikit-build-core
# Install setuptools-scm only for memilio-simulation
if [ "${{ inputs.package }}" == "simulation" ]; then
/opt/python/cp39-cp39/bin/python -m pip install setuptools-scm
/opt/python/cp313-cp313/bin/python -m pip install setuptools-scm
fi
/opt/python/cp39-cp39/bin/python -m build --no-isolation --wheel
/opt/python/cp313-cp313/bin/python -m build --no-isolation --wheel
cd pycode/memilio-${{ inputs.package }}/
# install dependencies and build wheels with specified python versions
for python_cmd in /opt/python/cp39-cp39/bin/python /opt/python/cp313-cp313/bin/python
do
$python_cmd -m pip install --upgrade pip setuptools wheel
$python_cmd -m pip install scikit-build scikit-build-core
if [ "${{ inputs.package }}" == "simulation" ]
then $python_cmd -m pip install setuptools-scm
fi
$python_cmd -m build --no-isolation --wheel
done
# Exclude memilio-generation, because its a pure python package, cmake is only used in the build process to retrieve data from cpp
if [[ -f "CMakeLists.txt" ]] && [ "${{ inputs.package }}" != "generation" ]; then
# includes native dependencies in the wheel
Expand All @@ -47,11 +40,7 @@ runs:
# no auditwheel necessary for pure python packages, so only copy the wheels to the same output directory
cp dist/*.whl wheelhouse
fi
if [ "${{ inputs.package }}" != "simulation" ]; then
cp -r wheelhouse ..
else
cp -r wheelhouse pycode
fi
cp -r wheelhouse ..
- name: Upload Python Wheels
uses: actions/upload-artifact@v7
with:
Expand Down
48 changes: 31 additions & 17 deletions .github/workflows/pypi.yml
Original file line number Diff line number Diff line change
@@ -1,52 +1,66 @@
name: PyPI

on:
release:
types:
on:
release:
types:
- published
### Uncomment the "push:" together with the "repository-url:" field of action pypa/gh-action-pypi-publish
### to make a test release. Building this is rather expensive so do not merge this uncommented!
#push:
### @Reviewer: MAKE SURE THE LINE ABOVE IS COMMENTED OUT BEFORE MERGE! ###

jobs:

build_wheels:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-2025-vs2026]
os: [ubuntu-latest, windows-2025-vs2026, macos-26]
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v6
- name: "Checkout"
uses: actions/checkout@v6
with:
fetch-depth: 0

- uses: pypa/cibuildwheel@v3.4.1
- name: "Build Wheels"
uses: pypa/cibuildwheel@v3.4.1
with:
package-dir: pycode/memilio-simulation

- uses: actions/upload-artifact@v7
- name: "Upload Artifacts"
uses: actions/upload-artifact@v7
with:
name: cibw-wheels-${{ matrix.os }}
path: ./wheelhouse/*.whl
path: wheelhouse/*.whl

build_sdist:
build_sdist:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v6
- name: "Checkout"
uses: actions/checkout@v6
with:
fetch-depth: 0

- run: pipx run build --sdist
- name: "Build Source Distribution"
run: |
cd pycode/memilio-simulation
pipx run build --sdist

- uses: actions/upload-artifact@v7
- name: "Upload Artifacts"
uses: actions/upload-artifact@v7
with:
name: cibw-sdist
path: dist/*.tar.gz
path: pycode/memilio-simulation/dist/*.tar.gz

upload_pypi:
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
environment: pypi
permissions:
id-token: write

steps:
- uses: actions/download-artifact@v7
with:
Expand All @@ -58,5 +72,5 @@ jobs:
- uses: pypa/gh-action-pypi-publish@release/v1
with:
skip-existing: true
# To test uploads to TestPyPI, uncomment the following:
# repository-url: https://test.pypi.org/legacy/
### To test uploads to TestPyPI in a PR, uncomment the following, as well as the "push:" line at the top:
#repository-url: https://test.pypi.org/legacy/
10 changes: 0 additions & 10 deletions CMakeLists.txt

This file was deleted.

2 changes: 1 addition & 1 deletion cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
"-Wno-unknown-warning-option;-Wno-deprecated;-Wno-gnu-zero-variadic-macro-arguments;")
endif()

# woyrkarounds for compiler bugs or overzealous optimization/analysis
# workarounds for compiler bugs or overzealous optimization/analysis
if(CMAKE_BUILD_TYPE STREQUAL "Release" OR CMAKE_BUILD_TYPE STREQUAL "RELEASE")
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
string(APPEND MEMILIO_CXX_FLAGS_ENABLE_WARNING_ERRORS
Expand Down
1 change: 0 additions & 1 deletion cpp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ Options can be specified with `cmake .. -D<OPTION>=<VALUE>` or by editing the `b
- `MEMILIO_BUILD_TESTS`: build unit tests in the test directory, ON or OFF, default ON.
- `MEMILIO_BUILD_EXAMPLES`: build the example applications in the examples directory, ON or OFF, default ON.
- `MEMILIO_BUILD_MODELS`: build the separate model libraries in the models directory, ON or OFF, default ON.
- `MEMILIO_BUILD_SIMULATIONS`: build the simulation applications in the simulations directory, ON or OFF, default ON.
- `MEMILIO_USE_BUNDLED_SPDLOG/_BOOST/_EIGEN/_JSONCPP`: use the corresponding dependency bundled with this project, ON or OFF, default ON.
- `MEMILIO_BUILD_BENCHMARKS`: build the benchmarks for this project, ON or OFF, default OFF.
- `MEMILIO_SANITIZE_ADDRESS/_UNDEFINED`: compile with specified sanitizers to check correctness, ON or OFF, default OFF.
Expand Down
4 changes: 2 additions & 2 deletions docs/source/cpp/cpp_makros_preprocessing.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Configuration macros
-------------------
--------------------

MEmilio provides several compile-time configuration options through CMake that control which features and dependencies are available during compilation. These configurations are defined as preprocessor macros and can be used to conditionally compile code sections based on available libraries and enabled features.
The following macros are automatically defined by CMake during the build process based on the availability of dependencies and build options:
Expand All @@ -22,7 +22,7 @@ The following macros are automatically defined by CMake during the build process
- Defined when profiling support is enabled. Activates performance monitoring and timing instrumentation throughout the codebase.

Usage in Code
^^^^^^^^^^^^^^
^^^^^^^^^^^^^

These macros are used with preprocessor conditionals to enable or disable specific functionality. You should use these macros to ensure that your code can compile and run correctly depending on the available libraries and features.
When using these macros, you should always consider fallbacks or alternative implementations when a feature is not available. This ensures that your code remains robust and can handle cases where optional dependencies are not present.
Expand Down
1 change: 1 addition & 0 deletions docs/source/cpp/glct.rst
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ The initial conditions of the model are represented by a class ``LctPopulations`


.. _Nonpharmaceutical Interventions GLCT:

Nonpharmaceutical interventions
-------------------------------

Expand Down
5 changes: 1 addition & 4 deletions docs/source/cpp/ide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ start time of the simulation.


.. _Nonpharmaceutical Interventions IDE:

Nonpharmaceutical interventions
-------------------------------

Expand Down Expand Up @@ -150,7 +151,3 @@ List of models

models/isecir
models/iseir




Loading