Skip to content

Commit 0443f22

Browse files
committed
Merge branch 'pr/ludmilaasb/3'
2 parents 77bc252 + 72356d5 commit 0443f22

265 files changed

Lines changed: 2705 additions & 67873 deletions

File tree

Some content is hidden

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

.devcontainer/Dockerfile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
FROM ghcr.io/astral-sh/uv:latest AS uv
2+
3+
FROM mcr.microsoft.com/devcontainers/base:2-ubuntu24.04
4+
5+
# install needed packages
6+
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
7+
&& apt-get -y install \
8+
build-essential \
9+
cmake \
10+
gcc \
11+
gdb \
12+
libgmp-dev \
13+
ninja-build
14+
15+
16+
COPY --from=uv --chown=vscode /uv /uvx /bin/

.devcontainer/devcontainer.json

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
{
2+
"name": "PauliEngine development environment",
3+
"build": {
4+
"dockerfile": "Dockerfile",
5+
"context": ".."
6+
},
7+
"capAdd": [
8+
"SYS_PTRACE"
9+
],
10+
"securityOpt": [
11+
"seccomp=unconfined"
12+
],
13+
"remoteUser": "vscode",
14+
"customizations": {
15+
"vscode": {
16+
"settings": {
17+
"python.defaultInterpreterPath": "${containerEnv:UV_PROJECT_ENVIRONMENT}/bin/python",
18+
"python.terminal.activateEnvInCurrentTerminal": true,
19+
"terminal.integrated.defaultProfile.linux": "zsh",
20+
"terminal.integrated.profiles.linux": {
21+
"zsh": {
22+
"path": "/bin/zsh"
23+
}
24+
}
25+
},
26+
"extensions": [
27+
"MS-vsliveshare.vsliveshare",
28+
"benjamin-simmonds.pythoncpp-debug",
29+
"charliermarsh.ruff",
30+
"cschlosser.doxdocgen",
31+
"ms-python.python",
32+
"ms-toolsai.jupyter",
33+
"ms-vscode.cmake-tools",
34+
"ms-vscode.cpptools",
35+
"ms-vscode.cpptools-themes",
36+
"mutantdino.resourcemonitor",
37+
"njpwerner.autodocstring",
38+
"streetsidesoftware.code-spell-checker",
39+
"streetsidesoftware.code-spell-checker-scientific-terms",
40+
"tamasfe.even-better-toml",
41+
"vivaxy.vscode-conventional-commits"
42+
]
43+
}
44+
},
45+
"containerEnv": {
46+
"PYTHONUNBUFFERED": "True",
47+
"WORKSPACE": "${containerWorkspaceFolder}",
48+
"UV_LINK_MODE": "copy",
49+
"UV_PROJECT_ENVIRONMENT": "/home/vscode/.venv"
50+
},
51+
"postCreateCommand": "./.devcontainer/postCreateCommand.sh",
52+
"postStartCommand": "./.devcontainer/postStartCommand.sh",
53+
"hostRequirements": {
54+
"cpus": 4,
55+
"memory": "6gb"
56+
}
57+
}

.devcontainer/postCreateCommand.sh

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/usr/bin/env bash
2+
3+
set -euxo pipefail
4+
5+
# install uv and uvx shell completions
6+
echo 'eval "$(uv generate-shell-completion zsh)"' >> /home/vscode/.zshrc
7+
echo 'eval "$(uvx --generate-shell-completion zsh)"' >> /home/vscode/.zshrc
8+
9+
# set up GDB to view contents of STL containers
10+
gcc_version="$(gcc --version | awk 'NR==1 {print $NF}')"
11+
cat <<EOT >> ~/.gdbinit
12+
python
13+
import sys
14+
sys.path.insert(0, "/usr/share/gcc-$gcc_version/python")
15+
from libstdcxx.v6.printers import register_libstdcxx_printers
16+
register_libstdcxx_printers (None)
17+
end
18+
EOT
19+
20+
# install conan
21+
uv venv
22+
source /home/vscode/.venv/bin/activate
23+
uv pip install conan
24+
25+
# setup conan profile and install dependencies
26+
conan profile detect --force
27+
conan install . --output-folder=build --build=missing -pr ./conan_profile

.devcontainer/postStartCommand.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/usr/bin/env bash
2+
3+
# install project with all dependencies
4+
uv sync --all-groups --all-extras
5+
6+
# install pre-commit hooks
7+
uv run pre-commit install --install-hooks

.git_archival.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node: $Format:%H$
2+
node-date: $Format:%cI$
3+
describe-name: $Format:%(describe:tags=true,match=*[0-9]*)$

.github/workflows/deploy.yml

Lines changed: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
1+
name: Publish PauliEngine Python sdist and wheels to PyPI
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
force-upload:
7+
description: 'Upload artifacts without a corresponding release'
8+
required: false
9+
default: false
10+
type: boolean
11+
release:
12+
types:
13+
- published
14+
pull_request:
15+
# PRs trigger for the "opened", "reopened", "synchronize" events (default) and
16+
# "ready_for_review"
17+
paths:
18+
- .github/workflows/deploy.yml
19+
types:
20+
- opened
21+
- reopened
22+
- synchronize # when new commits are pushed to the PR
23+
- ready_for_review # when the PR is un-drafted
24+
25+
concurrency:
26+
group: ${{ github.workflow }}-${{ github.ref }}
27+
cancel-in-progress: true
28+
29+
env:
30+
COLUMNS: 120
31+
FORCE_COLOR: 3
32+
33+
jobs:
34+
build-sdist:
35+
name: Build source distribution
36+
runs-on: ubuntu-latest
37+
steps:
38+
- uses: actions/checkout@v6
39+
with:
40+
fetch-depth: 0 # such that setuptools_scm can do its job correctly
41+
42+
- name: Build SDist
43+
run: |
44+
pipx install uv
45+
pipx run build --verbose --sdist --installer=uv
46+
47+
- uses: actions/upload-artifact@v6
48+
with:
49+
name: cibw-sdist
50+
path: dist/*.tar.gz
51+
52+
build-wheels:
53+
# in combination with the PR types selection, this top-level if statement
54+
# skips running the workflow for Draft PRs
55+
if: ${{ github.event_name == 'push' || !github.event.pull_request.draft }}
56+
name: Build Python wheels for ${{ matrix.os }}
57+
runs-on: ${{ matrix.runs-on }}
58+
strategy:
59+
matrix:
60+
os: [ linux-intel, linux-arm, macos-arm, windows-intel, windows-arm]
61+
include:
62+
- archs: native
63+
platform: auto
64+
- os: linux-intel
65+
runs-on: ubuntu-latest
66+
- os: linux-arm
67+
runs-on: ubuntu-24.04-arm
68+
- os: macos-arm
69+
runs-on: macos-latest
70+
- os: windows-intel
71+
runs-on: windows-latest
72+
- os: windows-arm
73+
runs-on: windows-latest
74+
steps:
75+
- uses: actions/checkout@v6
76+
with:
77+
fetch-depth: 0
78+
79+
- uses: pypa/cibuildwheel@v3.3.1
80+
with:
81+
extras: "uv"
82+
env:
83+
# target platform
84+
CIBW_PLATFORM: ${{ matrix.platform }}
85+
# architectures to build
86+
CIBW_ARCHS: ${{ matrix.archs }}
87+
# use uv and build
88+
CIBW_BUILD_FRONTEND: "build[uv]"
89+
# increase pip debugging output
90+
CIBW_BUILD_VERBOSITY: 1
91+
CIBW_DEBUG_TRACEBACK: TRUE
92+
CIBW_BEFORE_ALL_LINUX: |
93+
dnf install -y ninja-build
94+
# install conan and C++ dependencies for the project
95+
pip install conan
96+
conan profile detect --force
97+
98+
# install symengine
99+
conan install . --output-folder=build --build=missing -pr ./conan_profile
100+
CIBW_BEFORE_ALL_MACOS: |
101+
# install conan and C++ dependencies for the project
102+
pip install conan
103+
conan profile detect --force
104+
105+
# install symengine
106+
conan install . --output-folder=build --build=missing -pr ./conan_profile
107+
CIBW_BEFORE_ALL_WINDOWS: |
108+
pip install delvewheel conan && conan profile detect --force && conan install . --output-folder=build --build=missing -pr conan_profile
109+
# do not activate architecture-dependent compiler flags
110+
# 4 jobs in parallel, but do not start new ones if load average exceeds 5
111+
CIBW_ENVIRONMENT_LINUX:
112+
CMAKE_TOOLCHAIN_FILE=build/conan_toolchain.cmake
113+
CIBW="true"
114+
SKBUILD_BUILD_TOOL_ARGS="-j4;-l5"
115+
# set deployment target for C++20 compatibility
116+
# do not activate architecture-dependent compiler flags
117+
# 4 jobs in parallel, but do not start new ones if load average exceeds 5
118+
CIBW_ENVIRONMENT_MACOS: >
119+
CIBW="true"
120+
MACOSX_DEPLOYMENT_TARGET=15.0
121+
SKBUILD_BUILD_TOOL_ARGS="-j4;-l5"
122+
CIBW_ENVIRONMENT_WINDOWS: >
123+
CIBW="true"
124+
SKBUILD_BUILD_TOOL_ARGS="/m:4"
125+
CMAKE_TOOLCHAIN_FILE=build\conan_toolchain.cmake
126+
# build 3.10, 3.11, 3.12, 3.13 (with GIL), and 3.14 (with GIL)
127+
CIBW_BUILD: "cp310-* cp311-* cp312-* cp313-* cp314-*"
128+
# skip musl builds, and PyPy builds
129+
CIBW_SKIP: "*-musllinux_*"
130+
# use abi3audit to catch issues with Limited API wheels
131+
CIBW_REPAIR_WHEEL_COMMAND_LINUX: |
132+
auditwheel repair -w {dest_dir} {wheel}
133+
if [[ "{wheel}" == *abi3* ]]; then
134+
pipx run abi3audit --strict --report {wheel}
135+
else
136+
echo "{wheel} is not abi3, skipping abi3audit"
137+
fi
138+
# use abi3audit to catch issues with Limited API wheels
139+
CIBW_REPAIR_WHEEL_COMMAND_MACOS: |
140+
delocate-wheel --require-archs {delocate_archs} -w {dest_dir} -v {wheel}
141+
if [[ "{wheel}" == *abi3* ]]; then
142+
pipx run abi3audit --strict --report {wheel}
143+
else
144+
echo "{wheel} is not abi3, skipping abi3audit"
145+
fi
146+
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: |
147+
delvewheel repair -w {dest_dir} {wheel}
148+
if [[ "{wheel}" == *abi3* ]]; then
149+
pipx run abi3audit --strict --report {wheel}
150+
else
151+
echo "{wheel} is not abi3, skipping abi3audit"
152+
fi
153+
CIBW_TEST_COMMAND: python -m pytest {package}/tests
154+
CIBW_TEST_GROUPS: "test"
155+
156+
- name: Upload wheels
157+
uses: actions/upload-artifact@v6
158+
with:
159+
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
160+
path: wheelhouse/*.whl

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,6 @@ Thumbs.db
99
.bat
1010
.cmake
1111
.env
12-
config.json
12+
config.json
13+
14+
__pycache__/

.pre-commit-config.yaml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
default_language_version:
2+
python: python3
3+
4+
default_stages: [pre-commit, pre-push]
5+
6+
repos:
7+
- repo: https://github.com/pre-commit/pre-commit-hooks
8+
rev: v5.0.0
9+
hooks:
10+
- id: check-added-large-files
11+
args: ["--maxkb=1024"]
12+
- id: check-case-conflict
13+
- id: check-merge-conflict
14+
- id: check-symlinks
15+
- id: check-toml
16+
- id: destroyed-symlinks
17+
- id: end-of-file-fixer
18+
- id: forbid-submodules
19+
- id: no-commit-to-branch
20+
args: ['--pattern', '[^a-zA-Z0-9_\/-]']
21+
- id: trailing-whitespace
22+
23+
- repo: https://github.com/charliermarsh/ruff-pre-commit
24+
rev: v0.11.7
25+
hooks:
26+
- id: ruff
27+
# Run the Ruff formatter.
28+
- id: ruff-format
29+
args: [--check]
30+
31+
- repo: https://github.com/astral-sh/uv-pre-commit
32+
# uv version.
33+
rev: 0.7.7
34+
hooks:
35+
- id: uv-lock

0 commit comments

Comments
 (0)