Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# RapidQuery

Python SQL query builder. Behavior lives in the Rust/PyO3 extension `rapidquery._core`. `rapidquery/*.py` re-exports it. `rapidquery/*.pyi` is hand-written.

This branch is incomplete. Shipped DDL is `CREATE SCHEMA` / `DROP SCHEMA`. DML, DCL, and TCL are base classes only.

## Commands

- Setup: `make install`
- Dev extension: `make build-dev` (`maturin develop`)
- Release extension: `make build-prod`
- Format: `make format` (ruff, then `cargo +nightly fmt`)
- Lint: `make lint` (ruff check/format, nightly rustfmt, `cargo clippy --tests -- -D warnings`)
- Rust tests: `make test-rust` (`--no-default-features --features auto-initialize`). Default features do not link libpython.
- Python tests: `make test-python` (`pytest -v -n auto`). Rebuild the extension first when Rust changed.
- Full local gate: `make` (format, lint, build-dev, both test targets).

CI (`.github/workflows/test.yml`) runs pytest only, on CPython 3.10–3.15, 3.14t/3.15t, and PyPy 3.11. Free-threaded jobs may fail. Rust tests and clippy are local.

## Editing

- Small diffs. Follow nearby modules. No new language, framework, or build tool.
- Python `>=3.10`. Ruff and rustfmt width are 120. Rustfmt uses `imports_granularity = "Item"` (`.rustfmt.toml`). Edition 2024. Nightly is for formatting only.
- A public type needs three matching pieces: `#[rapidquery_macros::pyclass("rapidquery.<mod>.Name", ...)]`, a re-export in `rapidquery/<mod>.py`, and the same shape in `rapidquery/<mod>.pyi`.
- New SQL should be Standard SQL or supported by at least three dialects (`CONTRIBUTING.md`).
- `sea-query` and `sqlparser` are unused inspiration dependencies. Leave them unused.
- PyO3 modules set `gil_used = false`.
- After a meaningful change, run the tests that cover it.

## Leave alone

- Generated or local artifacts: `target/`, `rapidquery/*.so`, `__pycache__/`, `.venv/`.
- Lockfiles (`uv.lock`, `Cargo.lock`) unless a dependency change is requested.
- Secrets and `.env`.
- Local scratch excluded in `.git/info/exclude`: `a.py`, `builtin.rs`.
14 changes: 14 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,12 @@ rapidquery-macros = { path = "rapidquery-macros" }
smallvec = { version = "1.16.0", default-features = false }
uuid = { version = "1.26.1", default-features = false }

itoa = { version = "1.0.18", default-features = false }
# ONLY for inspiring the source
sea-query = { version = "1.0.2", default-features = false }
# ONLY for inspiring the source
sqlparser = { version = "0.62.0", default-features = false }
zmij = { version = "1.0.23", default-features = false }

[build-dependencies]
pyo3-build-config = "0.30.1"
Expand All @@ -57,15 +59,13 @@ print_stderr = "warn"
print_stdout = "warn"

[profile.dev]
strip = false
lto = true
panic = "unwind"

[profile.release]
opt-level = 3
debug = false
strip = false
lto = true
panic = "abort"
panic = "unwind"
incremental = false
codegen-units = 1
15 changes: 11 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,13 @@ build-prod:
format:
uv run ruff check --fix .
uv run ruff format .
cargo +nightly fmt
cargo +nightly fmt --all

.PHONY: lint-python ## Lint python source files
lint-python:
uv run ruff check .
uv run ruff format --check .
pyright rapidquery

.PHONY: lint-rust ## Lint rust source files
lint-rust:
Expand All @@ -53,10 +54,16 @@ lint-rust:
.PHONY: lint ## Lint rust and python source files
lint: lint-python lint-rust

.PHONY: test-rust ## Run Rust tests
test-rust:
cargo test --workspace --no-default-features --features auto-initialize --all-targets

.PHONY: test-python ## Run Python tests
test-python:
uv run pytest -v -n auto

.PHONY: test ## Run all tests
test:
cargo test --workspace --all --no-default-features --features auto-initialize
uv run pytest -n auto
test: test-rust test-python

.PHONY: all ## Run the standard set of checks performed in CI
all: format lint build-dev test
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ dev = [

build = ["maturin == 1.15.0"]
lint = [
"mypy>=2.3.1",
"pre-commit>=4.6.2",
"pyright>=1.1.414",
"ruff>=0.16.9",
]
test = [
Expand Down
Loading
Loading