Skip to content

Commit 66fb11a

Browse files
committed
feat: publish to PyPi
1 parent 15df2c9 commit 66fb11a

File tree

9 files changed

+266
-3
lines changed

9 files changed

+266
-3
lines changed

.github/workflows/pypi-release.yml

Lines changed: 181 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,181 @@
1+
# This file is autogenerated by maturin v1.11.5
2+
# To update, run
3+
#
4+
# maturin generate-ci github --manifest-path crates/django-check/Cargo.toml
5+
#
6+
name: CI
7+
8+
on:
9+
push:
10+
branches:
11+
- main
12+
- master
13+
tags:
14+
- '*'
15+
pull_request:
16+
workflow_dispatch:
17+
18+
permissions:
19+
contents: read
20+
21+
jobs:
22+
linux:
23+
runs-on: ${{ matrix.platform.runner }}
24+
strategy:
25+
matrix:
26+
platform:
27+
- runner: ubuntu-22.04
28+
target: x86_64
29+
- runner: ubuntu-22.04
30+
target: x86
31+
- runner: ubuntu-22.04
32+
target: aarch64
33+
- runner: ubuntu-22.04
34+
target: armv7
35+
- runner: ubuntu-22.04
36+
target: s390x
37+
- runner: ubuntu-22.04
38+
target: ppc64le
39+
steps:
40+
- uses: actions/checkout@v6
41+
- name: Build wheels
42+
uses: PyO3/maturin-action@v1
43+
with:
44+
target: ${{ matrix.platform.target }}
45+
args: --release --out dist --manifest-path crates/django-check/Cargo.toml
46+
sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
47+
manylinux: auto
48+
- name: Upload wheels
49+
uses: actions/upload-artifact@v5
50+
with:
51+
name: wheels-linux-${{ matrix.platform.target }}
52+
path: dist
53+
54+
musllinux:
55+
runs-on: ${{ matrix.platform.runner }}
56+
strategy:
57+
matrix:
58+
platform:
59+
- runner: ubuntu-22.04
60+
target: x86_64
61+
- runner: ubuntu-22.04
62+
target: x86
63+
- runner: ubuntu-22.04
64+
target: aarch64
65+
- runner: ubuntu-22.04
66+
target: armv7
67+
steps:
68+
- uses: actions/checkout@v6
69+
- name: Build wheels
70+
uses: PyO3/maturin-action@v1
71+
with:
72+
target: ${{ matrix.platform.target }}
73+
args: --release --out dist --manifest-path crates/django-check/Cargo.toml
74+
sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
75+
manylinux: musllinux_1_2
76+
- name: Upload wheels
77+
uses: actions/upload-artifact@v5
78+
with:
79+
name: wheels-musllinux-${{ matrix.platform.target }}
80+
path: dist
81+
82+
windows:
83+
runs-on: ${{ matrix.platform.runner }}
84+
strategy:
85+
matrix:
86+
platform:
87+
- runner: windows-latest
88+
target: x64
89+
python_arch: x64
90+
- runner: windows-latest
91+
target: x86
92+
python_arch: x86
93+
- runner: windows-11-arm
94+
target: aarch64
95+
python_arch: arm64
96+
steps:
97+
- name: Enable symlinks
98+
run: git config --global core.symlinks true
99+
- uses: actions/checkout@v6
100+
- name: Build wheels
101+
uses: PyO3/maturin-action@v1
102+
with:
103+
target: ${{ matrix.platform.target }}
104+
args: --release --out dist --manifest-path crates/django-check/Cargo.toml
105+
sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
106+
- name: Upload wheels
107+
uses: actions/upload-artifact@v5
108+
with:
109+
name: wheels-windows-${{ matrix.platform.target }}
110+
path: dist
111+
112+
macos:
113+
runs-on: ${{ matrix.platform.runner }}
114+
strategy:
115+
matrix:
116+
platform:
117+
- runner: macos-15-intel
118+
target: x86_64
119+
- runner: macos-latest
120+
target: aarch64
121+
steps:
122+
- uses: actions/checkout@v6
123+
- name: Build wheels
124+
uses: PyO3/maturin-action@v1
125+
with:
126+
target: ${{ matrix.platform.target }}
127+
args: --release --out dist --manifest-path crates/django-check/Cargo.toml
128+
sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
129+
- name: Upload wheels
130+
uses: actions/upload-artifact@v5
131+
with:
132+
name: wheels-macos-${{ matrix.platform.target }}
133+
path: dist
134+
135+
sdist:
136+
runs-on: ubuntu-latest
137+
steps:
138+
- uses: actions/checkout@v6
139+
- name: Replace symlinks with actual files
140+
run: |
141+
cd crates/django-check
142+
rm -f LICENSE README.md
143+
cp ../../LICENSE LICENSE
144+
cp ../../README.md README.md
145+
- name: Build sdist
146+
uses: PyO3/maturin-action@v1
147+
with:
148+
command: sdist
149+
args: --out dist --manifest-path crates/django-check/Cargo.toml
150+
- name: Upload sdist
151+
uses: actions/upload-artifact@v5
152+
with:
153+
name: wheels-sdist
154+
path: dist
155+
156+
release:
157+
name: Release
158+
runs-on: ubuntu-latest
159+
if: ${{ startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' }}
160+
needs: [linux, musllinux, windows, macos, sdist]
161+
permissions:
162+
# Use to sign the release artifacts
163+
id-token: write
164+
# Used to upload release artifacts
165+
contents: write
166+
# Used to generate artifact attestation
167+
attestations: write
168+
steps:
169+
- uses: actions/download-artifact@v6
170+
- name: Generate artifact attestation
171+
uses: actions/attest-build-provenance@v3
172+
with:
173+
subject-path: 'wheels-*/*'
174+
- name: Install uv
175+
if: ${{ startsWith(github.ref, 'refs/tags/') }}
176+
uses: astral-sh/setup-uv@v7
177+
- name: Publish to PyPI
178+
if: ${{ startsWith(github.ref, 'refs/tags/') }}
179+
run: uv publish 'wheels-*/*'
180+
env:
181+
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_API_TOKEN }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
/target
2+
.venv

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024-2026 Richard Peña
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,17 @@ Runtime tools (django-silk, nplusone) are focuesd in runtime optimiezation. `dja
4848

4949
## Installation
5050

51-
Not available yet, should be compiled from source.
51+
```bash
52+
pip install djch
53+
```
54+
55+
Or with uv:
56+
57+
```bash
58+
uv pip install djch
59+
```
60+
61+
This installs the `djch` binary to your PATH.
5262

5363

5464
## CLI

crates/django-check/Cargo.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
[package]
22
name = "django-check"
3-
version = "0.1.1"
3+
version = "0.1.2"
44
rust-version = { workspace = true }
55
license = { workspace = true }
66
authors = { workspace = true }
77
edition = { workspace = true }
8+
readme = "README.md"
9+
repository = "https://github.com/richardhapb/django-check"
10+
description = "Static N+1 query detector for Django ORM"
811

912
[[bin]]
1013
name = "djch"

crates/django-check/LICENSE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../LICENSE

crates/django-check/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../README.md

crates/django-check/pyproject.toml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
[build-system]
2+
requires = ["maturin>=1.0,<2.0"]
3+
build-backend = "maturin"
4+
5+
[project]
6+
name = "djch"
7+
version = "0.1.2"
8+
description = "Static N+1 query detector for Django ORM – fast Rust-powered checker"
9+
# For PyPI long description (shows formatted on project page)
10+
readme = {file = "README.md", content-type = "text/markdown"}
11+
requires-python = ">=3.8"
12+
license = {text = "MIT"}
13+
authors = [
14+
{name = "Richard", email = "richard.penab@gmail.com"},
15+
]
16+
keywords = ["django", "n+1", "orm", "query-optimization", "static-analysis", "lsp", "cli", "rust"]
17+
classifiers = [
18+
"Development Status :: 3 - Alpha",
19+
"Intended Audience :: Developers",
20+
"Topic :: Software Development :: Quality Assurance",
21+
"Topic :: Software Development :: Testing",
22+
"Framework :: Django",
23+
"Framework :: Django :: 4.0",
24+
"Framework :: Django :: 5.0",
25+
"Programming Language :: Python :: 3",
26+
"Programming Language :: Python :: 3 :: Only",
27+
"Programming Language :: Python :: 3.8",
28+
"Programming Language :: Python :: 3.9",
29+
"Programming Language :: Python :: 3.10",
30+
"Programming Language :: Python :: 3.11",
31+
"Programming Language :: Python :: 3.12",
32+
"Programming Language :: Rust",
33+
"License :: OSI Approved :: MIT License",
34+
"Operating System :: OS Independent",
35+
]
36+
37+
[project.urls]
38+
Homepage = "https://github.com/richardhapb/django-check"
39+
Documentation = "https://github.com/richardhapb/django-check#readme"
40+
Repository = "https://github.com/richardhapb/django-check.git"
41+
Issues = "https://github.com/richardhapb/django-check/issues"
42+
Changelog = "https://github.com/richardhapb/django-check/releases"
43+
44+
[tool.maturin]
45+
bindings = "bin"

0 commit comments

Comments
 (0)