Skip to content

Commit 2696d93

Browse files
committed
Oxideon v0.0.1
0 parents  commit 2696d93

1,368 files changed

Lines changed: 410096 additions & 0 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.

‎.github/workflows/ci.yml‎

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [master, main]
6+
pull_request:
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: read
11+
12+
env:
13+
CARGO_TERM_COLOR: always
14+
15+
jobs:
16+
lint:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@v4
20+
- uses: actions/setup-python@v5
21+
with:
22+
python-version: "3.12"
23+
- name: Clippy
24+
run: |
25+
cargo clippy --workspace --all-targets -- -D warnings
26+
cargo clippy --workspace --all-targets --features python -- -D warnings
27+
cargo clippy --all-targets --features 'rayon,wgpu,python' -- -D warnings # the command the README tells users to run
28+
29+
test:
30+
name: cargo test (${{ matrix.os }})
31+
runs-on: ${{ matrix.os }}
32+
strategy:
33+
fail-fast: false
34+
matrix:
35+
os: [ubuntu-latest, windows-latest, macos-latest]
36+
defaults:
37+
run:
38+
shell: bash # a failing command must fail the step on Windows too (PowerShell only reports the last exit code)
39+
steps:
40+
- uses: actions/checkout@v4
41+
- uses: actions/setup-python@v5
42+
with:
43+
python-version: "3.12"
44+
- name: Test
45+
run: cargo test --workspace --no-fail-fast
46+
# The Python assertion blocks inside the Rust tests are compiled out without the `python` feature.
47+
- name: Test with the Python feature
48+
run: cargo test --workspace --no-fail-fast --features python
49+
# Stack-depth and overflow behavior differs between profiles: the
50+
# robustness suite caught a release-only stack overflow (batch AR)
51+
# that the debug runs above cannot see.
52+
- name: Robustness tests (release profile, Ubuntu only)
53+
if: matrix.os == 'ubuntu-latest'
54+
run: cargo test --release --test robustness
55+
56+
# The wheel is built once per OS (the extension is abi3, so one wheel serves every supported Python) and then
57+
# installed and exercised under each supported Python version below.
58+
wheel:
59+
name: build wheel (${{ matrix.os }})
60+
runs-on: ${{ matrix.os }}
61+
strategy:
62+
fail-fast: false
63+
matrix:
64+
os: [ubuntu-latest, windows-latest, macos-latest]
65+
defaults:
66+
run:
67+
shell: bash
68+
steps:
69+
- uses: actions/checkout@v4
70+
- uses: actions/setup-python@v5
71+
with:
72+
python-version: "3.12"
73+
- run: python -m pip install maturin
74+
- run: maturin build --out dist
75+
- uses: actions/upload-artifact@v4
76+
with:
77+
name: ci-wheel-${{ matrix.os }}
78+
path: dist
79+
80+
wheel-test:
81+
name: wheel on ${{ matrix.os }}, Python ${{ matrix.python }}
82+
needs: wheel
83+
runs-on: ${{ matrix.os }}
84+
strategy:
85+
fail-fast: false
86+
matrix:
87+
os: [ubuntu-latest, windows-latest, macos-latest]
88+
python: ["3.9", "3.10", "3.11", "3.12", "3.13"]
89+
exclude:
90+
# Not verified that actions/setup-python offers 3.9 for the Apple Silicon runners; remove to try it.
91+
- os: macos-latest
92+
python: "3.9"
93+
defaults:
94+
run:
95+
shell: bash
96+
steps:
97+
- uses: actions/checkout@v4
98+
- uses: actions/setup-python@v5
99+
with:
100+
python-version: ${{ matrix.python }}
101+
- uses: actions/download-artifact@v4
102+
with:
103+
name: ci-wheel-${{ matrix.os }}
104+
path: dist
105+
- name: Install the wheel (not the source tree)
106+
run: python -m pip install numpy && python -m pip install --no-index --find-links dist oxideon
107+
- name: Tests
108+
run: |
109+
python tests/test_python_package.py
110+
python tests/test_python_ergonomics.py
111+
- name: Stub freshness
112+
if: matrix.os == 'ubuntu-latest' && matrix.python == '3.12'
113+
run: |
114+
python tools/gen_stubs.py
115+
git diff --exit-code -- python/oxideon
Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
name: Release Python Wheels (PyPI)
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
linux:
14+
runs-on: ${{ matrix.os }}
15+
strategy:
16+
matrix:
17+
include:
18+
- os: ubuntu-latest
19+
target: x86_64
20+
- os: ubuntu-24.04-arm
21+
target: aarch64
22+
steps:
23+
- uses: actions/checkout@v4
24+
- uses: actions/setup-python@v5
25+
with:
26+
python-version: "3.12"
27+
- name: Build wheels
28+
uses: PyO3/maturin-action@v1
29+
with:
30+
target: ${{ matrix.target }}
31+
args: --release --out dist
32+
sccache: "true"
33+
manylinux: 2_28
34+
- name: Upload wheels
35+
uses: actions/upload-artifact@v4
36+
with:
37+
name: wheels-linux-${{ matrix.target }}
38+
path: dist
39+
40+
windows:
41+
runs-on: windows-latest
42+
steps:
43+
- uses: actions/checkout@v4
44+
- uses: actions/setup-python@v5
45+
with:
46+
python-version: "3.12"
47+
- name: Build wheels
48+
uses: PyO3/maturin-action@v1
49+
with:
50+
target: x86_64
51+
args: --release --out dist
52+
sccache: "true"
53+
- name: Upload wheels
54+
uses: actions/upload-artifact@v4
55+
with:
56+
name: wheels-windows-x86_64
57+
path: dist
58+
59+
macos:
60+
runs-on: macos-14
61+
strategy:
62+
matrix:
63+
target: [x86_64, aarch64]
64+
steps:
65+
- uses: actions/checkout@v4
66+
- uses: actions/setup-python@v5
67+
with:
68+
python-version: "3.12"
69+
- name: Build wheels
70+
uses: PyO3/maturin-action@v1
71+
with:
72+
target: ${{ matrix.target }}
73+
args: --release --out dist
74+
sccache: "true"
75+
- name: Upload wheels
76+
uses: actions/upload-artifact@v4
77+
with:
78+
name: wheels-macos-${{ matrix.target }}
79+
path: dist
80+
81+
sdist:
82+
runs-on: ubuntu-latest
83+
steps:
84+
- uses: actions/checkout@v4
85+
- name: Build sdist
86+
uses: PyO3/maturin-action@v1
87+
with:
88+
command: sdist
89+
args: --out dist
90+
- name: Upload sdist
91+
uses: actions/upload-artifact@v4
92+
with:
93+
name: wheels-sdist
94+
path: dist
95+
96+
# Import and exercise the release-profile wheels exactly as built, under every supported Python, before publishing.
97+
# (The x86_64 macOS wheel is not tested: there is no Intel runner here.)
98+
test-wheels:
99+
name: test ${{ matrix.artifact }}, Python ${{ matrix.python }}
100+
needs: [linux, windows, macos]
101+
runs-on: ${{ matrix.os }}
102+
strategy:
103+
fail-fast: false
104+
matrix:
105+
os: [ubuntu-latest, windows-latest, macos-14]
106+
python: ["3.9", "3.10", "3.11", "3.12", "3.13"]
107+
include:
108+
- os: ubuntu-latest
109+
artifact: wheels-linux-x86_64
110+
- os: windows-latest
111+
artifact: wheels-windows-x86_64
112+
- os: macos-14
113+
artifact: wheels-macos-aarch64
114+
exclude:
115+
# Not verified that actions/setup-python offers 3.9 for the Apple Silicon runners; remove to try it.
116+
- os: macos-14
117+
python: "3.9"
118+
defaults:
119+
run:
120+
shell: bash
121+
steps:
122+
- uses: actions/checkout@v4
123+
- uses: actions/setup-python@v5
124+
with:
125+
python-version: ${{ matrix.python }}
126+
- uses: actions/download-artifact@v4
127+
with:
128+
name: ${{ matrix.artifact }}
129+
path: dist
130+
- run: python -m pip install numpy && python -m pip install --no-index --find-links dist oxideon
131+
- run: |
132+
python tests/test_python_package.py
133+
python tests/test_python_ergonomics.py
134+
135+
publish:
136+
name: Publish to PyPI
137+
runs-on: ubuntu-latest
138+
if: startsWith(github.ref, 'refs/tags/v')
139+
needs: [linux, windows, macos, sdist, test-wheels]
140+
permissions:
141+
id-token: write
142+
environment:
143+
name: pypi
144+
steps:
145+
- uses: actions/download-artifact@v4
146+
with:
147+
pattern: wheels-*
148+
path: dist
149+
merge-multiple: true
150+
- uses: pypa/gh-action-pypi-publish@release/v1

‎.gitignore‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/target
2+
**/*.rs.bk
3+
Cargo.lock.bak
4+
.idea/
5+
.vscode/
6+
7+
.venv/
8+
dist/
9+
*.egg-info/
10+
__pycache__/
11+
*.pyc
12+
*.so
13+
*.pyd
14+
15+
# Locally generated outputs (examples, tensorboard-style runs, test cache)
16+
/mini_models_out/
17+
runs/
18+
.pytest_cache/
19+
a.out
20+
*.tmp
21+
*.tmp.*
22+
*.bak.tmp

0 commit comments

Comments
 (0)