Skip to content
Open
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
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
12 changes: 8 additions & 4 deletions .github/workflows/pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@ jobs:
fetch-depth: 0

- uses: pypa/cibuildwheel@v3.4.1

with:
package-dir: pycode/memilio-simulation

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

build_sdist:
runs-on: ubuntu-latest
Expand All @@ -33,12 +35,14 @@ jobs:
with:
fetch-depth: 0

- run: pipx run build --sdist
- run: |
cd pycode/memilio-simulation
pipx run build --sdist

- 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]
Expand Down
10 changes: 0 additions & 10 deletions CMakeLists.txt

This file was deleted.

9 changes: 9 additions & 0 deletions pycode/memilio-simulation/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
cmake_minimum_required(VERSION 3.14)
project(memilio-python)

set(CMAKE_CXX_STANDARD "20")
set(CMAKE_CXX_STANDARD_REQUIRED "20")

option(MEMILIO_USE_BUNDLED_PYBIND11 "Use pybind11 bundled with this library." ON)
mark_as_advanced(MEMILIO_USE_BUNDLED_PYBIND11)

Expand Down Expand Up @@ -48,6 +54,9 @@ else()
find_package(pybind11 REQUIRED)
endif()

# add in C++ library
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../../cpp ${CMAKE_CURRENT_BINARY_DIR}/cpp EXCLUDE_FROM_ALL)

# a list of all "LINKED_LIBRARIES" that are given to add_pymio_module. will contain duplicates
# used for wheel installation
set(PYMIO_MEMILIO_LIBS_LIST)
Expand Down
63 changes: 63 additions & 0 deletions pycode/memilio-simulation/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
[build-system]
requires = [
"scikit-build-core>=0.9.0",
"setuptools>=68",
"setuptools-scm>=8",
"wheel"
]
build-backend = "scikit_build_core.build"

[project]
name = "memilio-simulation"
dynamic = ["version"]
description = "Part of MEmilio project, Python bindings to the C++ libraries that contain the models and simulations."
readme = "README.md"
requires-python = ">=3.8"
license = "Apache-2.0"
authors = [{ name = "MEmilio Team" }]
maintainers = [
{ email = "martin.kuehn@dlr.de" }
]
dependencies = [
# smaller numpy versions cause a security issue, 1.25 does not work together with pyfakefs
"numpy>=1.22,!=1.25.*",
# smaller pandas versions contain a bug that sometimes prevents reading
"pandas>=2.0.0"
]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Natural Language :: English",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Operating System :: POSIX :: Linux",
"Operating System :: Microsoft :: Windows"
]

[project.optional-dependencies]
dev = []

[project.urls]
Homepage = "https://github.com/SciCompMod/memilio"
Team = "https://memilio.readthedocs.io/en/latest/team.html"

[tool.scikit-build]
cmake.version = ">=3.13"
cmake.args = ["-DMEMILIO_BUILD_SHARED_LIBS:BOOL=ON"]
wheel.packages = ["memilio"]
wheel.install-dir = "memilio/simulation"
build-dir = "../build/memilio-simulation"
metadata.version.provider = "scikit_build_core.metadata.setuptools_scm"

[tool.setuptools_scm]
local_scheme = "no-local-version"
# point scm to the git project root
root = "../.."

[tool.cibuildwheel]
# Disable some wheels
skip = ["pp*", "*musllinux*", "*-win32", "cp314*"]
63 changes: 0 additions & 63 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,66 +1,3 @@
[project]
# Note that this file is only installing the memilio-simulation package. For installing the other Python packages,
# please go to the respective folder pycode/memilio-* and install from there.
name = "memilio-simulation"
dynamic = ["version"]
description = "Part of MEmilio project, Python bindings to the C++ libraries that contain the models and simulations."
readme = "README.md"
requires-python = ">=3.9"
license = "Apache-2.0"
authors = [{ name = "MEmilio Team" }]
maintainers = [
{ email = "martin.kuehn@dlr.de" }
]
dependencies = [
# smaller numpy versions cause a security issue, 1.25 does not work together with pyfakefs
"numpy>=1.22,!=1.25.*",
# smaller pandas versions contain a bug that sometimes prevents reading
"pandas>=2.0.0"
]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Natural Language :: English",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Operating System :: POSIX :: Linux",
"Operating System :: Microsoft :: Windows"
]

[project.optional-dependencies]
dev = []

[project.urls]
Homepage = "https://github.com/SciCompMod/memilio"
Team = "https://memilio.readthedocs.io/en/latest/team.html"

[build-system]
requires = [
"scikit-build-core>=0.9.0",
"setuptools>=68",
"setuptools-scm>=8",
"wheel"
]
build-backend = "scikit_build_core.build"

[tool.scikit-build]
cmake.version = ">=3.13"
cmake.args = ["-DMEMILIO_BUILD_SHARED_LIBS:BOOL=ON"]
wheel.packages = ["pycode/memilio-simulation/memilio"]
wheel.install-dir = "memilio/simulation"
build-dir = "pycode/build/memilio-simulation"
metadata.version.provider = "scikit_build_core.metadata.setuptools_scm"

[tool.setuptools_scm]
local_scheme = "no-local-version"

[tool.cibuildwheel]
# Disable some wheels
skip = ["pp*", "*musllinux*", "*-win32", "cp314*"]

[tool.autopep8]
max-line-length = 79

Expand Down
Loading