Skip to content

Commit a5b4f4b

Browse files
committed
Migrate quaddtype to standalone repository
- Extracted quaddtype from numpy-user-dtypes with full git history - Added CI workflows (build_wheels.yml, build_docs.yml, big_endian.yml, typecheck.yml) - Updated URLs in pyproject.toml and README.md to point to new repository - Added .gitignore, .clang-format, .pre-commit-config.yaml, dependabot.yml - Tag format changed from 'quaddtype-v*' to 'v*' for releases - All paths updated for standalone repository structure
1 parent 144cbe7 commit a5b4f4b

File tree

10 files changed

+728
-6
lines changed

10 files changed

+728
-6
lines changed

.clang-format

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# A clang-format style that approximates Python's PEP 7
2+
# Useful for IDE integration
3+
#
4+
# Based on Paul Ganssle's version at
5+
# https://gist.github.com/pganssle/0e3a5f828b4d07d79447f6ced8e7e4db
6+
# and modified for NumPy
7+
BasedOnStyle: Google
8+
AlignAfterOpenBracket: Align
9+
AllowShortEnumsOnASingleLine: false
10+
AllowShortIfStatementsOnASingleLine: false
11+
AlwaysBreakAfterReturnType: TopLevel
12+
BreakBeforeBraces: Stroustrup
13+
ColumnLimit: 100
14+
ContinuationIndentWidth: 8
15+
DerivePointerAlignment: false
16+
IndentWidth: 4
17+
IncludeBlocks: Regroup
18+
IncludeCategories:
19+
- Regex: '^[<"](Python|structmember|pymem)\.h'
20+
Priority: -3
21+
CaseSensitive: true
22+
- Regex: '^"numpy/'
23+
Priority: -2
24+
- Regex: '^"(npy_pycompat|npy_config)'
25+
Priority: -1
26+
- Regex: '^"[[:alnum:]_.]+"'
27+
Priority: 1
28+
- Regex: '^<[[:alnum:]_.]+"'
29+
Priority: 2
30+
Language: Cpp
31+
PointerAlignment: Right
32+
ReflowComments: true
33+
SpaceBeforeParens: ControlStatements
34+
SpacesInParentheses: false
35+
StatementMacros: [PyObject_HEAD, PyObject_VAR_HEAD, PyObject_HEAD_EXTRA]
36+
TabWidth: 4
37+
UseTab: Never
38+
SortIncludes: Never

.github/dependabot.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: github-actions
4+
directory: /
5+
schedule:
6+
interval: weekly
7+
labels: [dependabot]
8+
commit-message:
9+
prefix: "🤖"
10+
groups:
11+
actions:
12+
patterns: ["*"]

.github/workflows/big_endian.yml

Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
name: Big-Endian Architecture Tests
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
workflow_dispatch:
8+
9+
defaults:
10+
run:
11+
shell: bash
12+
13+
concurrency:
14+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
15+
cancel-in-progress: true
16+
17+
permissions:
18+
contents: read
19+
20+
jobs:
21+
big_endian_tests:
22+
runs-on: ubuntu-24.04
23+
continue-on-error: true
24+
strategy:
25+
fail-fast: false
26+
matrix:
27+
BUILD_PROP:
28+
- [
29+
"s390x (IBM Z Big Endian)",
30+
"s390x-linux-gnu",
31+
"s390x/ubuntu:24.04",
32+
"s390x",
33+
]
34+
- [
35+
"s390x - baseline(Z13)",
36+
"s390x-linux-gnu",
37+
"s390x/ubuntu:24.04",
38+
"s390x",
39+
]
40+
env:
41+
ARCH_NAME: ${{ matrix.BUILD_PROP[0] }}
42+
TOOLCHAIN_NAME: ${{ matrix.BUILD_PROP[1] }}
43+
DOCKER_CONTAINER: ${{ matrix.BUILD_PROP[2] }}
44+
ARCH: ${{ matrix.BUILD_PROP[3] }}
45+
TERM: xterm-256color
46+
47+
name: "${{ matrix.BUILD_PROP[0] }}"
48+
steps:
49+
- uses: actions/checkout@v6
50+
with:
51+
submodules: recursive
52+
fetch-tags: true
53+
persist-credentials: false
54+
55+
- name: Initialize binfmt_misc for qemu-user-static
56+
run: |
57+
# Enable QEMU user-mode emulation for cross-architecture execution
58+
docker run --rm --privileged tonistiigi/binfmt:qemu-v9.2.2-52 --install all
59+
60+
- name: Install cross-compilation toolchain
61+
run: |
62+
sudo apt update
63+
sudo apt install -y ninja-build gcc-${TOOLCHAIN_NAME} g++-${TOOLCHAIN_NAME} gfortran-${TOOLCHAIN_NAME}
64+
65+
- name: Cache docker container
66+
uses: actions/cache@v5
67+
id: container-cache
68+
with:
69+
path: ~/docker_${{ matrix.BUILD_PROP[1] }}
70+
key: container-quaddtype-${{ runner.os }}-${{ matrix.BUILD_PROP[1] }}-${{ matrix.BUILD_PROP[2] }}-${{ hashFiles('pyproject.toml') }}
71+
72+
- name: Create cross-compilation container
73+
if: steps.container-cache.outputs.cache-hit != 'true'
74+
run: |
75+
docker run --platform=linux/${ARCH} --name quaddtype_container --interactive \
76+
-v /:/host -v $(pwd):/workspace ${DOCKER_CONTAINER} /bin/bash -c "
77+
# Update package manager and install essential tools
78+
apt update &&
79+
apt install -y cmake git python3 python-is-python3 python3-dev python3-pip build-essential &&
80+
81+
# Create necessary symlinks for cross-compilation
82+
mkdir -p /lib64 && ln -sf /host/lib64/ld-* /lib64/ || true &&
83+
ln -sf /host/lib/x86_64-linux-gnu /lib/x86_64-linux-gnu || true &&
84+
85+
# Link cross-compilation toolchain from host
86+
rm -rf /usr/${TOOLCHAIN_NAME} && ln -sf /host/usr/${TOOLCHAIN_NAME} /usr/${TOOLCHAIN_NAME} &&
87+
rm -rf /usr/lib/gcc/${TOOLCHAIN_NAME} && ln -sf /host/usr/lib/gcc-cross/${TOOLCHAIN_NAME} /usr/lib/gcc/${TOOLCHAIN_NAME} &&
88+
89+
# Set up compiler symlinks
90+
rm -f /usr/bin/gcc && ln -sf /host/usr/bin/${TOOLCHAIN_NAME}-gcc /usr/bin/gcc &&
91+
rm -f /usr/bin/g++ && ln -sf /host/usr/bin/${TOOLCHAIN_NAME}-g++ /usr/bin/g++ &&
92+
rm -f /usr/bin/gfortran && ln -sf /host/usr/bin/${TOOLCHAIN_NAME}-gfortran /usr/bin/gfortran &&
93+
94+
# Set up binutils
95+
rm -f /usr/bin/ar && ln -sf /host/usr/bin/${TOOLCHAIN_NAME}-ar /usr/bin/ar &&
96+
rm -f /usr/bin/as && ln -sf /host/usr/bin/${TOOLCHAIN_NAME}-as /usr/bin/as &&
97+
rm -f /usr/bin/ld && ln -sf /host/usr/bin/${TOOLCHAIN_NAME}-ld /usr/bin/ld &&
98+
rm -f /usr/bin/ld.bfd && ln -sf /host/usr/bin/${TOOLCHAIN_NAME}-ld.bfd /usr/bin/ld.bfd &&
99+
100+
# Link build tools
101+
rm -f /usr/bin/ninja && ln -sf /host/usr/bin/ninja /usr/bin/ninja &&
102+
rm -f /usr/local/bin/ninja && mkdir -p /usr/local/bin && ln -sf /host/usr/bin/ninja /usr/local/bin/ninja &&
103+
104+
# Configure git for workspace access
105+
git config --global --add safe.directory /workspace &&
106+
107+
# Install Python build dependencies (using --break-system-packages for Ubuntu 24.04)
108+
python -m pip install --break-system-packages meson>=1.3.2 meson-python wheel ninja cython &&
109+
echo \"Building NumPy from source (main branch)...\" &&
110+
python -m pip install --break-system-packages git+https://github.com/numpy/numpy.git@main &&
111+
python -c \"import numpy; print('NumPy version:', numpy.__version__)\" &&
112+
python -m pip install --break-system-packages pytest pytest-run-parallel pytest-timeout &&
113+
114+
# Install system dependencies for quaddtype (SLEEF dependencies)
115+
apt install -y libssl-dev libfftw3-dev pkg-config
116+
"
117+
docker commit quaddtype_container quaddtype_container
118+
mkdir -p "~/docker_${TOOLCHAIN_NAME}"
119+
docker save -o "~/docker_${TOOLCHAIN_NAME}/quaddtype_container.tar" quaddtype_container
120+
121+
- name: Load container from cache
122+
if: steps.container-cache.outputs.cache-hit == 'true'
123+
run: docker load -i "~/docker_${TOOLCHAIN_NAME}/quaddtype_container.tar"
124+
125+
- name: Build quaddtype with cross-compilation and testing
126+
run: |
127+
docker run --rm --platform=linux/${ARCH} -e "TERM=xterm-256color" \
128+
-v $(pwd):/workspace -v /:/host quaddtype_container \
129+
/bin/script -e -q -c "/bin/bash --noprofile --norc -eo pipefail -c '
130+
cd /workspace &&
131+
echo \"Building quaddtype for ${ARCH_NAME}...\" &&
132+
133+
# Set OpenMP linking for cross-compilation
134+
export LDFLAGS=\"-fopenmp\" &&
135+
136+
# Install quaddtype without dependencies (NumPy already installed from source)
137+
python -m pip install --break-system-packages --no-deps . -v --no-build-isolation --force-reinstall &&
138+
139+
# Install test dependencies separately
140+
python -m pip install --break-system-packages pytest pytest-run-parallel pytest-timeout mpmath &&
141+
142+
python -m pytest -vvv --color=yes --timeout=600 --tb=short tests/
143+
'"

.github/workflows/build_docs.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Build Docs
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
paths:
9+
- 'docs/**'
10+
- 'src/**'
11+
- '.github/workflows/build_docs.yml'
12+
workflow_dispatch: # Make sure this job can be triggered manually
13+
14+
jobs:
15+
build:
16+
runs-on: ubuntu-latest
17+
permissions:
18+
contents: read
19+
pages: write
20+
id-token: write
21+
steps:
22+
- uses: actions/checkout@v6
23+
- uses: actions/configure-pages@v5
24+
- uses: actions/setup-python@v6
25+
with:
26+
python-version: '3.13'
27+
- name: Install dependencies
28+
run: |
29+
python -m pip install --upgrade pip
30+
python -m pip install "numpy @ git+https://github.com/numpy/numpy.git" pytest meson meson-python
31+
- name: Build quaddtype package
32+
run: |
33+
python -m pip install . -v
34+
- name: Build Sphinx documentation
35+
run: |
36+
python -m pip install ."[docs]"
37+
cd docs/
38+
sphinx-build -b html . _build/html
39+
- name: Upload artifact
40+
uses: actions/upload-pages-artifact@v4
41+
with:
42+
path: './docs/_build/html'
43+
- name: Deploy to GitHub Pages
44+
id: deployment
45+
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)