Skip to content

Commit b7901a3

Browse files
marcelwaactions-userpre-commit-ci[bot]
authored
🏗️ Switch the pyfiction build system from raw setuptools to scikit-build-core (cda-tum#592)
* 🏗️ Switch to `scikit-build` for *pyfiction*. Works almost. Still need to figure out how to deal with Z3. * 🏗️ Add `__init__.py` file content for inclusion of symbols * 💚 Fixed Z3 detection and inclusion with scikit-build * ✅ Use explicit includes for all tests * 💚 Add missing `try_z3.cpp` file * 🔥 Remove `python-dotenv` dependency * 💚 Fix sdist build * 💚 Fix compile target * 🔧 Added `uv.lock` file * 💚 Attempt to fix CI and CD * 💚 Create `venv` before build * 💚 Replace `_a` literals with `py::arg` function calls * 🔥 Remove `FICTION_BENCHMARK` build toggle since it depends on `FICTION_TEST`, which is already set to `OFF` * 🔧 Update CMake version compatibility list * 📝 Update pyfiction docstrings Signed-off-by: GitHub Actions <[email protected]> * 💚 Fix `unittest` discovery by setting starting path * 💚 Set up `nox` for testing the bindings * 🔧 Exclude the newly added `try_z3.cpp` from `clang-tidy` checks * 💚 Fix Z3 setup * 💚 Remove Windows version flag in CMake * 💚 Fixed paths in the pyfiction docstring generator * 💚 Updated pyfiction docstrings and removed fragment left in the wrong location * 📝 Update pyfiction docstrings Signed-off-by: GitHub Actions <[email protected]> * 📌 Sync the dependency versions with `main` * 🎨 Incorporated pre-commit fixes * 📝 Update pyfiction docstrings Signed-off-by: GitHub Actions <[email protected]> * 🐛 Fixed remaining `pybind11_mkdoc_docstrings.hpp` paths * 💚 Set up MSVC environment * 💚 Fix type conversion issue * ✅ Added missing import statements * 📝 Update documentation on Python bindings (skip ci) * 🎨 Adjusted `__init__.py` file for consistency --------- Signed-off-by: GitHub Actions <[email protected]> Co-authored-by: GitHub Actions <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 0dffdc5 commit b7901a3

File tree

214 files changed

+3096
-1381
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

214 files changed

+3096
-1381
lines changed

.clang-tidy

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ CheckOptions:
4242
- key: cppcoreguidelines-avoid-do-while.IgnoreMacros
4343
value: "true"
4444
- key: misc-include-cleaner.IgnoreHeaders
45-
value: ".*/experiments.hpp;.*/fiction_experiments.hpp;.*/fmt/.*"
45+
value: "cmake/try_z3.cpp;.*/experiments.hpp;.*/fiction_experiments.hpp;.*/fmt/.*"
4646
- key: readability-identifier-naming.NamespaceCase
4747
value: lower_case
4848
- key: readability-identifier-naming.ClassCase

.github/workflows/clang-tidy-review.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
- '**/*.cpp'
88
- 'libs/**'
99
- '.github/workflows/clang-tidy-review.yml'
10-
- '!bindings/pyfiction/include/pyfiction/pybind11_mkdoc_docstrings.hpp'
10+
- '!bindings/mnt/pyfiction/include/pyfiction/pybind11_mkdoc_docstrings.hpp'
1111

1212
concurrency:
1313
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}

.github/workflows/codeql-analysis.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ on:
1111
- '**/*.py'
1212
- 'libs/**'
1313
- '.github/workflows/codeql-analysis.yml'
14-
- '!bindings/pyfiction/include/pyfiction/pybind11_mkdoc_docstrings.hpp'
14+
- '!bindings/mnt/pyfiction/include/pyfiction/pybind11_mkdoc_docstrings.hpp'
1515
pull_request:
1616
branches: [ 'main' ]
1717
paths:
@@ -22,7 +22,7 @@ on:
2222
- '**/*.py'
2323
- 'libs/**'
2424
- '.github/workflows/codeql-analysis.yml'
25-
- '!bindings/pyfiction/include/pyfiction/pybind11_mkdoc_docstrings.hpp'
25+
- '!bindings/mnt/pyfiction/include/pyfiction/pybind11_mkdoc_docstrings.hpp'
2626
merge_group:
2727
schedule:
2828
- cron: '30 5 * * 6'

.github/workflows/coverage.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ on:
1010
- '**/CMakeLists.txt'
1111
- 'libs/**'
1212
- '.github/workflows/coverage.yml'
13-
- '!bindings/pyfiction/include/pyfiction/pybind11_mkdoc_docstrings.hpp'
13+
- '!bindings/mnt/pyfiction/include/pyfiction/pybind11_mkdoc_docstrings.hpp'
1414
pull_request:
1515
branches: [ 'main' ]
1616
paths:
@@ -20,7 +20,7 @@ on:
2020
- '**/CMakeLists.txt'
2121
- 'libs/**'
2222
- '.github/workflows/coverage.yml'
23-
- '!bindings/pyfiction/include/pyfiction/pybind11_mkdoc_docstrings.hpp'
23+
- '!bindings/mnt/pyfiction/include/pyfiction/pybind11_mkdoc_docstrings.hpp'
2424
merge_group:
2525

2626
concurrency:

.github/workflows/docker-image.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ on:
1212
- '.github/workflows/docker-image.yml'
1313
- 'Dockerfile'
1414
- '.dockerignore'
15-
- '!bindings/pyfiction/include/pyfiction/pybind11_mkdoc_docstrings.hpp'
15+
- '!bindings/mnt/pyfiction/include/pyfiction/pybind11_mkdoc_docstrings.hpp'
1616
pull_request:
1717
branches: [ 'main' ]
1818
paths:
@@ -24,7 +24,7 @@ on:
2424
- '.github/workflows/docker-image.yml'
2525
- 'Dockerfile'
2626
- '.dockerignore'
27-
- '!bindings/pyfiction/include/pyfiction/pybind11_mkdoc_docstrings.hpp'
27+
- '!bindings/mnt/pyfiction/include/pyfiction/pybind11_mkdoc_docstrings.hpp'
2828
merge_group:
2929
workflow_dispatch:
3030
release:

.github/workflows/macos.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ on:
1010
- '**/CMakeLists.txt'
1111
- 'libs/**'
1212
- '.github/workflows/macos.yml'
13-
- '!bindings/pyfiction/include/pyfiction/pybind11_mkdoc_docstrings.hpp'
13+
- '!bindings/mnt/pyfiction/include/pyfiction/pybind11_mkdoc_docstrings.hpp'
1414
pull_request:
1515
branches: [ 'main' ]
1616
paths:
@@ -20,7 +20,7 @@ on:
2020
- '**/CMakeLists.txt'
2121
- 'libs/**'
2222
- '.github/workflows/macos.yml'
23-
- '!bindings/pyfiction/include/pyfiction/pybind11_mkdoc_docstrings.hpp'
23+
- '!bindings/mnt/pyfiction/include/pyfiction/pybind11_mkdoc_docstrings.hpp'
2424
merge_group:
2525

2626
concurrency:

.github/workflows/pyfiction-docstring-generator.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -37,20 +37,20 @@ jobs:
3737
run: >
3838
python3
3939
-m pybind11_mkdoc
40-
-o ${{ github.workspace }}/bindings/pyfiction/include/pyfiction/pybind11_mkdoc_docstrings.hpp
40+
-o ${{ github.workspace }}/bindings/mnt/pyfiction/include/pyfiction/pybind11_mkdoc_docstrings.hpp
4141
-D FICTION_Z3_SOLVER
4242
`find ${{ github.workspace }}/include/fiction -name "*.hpp" -print`
4343
4444
- name: Upload docstrings as an artifact
4545
uses: actions/upload-artifact@v4
4646
with:
47-
path: ${{ github.workspace }}/bindings/pyfiction/include/pyfiction/pybind11_mkdoc_docstrings.hpp
47+
path: ${{ github.workspace }}/bindings/mnt/pyfiction/include/pyfiction/pybind11_mkdoc_docstrings.hpp
4848
overwrite: true
4949

5050
- name: Commit docstrings
5151
uses: EndBug/add-and-commit@v9
5252
with:
53-
add: 'bindings/pyfiction/include/pyfiction/pybind11_mkdoc_docstrings.hpp'
53+
add: 'bindings/mnt/pyfiction/include/pyfiction/pybind11_mkdoc_docstrings.hpp'
5454
commit: '--signoff'
5555
message: ':memo: Update pyfiction docstrings'
5656
author_name: GitHub Actions

.github/workflows/pyfiction-pypi-deployment.yml

+24-36
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ concurrency:
4545

4646
env:
4747
Z3_VERSION: 4.13.0
48-
ENABLE_Z3: 'ON'
4948

5049
jobs:
5150
build_wheels:
@@ -66,6 +65,9 @@ jobs:
6665
submodules: recursive
6766
fetch-depth: 0
6867

68+
- name: Set up MSVC development environment (Windows only)
69+
uses: ilammy/msvc-dev-cmd@v1
70+
6971
- name: Setup ccache
7072
uses: hendrikmuhs/[email protected]
7173
with:
@@ -84,24 +86,25 @@ jobs:
8486
env:
8587
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8688

89+
- name: Setup ccache
90+
uses: hendrikmuhs/[email protected]
91+
with:
92+
key: "${{matrix.config.os}}-pyfiction"
93+
save: true
94+
max-size: 10G
95+
8796
- if: runner.os == 'Linux'
8897
name: Setup mold
8998
uses: rui314/setup-mold@v1
9099

91-
- if: ${{ matrix.config.arch == 'arm64' }}
92-
name: Set Architecture to arm64 if necessary
93-
run: echo "CIBW_ARCHS_MACOS=arm64" >> $GITHUB_ENV
100+
- name: Install the latest version of uv
101+
uses: astral-sh/setup-uv@v3
102+
with:
103+
version: "latest"
104+
enable-cache: true
94105

95-
- name: Build wheel
96-
uses: pypa/[email protected]
97-
env:
98-
CIBW_BEFORE_ALL_LINUX: /opt/python/cp39-cp39/bin/pip install z3-solver==${{ env.Z3_VERSION }}
99-
CIBW_BUILD: ${{ matrix.python }}-*
100-
CIBW_ENVIRONMENT_MACOS: |
101-
MACOSX_DEPLOYMENT_TARGET=11.0
102-
SYSTEM_VERSION_COMPAT=0
103-
CIBW_TEST_EXTRAS: test
104-
CIBW_TEST_COMMAND: 'python -m unittest discover --start-directory {project} --verbose'
106+
- name: Build wheels
107+
uses: pypa/[email protected]
105108

106109
- name: Upload wheel as an artifact
107110
uses: actions/upload-artifact@v4
@@ -120,32 +123,17 @@ jobs:
120123
submodules: recursive
121124
fetch-depth: 0
122125

123-
- name: Setup ccache
124-
uses: hendrikmuhs/[email protected]
125-
with:
126-
key: 'ubuntu-latest-pyfiction'
127-
variant: ccache
128-
save: true
129-
max-size: 10G
130-
131-
- name: Setup Python
132-
uses: actions/setup-python@v5
126+
- name: Install the latest version of uv
127+
uses: astral-sh/setup-uv@v3
133128
with:
134-
python-version: '3.13.x'
135-
cache: 'pip'
136-
137-
- name: Setup Z3 Solver
138-
uses: cda-tum/setup-z3@v1
139-
with:
140-
version: ${{ env.Z3_VERSION }}
141-
env:
142-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
129+
version: "latest"
130+
enable-cache: true
143131

144132
- name: Build sdist
145-
run: pipx run build --sdist
133+
run: uv build --sdist
146134

147-
- name: Test sdist
148-
run: z3=${{env.ENABLE_Z3}} pip install dist/*.tar.gz --verbose
135+
- name: Check metadata
136+
run: uvx twine check dist/*
149137

150138
- name: Upload sdist as an artifact
151139
uses: actions/upload-artifact@v4

.github/workflows/python-bindings.yml

+17-37
Original file line numberDiff line numberDiff line change
@@ -38,49 +38,29 @@ defaults:
3838

3939
env:
4040
Z3_VERSION: 4.13.0
41-
ENABLE_Z3: 'ON'
4241

4342
jobs:
44-
build_and_test:
43+
python-tests:
44+
name: 🐍 ${{ matrix.runs-on }}
45+
runs-on: ${{ matrix.runs-on }}
4546
strategy:
47+
fail-fast: false
4648
matrix:
47-
os: [ ubuntu-22.04, macos-14, windows-2019 ]
48-
python_version: [ '3.8.x', '3.13.x' ]
49-
include:
50-
- os: ubuntu-22.04
51-
z3_platform: linux
52-
architecture: x64
53-
toolset: v142
54-
- os: macos-14
55-
z3_platform: macOS
56-
architecture: arm64
57-
- os: windows-2019
58-
z3_platform: windows
59-
architecture: x64
60-
61-
name: 🐍 on ${{matrix.os}} with Python ${{matrix.python_version}}
62-
runs-on: ${{matrix.os}}
63-
49+
runs-on: [ ubuntu-latest, macos-13, macos-14, windows-latest ]
6450
steps:
6551
- name: Clone Repository
6652
uses: actions/checkout@v4
6753
with:
6854
submodules: recursive
55+
fetch-depth: 0
6956

7057
- name: Setup ccache
7158
uses: hendrikmuhs/[email protected]
7259
with:
73-
key: '${{matrix.os}}-pyfiction'
74-
variant: ccache
60+
key: "${{matrix.runs-on}}-pyfiction"
7561
save: true
7662
max-size: 10G
7763

78-
- name: Setup Python
79-
uses: actions/setup-python@v5
80-
with:
81-
python-version: ${{matrix.python_version}}
82-
cache: 'pip'
83-
8464
- if: runner.os == 'Linux'
8565
name: Setup mold
8666
uses: rui314/setup-mold@v1
@@ -90,15 +70,15 @@ jobs:
9070
uses: cda-tum/setup-z3@v1
9171
with:
9272
version: ${{env.Z3_VERSION}}
93-
platform: ${{matrix.z3_platform}}
94-
architecture: ${{matrix.architecture}}
95-
env:
96-
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
9773

98-
- name: Build pyfiction
99-
working-directory: ${{github.workspace}}
100-
run: z3=${{env.ENABLE_Z3}} pip install '.[test]'
74+
- name: Install the latest version of uv
75+
uses: astral-sh/setup-uv@v3
76+
with:
77+
version: "latest"
78+
enable-cache: true
79+
80+
- name: Setup nox
81+
uses: wntrblm/[email protected]
10182

102-
- name: Test
103-
working-directory: ${{github.workspace}}
104-
run: python -m unittest discover --verbose
83+
- name: 🐍 Test
84+
run: nox -s tests --verbose

.github/workflows/ubuntu.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ on:
1010
- '**/CMakeLists.txt'
1111
- 'libs/**'
1212
- '.github/workflows/ubuntu.yml'
13-
- '!bindings/pyfiction/include/pyfiction/pybind11_mkdoc_docstrings.hpp'
13+
- '!bindings/mnt/pyfiction/include/pyfiction/pybind11_mkdoc_docstrings.hpp'
1414
pull_request:
1515
branches: [ 'main' ]
1616
paths:
@@ -20,7 +20,7 @@ on:
2020
- '**/CMakeLists.txt'
2121
- 'libs/**'
2222
- '.github/workflows/ubuntu.yml'
23-
- '!bindings/pyfiction/include/pyfiction/pybind11_mkdoc_docstrings.hpp'
23+
- '!bindings/mnt/pyfiction/include/pyfiction/pybind11_mkdoc_docstrings.hpp'
2424
merge_group:
2525

2626
concurrency:

.github/workflows/windows.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ on:
1010
- '**/CMakeLists.txt'
1111
- 'libs/**'
1212
- '.github/workflows/windows.yml'
13-
- '!bindings/pyfiction/include/pyfiction/pybind11_mkdoc_docstrings.hpp'
13+
- '!bindings/mnt/pyfiction/include/pyfiction/pybind11_mkdoc_docstrings.hpp'
1414
pull_request:
1515
branches: [ 'main' ]
1616
paths:
@@ -20,7 +20,7 @@ on:
2020
- '**/CMakeLists.txt'
2121
- 'libs/**'
2222
- '.github/workflows/windows.yml'
23-
- '!bindings/pyfiction/include/pyfiction/pybind11_mkdoc_docstrings.hpp'
23+
- '!bindings/mnt/pyfiction/include/pyfiction/pybind11_mkdoc_docstrings.hpp'
2424
merge_group:
2525

2626
concurrency:

.pre-commit-config.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ ci:
1111
autoupdate_commit_msg: "⬆️ Bump pre-commit hooks"
1212
autofix_commit_msg: "🎨 Incorporated pre-commit fixes"
1313

14-
exclude: "^libs/|^benchmarks/|bindings/pyfiction/include/pyfiction/pybind11_mkdoc_docstrings.hpp"
14+
exclude: "^libs/|^benchmarks/|bindings/mnt/pyfiction/include/pyfiction/pybind11_mkdoc_docstrings.hpp"
1515

1616
repos:
1717
# Standard hooks

CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Project (https://github.com/lefticus/cpp_starter_project) and CMake Template
33
# (https://github.com/cpp-best-practices/cmake_template)
44

5-
cmake_minimum_required(VERSION 3.21)
5+
cmake_minimum_required(VERSION 3.21...3.29)
66

77
# Only set the CMAKE_CXX_STANDARD if it is not set by someone else
88
if(NOT DEFINED CMAKE_CXX_STANDARD)

MANIFEST.in

-32
This file was deleted.

bindings/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
add_subdirectory(pyfiction)
1+
add_subdirectory(mnt)

bindings/mnt/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
add_subdirectory(pyfiction)

bindings/__init__.py bindings/mnt/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import sys
33
from pathlib import Path
44

5-
if sys.platform == "win32" and sys.version_info > (3, 8, 0) and "Z3_ROOT" in os.environ:
5+
if sys.platform == "win32" and "Z3_ROOT" in os.environ:
66
lib_path = Path(os.environ["Z3_ROOT"]) / "lib"
77
if lib_path.exists():
88
os.add_dll_directory(str(lib_path))

0 commit comments

Comments
 (0)