Skip to content
Merged
Show file tree
Hide file tree
Changes from 56 commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
2a439b4
updates for using cmakeupdates
sjunges Jun 1, 2025
c94cecd
Merge branch 'setup' into scikit
sjunges Jun 1, 2025
22d7b51
version and rpath
sjunges Jun 2, 2025
95304a4
for fetch, storm has gspn, dft, pars, etc.
sjunges Jun 3, 2025
c295c19
add cibuldwheel example
lukovdm Jun 3, 2025
55aa1fc
new pybind version
lukovdm Jun 3, 2025
b22248f
disable patch pybind
lukovdm Jun 3, 2025
679f399
add dependecy installs to linux wheel
lukovdm Jun 3, 2025
3f72b84
fix dep in wheel
lukovdm Jun 3, 2025
76400d4
test
lukovdm Jun 3, 2025
320bc56
test
lukovdm Jun 3, 2025
9b43d41
disable patch pybind
lukovdm Jun 3, 2025
25d62de
add macos deps
lukovdm Jun 3, 2025
6b374b2
better linux and macos setup
lukovdm Jun 3, 2025
166b152
make before all linux executable
lukovdm Jun 3, 2025
a569f8e
fix xcode issues and use old boost
lukovdm Jun 3, 2025
97ca9d8
fix macos xcode version
lukovdm Jun 3, 2025
3ba9235
fix xcode again and change repair wheel for linux
lukovdm Jun 4, 2025
7553edd
fix macos-arm hopefully
lukovdm Jun 4, 2025
7b29574
fix macos
lukovdm Jun 4, 2025
fd87cda
change xcode version on arm
lukovdm Jun 4, 2025
b794de5
remove compat again from macos
lukovdm Jun 4, 2025
b4c3b2a
fix portable
lukovdm Jun 4, 2025
14f38f4
change xcode repair command
lukovdm Jun 4, 2025
064d386
add cmake portable args and move to pyproject.toml
lukovdm Jun 4, 2025
63c1ba0
remove universal arch
lukovdm Jun 4, 2025
e01ecc4
change python version
lukovdm Jun 5, 2025
4aa7697
debug repair wheel info
lukovdm Jun 5, 2025
5c9076d
better debug
lukovdm Jun 5, 2025
2451d5f
better debug linux
lukovdm Jun 6, 2025
007da3b
also run repair
lukovdm Jun 6, 2025
9cd8dd2
update storm version for fetch
sjunges Jun 6, 2025
61c9058
updates rpath
sjunges Jun 6, 2025
81b068e
Merge branch 'scikit' of github.com:sjunges/stormpy into cibuildwheel
lukovdm Jun 6, 2025
ca71e7f
Merge pull request #1 from lukovdm/cibuildwheel
sjunges Jun 6, 2025
59c1175
update rpaths
sjunges Jun 6, 2025
1392502
Merge branch 'scikit' of https://github.com/sjunges/stormpy into scikit
sjunges Jun 6, 2025
8b66a2a
update storm version to one without binaries
sjunges Jun 6, 2025
8ac3e2c
Merge branch 'master' into scikit
sjunges Jun 6, 2025
a418583
new storm version
sjunges Jun 6, 2025
f1903f3
Merge branch 'scikit' of https://github.com/sjunges/stormpy into scikit
sjunges Jun 6, 2025
29d55a8
some updates after a succesful run
sjunges Jun 6, 2025
4745894
only x86, reduce python versions to build quicker
sjunges Jun 6, 2025
cfc2931
update xcode version to 15.4
sjunges Jun 6, 2025
e8f999b
also use another macosx version for arm
sjunges Jun 6, 2025
5e6ed29
skip musl on linux for now
sjunges Jun 7, 2025
0378680
fix
sjunges Jun 7, 2025
5ff6f02
dependency vars
sjunges Jun 7, 2025
1a89e53
skip musl in toml file
sjunges Jun 7, 2025
4ea6af2
macosx target updated
sjunges Jun 7, 2025
d858f88
allow spot, always fetch
sjunges Jun 9, 2025
0037d39
use newest storm
sjunges Jun 9, 2025
105ad7d
test wheel in distros
lukovdm Jun 10, 2025
10b5742
correct docker testing of wheels
lukovdm Jun 10, 2025
0012936
fix matrix distro
lukovdm Jun 10, 2025
cdc6f7b
change distros
lukovdm Jun 11, 2025
0189eaa
Allow Storm system version, storm dir hint and reverted to old pybind…
volkm Jun 12, 2025
ca92bbf
Small changes in wheelpypi CI
volkm Jun 12, 2025
f9c6750
Use pybind version 2.12.1
volkm Jun 12, 2025
112bfa4
Add numpy as dependency to tests
volkm Jun 12, 2025
7d07cbb
Merge pull request #2 from lukovdm/cibuildwheel
sjunges Jun 14, 2025
59af011
better todo message
sjunges Jun 14, 2025
db2d839
Merge branch 'scikit' of https://github.com/sjunges/stormpy into scikit
sjunges Jun 14, 2025
7c4a2e9
Run wheelpyip tests weekly
volkm Jun 16, 2025
4048267
Updated Dockerfiles
volkm Jun 16, 2025
473e933
ALLOW_STORM_SYSTEM=ON
volkm Jun 16, 2025
07840d0
Consistent naming in buildtest
volkm Jun 16, 2025
f3baf1d
CI tests for fetching Storm
volkm Jun 16, 2025
0a0dab5
Wheel tests for macOS
volkm Jun 16, 2025
fcbcd1e
Set correct deploy target in wheelpypi
volkm Jun 17, 2025
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
34 changes: 34 additions & 0 deletions .github/workflows/before-all-linux.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash

# Inspired by build process of spead2

set -e -u

sccache_version=0.10.0
boost_version=1.88.0
boost_version_under=${boost_version//./_}
ginac_version=1.8.9

dnf install -y boost-devel cln-devel gmp-devel glpk-devel hwloc-devel z3-devel xerces-c-devel eigen3-devel # missing ginac and boost

cd /tmp

# Install sccache
curl -fsSLO https://github.com/mozilla/sccache/releases/download/v${sccache_version}/sccache-v${sccache_version}-$(arch)-unknown-linux-musl.tar.gz
tar -zxf sccache-v${sccache_version}-$(arch)-unknown-linux-musl.tar.gz
cp sccache-v${sccache_version}-$(arch)-unknown-linux-musl/sccache /usr/bin

## Install boost
#curl -fsSLO https://archives.boost.io/release/${boost_version}/source/boost_${boost_version_under}.tar.bz2
#tar -jxf boost_${boost_version_under}.tar.bz2
## Quick-n-dirty approach (much faster than doing the install, which copies thousands of files)
#ln -s /tmp/boost_${boost_version_under}/boost /usr/include/boost

# Install ginac

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why can we not use the ginac package from the package manager?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We probably can, but the general advice seems to be to not use brew (and similar things hold for other package managers).

https://cibuildwheel.pypa.io/en/stable/faq/#missing-dependencies

I think having the ability to build a version from source is probably good in terms of flexibility here.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, so we should try to not rely on homebrew. In this case, I suggest that we also try to build cln manually, and maybe some other libraries if needed.

curl -fsSLO https://www.ginac.de/ginac-${ginac_version}.tar.bz2
tar -jxf ginac-${ginac_version}.tar.bz2
cd ginac-${ginac_version}
export CXXFLAGS="-Wall -O2"
./configure
make
make install
82 changes: 82 additions & 0 deletions .github/workflows/wheelpypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: Build and upload to PyPI

on:
workflow_dispatch:
pull_request:
push:
release:
types:
- published

jobs:
build_wheels:
name: Build wheels for ${{ matrix.os }}
runs-on: ${{ matrix.runs-on }}
strategy:
matrix:
os: [ linux-intel, macos-intel, macos-arm ]
include:
# Set defaults
- archs: auto
platform: auto
xcode: ""
- os: linux-intel
runs-on: ubuntu-latest
archs: x86_64
- os: macos-intel
runs-on: macos-13 # macos-13 was the last x86_64 runner
xcode: 14.3
- os: macos-arm
runs-on: macos-14 # macos-14+ (including latest) are ARM64 runners
xcode: 15.3
fail-fast: false

steps:
- uses: actions/checkout@v4
- uses: maxim-lobanov/setup-xcode@v1
if: ${{ matrix.xcode != '' }}
with:
xcode-version: ${{ matrix.xcode }}
- name: Build wheels
uses: pypa/cibuildwheel@v3.0.0b5
env:
CIBW_PLATFORM: ${{ matrix.platform }}
CIBW_ARCHS: ${{ matrix.archs }}
MACOSX_DEPLOYMENT_TARGET: 14.0
- uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
path: ./wheelhouse/*.whl

build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build sdist
run: pipx run build --sdist
- uses: actions/upload-artifact@v4
with:
name: cibw-sdist
path: dist/*.tar.gz

upload_pypi:
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
environment: pypi
permissions:
id-token: write
if: github.event_name == 'release' && github.event.action == 'published'
# or, alternatively, upload to PyPI on every tag starting with 'v' (remove on: release above to use this)
# if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/download-artifact@v4
with:
# unpacks all CIBW artifacts into dist/
pattern: cibw-*
path: dist
merge-multiple: true

- uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
103 changes: 60 additions & 43 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,31 +1,23 @@
cmake_minimum_required(VERSION 3.15)
cmake_minimum_required(VERSION 3.24)

# Scikit-build-core sets these values
project(
${SKBUILD_PROJECT_NAME}
VERSION ${SKBUILD_PROJECT_VERSION}
LANGUAGES CXX
LANGUAGES CXX C
)

set(CMAKE_CXX_STANDARD 20)

# include(FetchContent)
# Set configurations
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/macros.cmake)

# FetchContent_Declare(
# storm
# GIT_REPOSITORY https://github.com/moves-rwth/storm.git
# GIT_BRANCH master
# OVERRIDE_FIND_PACKAGE
# )
# message(Callign make available)
# FetchContent_MakeAvailable(storm)
# message(Done with make)
set(CMAKE_CXX_STANDARD 20)

# Configuration options
set(PYBIND_VERSION "" CACHE STRING "Pybind11 version to use")
MARK_AS_ADVANCED(PYBIND_VERSION)
set(STORM_DIR_HINT "" CACHE STRING "A hint where the Storm library can be found.")
set(CARL_DIR_HINT "" CACHE STRING "A hint where the Carl library can be found.")
option(ALLOW_STORM_SYSTEM "Allow finding a storm version on the system" OFF)
option(ALLOW_STORM_FETCH "Allow fetching storm" ON)
option(USE_STORM_DFT "Enable support for DFTs" ON)
option(USE_STORM_GSPN "Enable support for GSPNs" ON)
option(USE_STORM_PARS "Enable support for parametric models" ON)
Expand All @@ -41,7 +33,6 @@ mark_as_advanced(COMPILE_WITH_CCACHE)
# Find the module development requirements (requires FindPython from 3.17 or scikit-build-core's built-in backport)
find_package(Python REQUIRED COMPONENTS Interpreter Development.Module)
include(resources/include_pybind11.cmake)
#find_package(pybind11 ${PYBIND_VERSION} EXACT CONFIG REQUIRED)
message(STATUS "Stormpy - Using pybind11 version ${pybind11_VERSION}")

# Helper function to print path where library was found and check whether hint was used
Expand All @@ -64,26 +55,53 @@ function(check_hint NAME DIR_FOUND HINT_DIR FOUND_VERSION)
endif()
endfunction(check_hint)

# Find Storm
set(STORM_MIN_VERSION "1.10.0")
find_package(storm REQUIRED HINTS ${STORM_DIR_HINT})
check_hint("Storm" ${storm_DIR} "${STORM_DIR_HINT}" ${storm_VERSION})
# Check Storm version
if (${storm_VERSION} VERSION_LESS ${STORM_MIN_VERSION})
MESSAGE(FATAL_ERROR "Stormpy - Storm version ${storm_VERSION} from ${storm_DIR} is not supported anymore!\nStormpy requires at least Storm version >= ${STORM_MIN_VERSION}.\nFor more information, see https://moves-rwth.github.io/stormpy/installation.html#compatibility-of-stormpy-and-storm")
endif()

# Find carl-storm and (optionally) carl-parser
find_package(carl REQUIRED HINTS ${CARL_DIR_HINT})
check_hint("carl" ${carl_DIR} "${CARL_DIR_HINT}" ${carl_VERSION})
if(ALLOW_STORM_SYSTEM)
set(STORM_MIN_VERSION "1.9.1")
find_package(storm REQUIRED HINTS ${STORM_DIR_HINT})
check_hint("Storm" ${storm_DIR} "${STORM_DIR_HINT}" ${storm_VERSION})
# Check Storm version
if (${storm_VERSION} VERSION_LESS ${STORM_MIN_VERSION})
MESSAGE(FATAL_ERROR "Stormpy - Storm version ${storm_VERSION} from ${storm_DIR} is not supported anymore!\nStormpy requires at least Storm version >= ${STORM_MIN_VERSION}.\nFor more information, see https://moves-rwth.github.io/stormpy/installation.html#compatibility-of-stormpy-and-storm")
endif()

# Set dependency variables
set_dependency_var(SPOT)
set_dependency_var(XERCES)
# Check for optional Storm libraries
storm_with_lib(DFT)
storm_with_lib(GSPN)
storm_with_lib(PARS)
storm_with_lib(POMDP)
endif ()
if (NOT storm_FOUND AND ALLOW_STORM_FETCH)
include(FetchContent)
SET(FETCHCONTENT_QUIET OFF)
SET(STORM_BUILD_EXECUTABLES OFF)
FetchContent_Declare(
storm
GIT_REPOSITORY https://github.com/sjunges/storm.git
GIT_TAG 7be4a3f79a12a967d33cf2c0e112672d4a72a276 #
#SOURCE_DIR /Users/junges/storm/
)
FETCHCONTENT_MAKEAVAILABLE(storm)
include(${storm_BINARY_DIR}/stormOptions.cmake)
set(HAVE_STORM_DFT TRUE)
set(HAVE_STORM_GSPN TRUE)
set(HAVE_STORM_PARS TRUE)
set(HAVE_STORM_POMDP TRUE)
# Set dependency variables
set_dependency_var(SPOT)
set_dependency_var(XERCES)
endif()

find_package(carlparser QUIET HINTS ${CARLPARSER_DIR_HINT})
if (carlparser_FOUND)
check_hint("carl-parser" ${carlparser_DIR} "${CARLPARSER_DIR_HINT}" "")
endif()

# Set variables
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/lib/stormpy")

# This sets interprocedural optimization off as this leads to some problems on some systems
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION OFF)
# This sets the default visibility from hidden to default,
Expand All @@ -96,13 +114,20 @@ SET(CMAKE_SKIP_BUILD_RPATH FALSE)
# when building, don't use the install RPATH already (but only when installing)
SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
# the RPATH to be used when installing
SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
# don't add the automatically determined parts of the RPATH
if(APPLE)
set(RELPOS_STRING "@loader_path")
else()
set(RELPOS_STRING "$ORIGIN")
endif()
SET(CMAKE_INSTALL_RPATH "${RELPOS_STRING}/../../../lib/storm;${RELPOS_STRING}/../../../lib/storm/resources;${RELPOS_STRING}/../../lib/storm;${RELPOS_STRING}/../../lib/storm/resources;${RELPOS_STRING}/../lib/storm;${RELPOS_STRING}/../lib/storm/resources;${RELPOS_STRING}/lib/storm;${RELPOS_STRING}/lib/storm/resources;${RELPOS_STRING};${RELPOS_STRING}/resources")
# add the automatically determined parts of the RPATH
# which point to directories outside the build tree to the install RPATH
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
SET(CMAKE_BUILD_RPATH_USE_ORIGIN TRUE)


# Workaround for issue with Boost >= 1.81
# TODO is this still necessary?
Comment thread
sjunges marked this conversation as resolved.
Outdated
find_package(Boost 1.65.1 QUIET REQUIRED COMPONENTS filesystem system)
if (Boost_FOUND)
if (${Boost_VERSION} VERSION_GREATER_EQUAL "1.81.0")
Expand All @@ -127,11 +152,7 @@ else()
endif()


# Set configurations
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/macros.cmake)

set(STORM_VERSION ${storm_VERSION})
set(CARL_VERSION ${carl_VERSION})
# Set number types from Carl
set_variable_string(STORM_USE_CLN_EA_BOOL ${STORM_USE_CLN_EA})
set_variable_string(STORM_USE_CLN_RF_BOOL ${STORM_USE_CLN_RF})
Expand Down Expand Up @@ -160,17 +181,13 @@ else()
endif()
set_variable_string(CARL_WITH_PARSER ${PYCARL_HAS_PARSE})
# Check support for CLN
set(PYCARL_HAS_CLN ((USE_CLN_NUMBERS) AND (CARL_USE_CLN_NUMBERS)))
if(STORM_USE_CLN_EA OR STORM_USE_CLN_RF)
set(PYCARL_HAS_CLN ON)
else()
set(PYCARL_HAS_CLN OFF)
endif()
set_variable_string(CARL_WITH_CLN ${PYCARL_HAS_CLN})

# Set dependency variables
set_dependency_var(SPOT)
set_dependency_var(XERCES)
# Check for optional Storm libraries
storm_with_lib(DFT)
storm_with_lib(GSPN)
storm_with_lib(PARS)
storm_with_lib(POMDP)
# Set optional library variables
set_optional_lib_var(DFT)
set_optional_lib_var(GSPN)
Expand Down
1 change: 0 additions & 1 deletion cmake/pycarl_core_config.py.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# Auto-generated by CMake.

CARL_VERSION = "@CARL_VERSION@"
CARL_WITH_PARSER = @CARL_WITH_PARSER@
CARL_WITH_CLN = @CARL_WITH_CLN@
8 changes: 0 additions & 8 deletions lib/stormpy/pycarl/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,6 @@
from . import infinity
from stormpy.pycarl import _config

__version__ = "unknown"
try:
from ._version import __version__
except ImportError:
# We're running in a tree that doesn't have a _version.py, so we don't know what our version is.
pass

inf = infinity.Infinity()

Expand Down Expand Up @@ -46,8 +40,6 @@ def print_info():
"""
Print information about pycarl.
"""
print("Pycarl version {}".format(__version__))
print("Using carl in version {}".format(carl_version()))
print("Support for CLN: {}".format(has_cln()))
print("Support for parsing: {}".format(has_parser()))

Expand Down
27 changes: 21 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ readme = "README.md"
license.file = "LICENSE"
dynamic = ["version"]
authors = [
{ name = "S. Junges", email = "sjunges@cs.ru.nl" },
{ name = "S. Junges", email = "sebastian.junges@ru.nl" },
{ name = "M. Volk", email = "m.volk@tue.nl" }
]
requires-python = ">=3.7"
requires-python = ">=3.9"
dependencies = [
"Deprecated",
]
Expand Down Expand Up @@ -50,6 +50,7 @@ dev = [
test = [
"pytest",
"nbval",
"numpy",
]

[tool.scikit-build]
Expand All @@ -75,9 +76,10 @@ sdist.include = [
]

[tool.scikit-build.cmake.define]
PYBIND_VERSION="2.10.0"
PYBIND_VERSION="2.12.1"
STORM_DIR_HINT=""
CARL_DIR_HINT=""
ALLOW_STORM_SYSTEM="ON"
ALLOW_STORM_FETCH="ON"
USE_STORM_DFT="ON"
USE_STORM_GSPN="ON"
USE_STORM_PARS="ON"
Expand All @@ -92,11 +94,24 @@ STORMPY_DISABLE_SIGNATURE_DOC="OFF"
provider = "scikit_build_core.metadata.regex"
input = "lib/stormpy/_version.py"

[tool.cibuildwheel]
manylinux-x86_64-image = "manylinux_2_34"
skip = "*musllinux*"

[tool.cibuildwheel.linux]
before-all = ".github/workflows/before-all-linux.sh"
repair-wheel-command = "auditwheel show --disable-isa-ext-check {wheel} && auditwheel repair --disable-isa-ext-check -w {dest_dir} {wheel}"

[tool.cibuildwheel.macos]
before-all = "brew install ccache automake boost cln ginac glpk hwloc z3 xerces-c"
repair-wheel-command = "delocate-listdeps -vv --depending --all {wheel} && DYLD_LIBRARY_PATH=$REPAIR_LIBRARY_PATH delocate-wheel --require-archs {delocate_archs} -w {dest_dir} -v {wheel}"

[tool.cibuildwheel.config-settings]
"cmake.args" = ["-DSTORM_PORTABLE=ON", "-DALLOW_STORM_SYSTEM='OFF'"]

[tool.black]
line-length = 160
target-version = [
"py37",
"py38",
"py39",
"py310",
"py311",
Expand Down
1 change: 0 additions & 1 deletion resources/include_pybind11.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ FetchContent_Declare(
pybind11
GIT_REPOSITORY https://github.com/pybind/pybind11
GIT_TAG "v${PYBIND_VERSION}"
PATCH_COMMAND git apply ${CMAKE_CURRENT_SOURCE_DIR}/resources/pybind11_${PYBIND_VERSION}.patch || git apply ${CMAKE_CURRENT_SOURCE_DIR}/resources/pybind11_${PYBIND_VERSION}.patch --reverse --check
)

FetchContent_MakeAvailable(pybind11)
Expand Down
Loading