Skip to content

Commit 1935a46

Browse files
committed
Initial commit: ormar-utils Rust accelerator package
0 parents  commit 1935a46

18 files changed

Lines changed: 1279 additions & 0 deletions

.github/workflows/ci.yml

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
tags: ["v*"]
7+
pull_request:
8+
branches: [main]
9+
10+
permissions:
11+
contents: read
12+
13+
jobs:
14+
test:
15+
runs-on: ${{ matrix.os }}
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
os: [ubuntu-latest, macos-latest]
20+
python-version: ["3.10", "3.11", "3.12", "3.13"]
21+
steps:
22+
- uses: actions/checkout@v4
23+
- uses: actions/setup-python@v5
24+
with:
25+
python-version: ${{ matrix.python-version }}
26+
- name: Install Rust toolchain
27+
uses: dtolnay/rust-toolchain@stable
28+
- name: Build with maturin
29+
run: |
30+
pip install maturin pytest
31+
maturin develop
32+
- name: Run tests
33+
run: pytest tests/ -v
34+
35+
build:
36+
name: Build wheels
37+
needs: test
38+
if: startsWith(github.ref, 'refs/tags/v')
39+
runs-on: ${{ matrix.os }}
40+
strategy:
41+
matrix:
42+
include:
43+
- os: ubuntu-latest
44+
target: x86_64
45+
- os: ubuntu-latest
46+
target: aarch64
47+
- os: macos-latest
48+
target: x86_64
49+
- os: macos-latest
50+
target: aarch64
51+
- os: windows-latest
52+
target: x86_64
53+
steps:
54+
- uses: actions/checkout@v4
55+
- uses: actions/setup-python@v5
56+
with:
57+
python-version: "3.12"
58+
- name: Build wheels
59+
uses: PyO3/maturin-action@v1
60+
with:
61+
target: ${{ matrix.target }}
62+
args: --release --out dist
63+
manylinux: auto
64+
- name: Upload wheels
65+
uses: actions/upload-artifact@v4
66+
with:
67+
name: wheels-${{ matrix.os }}-${{ matrix.target }}
68+
path: dist
69+
70+
publish:
71+
name: Publish to PyPI
72+
needs: build
73+
if: startsWith(github.ref, 'refs/tags/v')
74+
runs-on: ubuntu-latest
75+
environment: pypi
76+
permissions:
77+
id-token: write
78+
steps:
79+
- name: Download all wheels
80+
uses: actions/download-artifact@v4
81+
with:
82+
pattern: wheels-*
83+
merge-multiple: true
84+
path: dist
85+
- name: Publish to PyPI
86+
uses: pypa/gh-action-pypi-publish@release/v1

.gitignore

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Rust
2+
/target/
3+
4+
# Python
5+
__pycache__/
6+
*.py[cod]
7+
*.so
8+
*.dylib
9+
*.pyd
10+
dist/
11+
*.egg-info/
12+
.eggs/
13+
*.whl
14+
15+
# IDE
16+
.idea/
17+
.vscode/
18+
*.swp
19+
20+
# Environment
21+
.env
22+
.venv/
23+
venv/

Cargo.lock

Lines changed: 271 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
[package]
2+
name = "ormar_rust_utils"
3+
version = "0.1.0"
4+
edition = "2021"
5+
description = "Rust-accelerated utility functions for the ormar ORM"
6+
license = "MIT"
7+
8+
[lib]
9+
name = "ormar_rust_utils"
10+
crate-type = ["cdylib"]
11+
12+
[dependencies]
13+
pyo3 = { version = "0.22", features = ["extension-module"] }
14+
base64 = "0.22"
15+
serde_json = "1.0"
16+
indexmap = "2.0"

0 commit comments

Comments
 (0)