This release is a pre-release and may not be stable for production use.
pyruff
Native Python API for the Ruff linter and formatter.
pyruff compiles Ruff's Rust crates directly into a Python extension module via PyO3 and Maturin. No ruff CLI needed at runtime — everything runs natively in-process with zero overhead.
Installation
pip install pyruff
Quick Start
import pyruff
# Format code
formatted = pyruff.format_string("x=1\n")
# "x = 1\n"
# Lint code
diagnostics = pyruff.check("import os\n")
for d in diagnostics:
print(f"{d.code}: {d.message}")
# F401: `os` imported but unused
# Auto-fix violations
result = pyruff.fix("import os\nimport sys\nprint(sys.path)\n")
print(result.output)
# import sys\nprint(sys.path)\n
# List rules
all_rules = pyruff.rules()
r = pyruff.rule("F401")
print(f"{r.code}: {r.name} ({r.linter})")
Features
- Linting —
check(),check_file(),check_paths()with full rule selection - Auto-fix —
fix()with safe/unsafe fix support - Formatting —
format_string(),format_file()with all formatting options - Rules —
rules(),rule(),linters()for rule metadata and introspection - Config resolution — Automatically discovers
ruff.toml/pyproject.tomlconfig, just likeruffCLI - Python 3.11 — 3.14 support
Config Resolution
pyruff automatically discovers and applies your existing ruff configuration:
import pyruff
# Auto-discovers ruff.toml / pyproject.toml from CWD
diagnostics = pyruff.check("import os\n")
# Explicit config path
diagnostics = pyruff.check("import os\n", config="path/to/ruff.toml")
# Ignore all config, use defaults
diagnostics = pyruff.check("import os\n", isolated=True)
# Explicit params override config values
formatted = pyruff.format_string(code, line_length=120)
Versioning
pyruff's version matches the ruff version it's built against.
For example, pyruff==0.15.1 uses ruff 0.15.1 crates internally.
Documentation
- Getting Started
- Linting API —
check(),fix(),check_file(),check_paths() - Formatting API —
format_string(),format_file() - Rules API —
rules(),rule(),linters() - Configuration — Config discovery and resolution
- Upgrading Ruff — Step-by-step guide for ruff version upgrades
Development
Prerequisites
- Python 3.11+ (3.14 supported)
- Rust 1.91+ (install via rustup)
- Maturin (Python build tool for Rust extensions)
Setup
# Clone the repo
git clone https://github.com/emilt27/pyruff.git
cd pyruff
# Create virtual environment
python -m venv .venv
source .venv/bin/activate # or .venv\Scripts\activate on Windows
# Install dev dependencies
pip install maturin pytest ruff
Build
# Development build (debug, installed in .venv)
maturin develop
# Or use the helper script
bin/build
Run Tests
pytest tests/ -v
# Or use the helper script
bin/test
Linting & Formatting
# Rust
cargo fmt --check
cargo clippy -- -D warnings
# Python
ruff check python/ tests/
ruff format --check python/ tests/
# Or use the helper scripts
bin/lint
bin/fmt-check
Helper Scripts
The bin/ directory contains convenience scripts for common dev tasks:
| Script | Description |
|---|---|
bin/build |
Build and install in dev mode |
bin/test |
Run all tests |
bin/lint |
Run all linters (Rust + Python) |
bin/fmt |
Format all code (Rust + Python) |
bin/fmt-check |
Check formatting without changes |
bin/ci |
Run full CI pipeline locally |
Release
Releases are automated via GitHub Actions. To release a new version:
- Update version in
Cargo.tomlandpyproject.toml - Commit and push
- Create a git tag:
git tag v0.15.1 && git push origin --tags - CI builds wheels for Linux/macOS/Windows and publishes to PyPI
License
MIT
Metadata
Release files for pyruff 0.15.1rc5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pyruff-0.15.1rc5.tar.gz | 39.2 kB | Details |
Built distributions (wheels)
Total release size: 189.3 MB
Release files / pyruff-0.15.1rc5.tar.gz
| Download URL | pyruff-0.15.1rc5.tar.gz |
|---|---|
| Size | 39.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7f61bd5afc6fbc82158ab8a076acaa3b835eea66a6fc8a73e272cb780e8a654e
|
|
BLAKE2b-256 checksum How to use checksums |
4b0f6ceb1d094e4f2cdc2a835775fe7e4ba462487475e8412eafa68becf18696
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
maturin/1.12.0
|
Release files / pyruff-0.15.1rc5-pp311-pypy311_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | pyruff-0.15.1rc5-pp311-pypy311_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 8.2 MB |
| Tags | Linux glibc 2.17+ x86-64 PyPy 3.11 PyPy 3.11 7.3 |
|
SHA-256 checksum How to use checksums |
702cc884a29f5d5dcb54e6711c7809bba938b8e25742c9a1a4ea13d4cafed883
|
|
BLAKE2b-256 checksum How to use checksums |
0f638e1ec66fff4a296efa2735a67f3d11c28f3acad5a4a79d14fca18a3011a4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
maturin/1.12.0
|
Release files / pyruff-0.15.1rc5-pp311-pypy311_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | pyruff-0.15.1rc5-pp311-pypy311_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 8.1 MB |
| Tags | Linux glibc 2.17+ ARM64 PyPy 3.11 PyPy 3.11 7.3 |
|
SHA-256 checksum How to use checksums |
7caac2f93d0ff8e6c8836b1a9168baceb47b0f40eac4f18c6dedf99082c791b3
|
|
BLAKE2b-256 checksum How to use checksums |
73f54fd0cd22a41e2827005fc1983e8030d5dbfc8074a12e10a515d280e642e4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
maturin/1.12.0
|
Release files / pyruff-0.15.1rc5-cp314-cp314t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | pyruff-0.15.1rc5-cp314-cp314t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 8.1 MB |
| Tags | CPython 3.14 CPython 3.14 free-threading Linux glibc 2.17+ ARM64 |
|
SHA-256 checksum How to use checksums |
f2901860fa3649e5959c5c9426225cc1966e0a96d695f59b6852df5ceccdca97
|
|
BLAKE2b-256 checksum How to use checksums |
dba490ab06d0d54e28e2ac085752b43473f0210ed1313e55a002b65ed577bf1d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
maturin/1.12.0
|
Release files / pyruff-0.15.1rc5-cp314-cp314-win_amd64.whl
| Download URL | pyruff-0.15.1rc5-cp314-cp314-win_amd64.whl |
|---|---|
| Size | 7.5 MB |
| Tags | CPython 3.14 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
3ab54ef02ef578a9ec2399d7d126ed04651e965c7d3dc90c7fb0ffee3a067475
|
|
BLAKE2b-256 checksum How to use checksums |
9d8aa31b65bb89e978e8f36b9ba5d011dcba1e58517def655d099e36246d08ef
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
maturin/1.12.0
|
Release files / pyruff-0.15.1rc5-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | pyruff-0.15.1rc5-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 8.2 MB |
| Tags | CPython 3.14 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
4feb98d501bf495d7669b8675cb4231c7d543f44389c312fb0a43287aafe33cf
|
|
BLAKE2b-256 checksum How to use checksums |
6002e11bad52cd4c8198740bb448365a62a51a2c1421eb325aaee589eb51e962
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
maturin/1.12.0
|
Release files / pyruff-0.15.1rc5-cp314-cp314-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | pyruff-0.15.1rc5-cp314-cp314-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 8.1 MB |
| Tags | CPython 3.14 Linux glibc 2.17+ ARM64 |
|
SHA-256 checksum How to use checksums |
69ce8e2209e36c2ed2e258dbd8e24d5e95195939215c6ffad1be8aded80d5c16
|
|
BLAKE2b-256 checksum How to use checksums |
370417b4d81b93040b7e8cf65af3287df1313cee5c35bba6e01ce931158ab431
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
maturin/1.12.0
|
Release files / pyruff-0.15.1rc5-cp314-cp314-macosx_11_0_arm64.whl
| Download URL | pyruff-0.15.1rc5-cp314-cp314-macosx_11_0_arm64.whl |
|---|---|
| Size | 7.5 MB |
| Tags | CPython 3.14 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
3020c9a8296879ce409985077b7cd74420689515c3669aa9de6be1ce3ef56606
|
|
BLAKE2b-256 checksum How to use checksums |
139ce64ccfa103ab5580f431216bacddf1cfcfe3178dd48d8472f5302fc09959
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
maturin/1.12.0
|
Release files / pyruff-0.15.1rc5-cp314-cp314-macosx_10_12_x86_64.whl
| Download URL | pyruff-0.15.1rc5-cp314-cp314-macosx_10_12_x86_64.whl |
|---|---|
| Size | 7.8 MB |
| Tags | CPython 3.14 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
d9abaa2e797c8b52ba2372cb690af0e0215f01572bc58f6ce9abb421c05986ad
|
|
BLAKE2b-256 checksum How to use checksums |
a7b7ba8e7e5de4aacd691536f0ed53142310454b3dd5503bbc9a7ff8d9739fc8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
maturin/1.12.0
|
Release files / pyruff-0.15.1rc5-cp313-cp313t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | pyruff-0.15.1rc5-cp313-cp313t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 8.1 MB |
| Tags | CPython 3.13 CPython 3.13 free-threading Linux glibc 2.17+ ARM64 |
|
SHA-256 checksum How to use checksums |
ebf1146fe39f5e286177a4dae6b88db2c1cceb61d2b0ef0c7ed0e876316a1ec8
|
|
BLAKE2b-256 checksum How to use checksums |
964d201b00c26300692db39418cf2640618c762076e3ad3373386b818c1712a7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
maturin/1.12.0
|
Release files / pyruff-0.15.1rc5-cp313-cp313-win_amd64.whl
| Download URL | pyruff-0.15.1rc5-cp313-cp313-win_amd64.whl |
|---|---|
| Size | 7.5 MB |
| Tags | CPython 3.13 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
89fdadabe129070e4ceded98842eea0e37508ef7593872b8d81e81fb3b465577
|
|
BLAKE2b-256 checksum How to use checksums |
249c00d4a20f674f898d7ee5d0905f68dd6b4a36e24ed29e9b61dfb68f218b28
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
maturin/1.12.0
|
Release files / pyruff-0.15.1rc5-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | pyruff-0.15.1rc5-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 8.2 MB |
| Tags | CPython 3.13 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
5046a9aae6765571fbbcc3551ceabd9be07bd0fb691a53be5f9ec7eda1c3c688
|
|
BLAKE2b-256 checksum How to use checksums |
4a2c68042377ce4fc926fe251e7e3fb73fdee42d50c46646f0e5763e4526b910
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
maturin/1.12.0
|
Release files / pyruff-0.15.1rc5-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | pyruff-0.15.1rc5-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 8.1 MB |
| Tags | CPython 3.13 Linux glibc 2.17+ ARM64 |
|
SHA-256 checksum How to use checksums |
59d57311b9d06fb0abc92a42fcb66947711bc752d29883543e24e328e680462c
|
|
BLAKE2b-256 checksum How to use checksums |
b8fdc8c74f08821cacd3c853b56821f193590ac6d7c4afd75a22b400d12e8e9f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
maturin/1.12.0
|
Release files / pyruff-0.15.1rc5-cp313-cp313-macosx_11_0_arm64.whl
| Download URL | pyruff-0.15.1rc5-cp313-cp313-macosx_11_0_arm64.whl |
|---|---|
| Size | 7.5 MB |
| Tags | CPython 3.13 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
a98dc54813389bcf79d6b10ce91727f2c9100d1f86ec54c0cefc7c3374589c3a
|
|
BLAKE2b-256 checksum How to use checksums |
475ca45d74775b2b106994965ca54fcb792f70b59c5ae500c5bf93bb3419e7ff
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
maturin/1.12.0
|
Release files / pyruff-0.15.1rc5-cp313-cp313-macosx_10_12_x86_64.whl
| Download URL | pyruff-0.15.1rc5-cp313-cp313-macosx_10_12_x86_64.whl |
|---|---|
| Size | 7.8 MB |
| Tags | CPython 3.13 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
3677bf7e0f5e1782d42352646abf346512fd51facc84287054271de4302517b9
|
|
BLAKE2b-256 checksum How to use checksums |
d8348a5e0ef74b30813b240458d7c83d1618cac29c694f2e5fce52b7f37468dc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
maturin/1.12.0
|
Release files / pyruff-0.15.1rc5-cp312-cp312-win_amd64.whl
| Download URL | pyruff-0.15.1rc5-cp312-cp312-win_amd64.whl |
|---|---|
| Size | 7.5 MB |
| Tags | CPython 3.12 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
9c5025729cda2a5ea5674c0ebe52ab58e5514ef8224116e3c4fbdf613649d80c
|
|
BLAKE2b-256 checksum How to use checksums |
b2ced6536c114d1d8eac994606598558c592d637b38584925c6946db84a9ae2b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
maturin/1.12.0
|
Release files / pyruff-0.15.1rc5-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | pyruff-0.15.1rc5-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 8.2 MB |
| Tags | CPython 3.12 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
61f313687b2b96483455346f1c3cce41eb9fa46e27bae629fc18c9e5f9c44129
|
|
BLAKE2b-256 checksum How to use checksums |
2fb9b7e37eb271212478ab0a24451e001fc9c0bffc15c6ab71d0f0c0bd480074
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
maturin/1.12.0
|
Release files / pyruff-0.15.1rc5-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | pyruff-0.15.1rc5-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 8.1 MB |
| Tags | CPython 3.12 Linux glibc 2.17+ ARM64 |
|
SHA-256 checksum How to use checksums |
e13f9234bb34a4041b0c6926669fe1c483c14a51583a78e9f0f02aeea8c0c08e
|
|
BLAKE2b-256 checksum How to use checksums |
b11f0eb5a93ace738fe692cc60681189bd8faea5d1e24ba36f48653638c85646
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
maturin/1.12.0
|
Release files / pyruff-0.15.1rc5-cp312-cp312-macosx_11_0_arm64.whl
| Download URL | pyruff-0.15.1rc5-cp312-cp312-macosx_11_0_arm64.whl |
|---|---|
| Size | 7.5 MB |
| Tags | CPython 3.12 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
7c8b67ad95edf5101dfda4b3811393f6588d08a53578e4d24194481e298da539
|
|
BLAKE2b-256 checksum How to use checksums |
b83fe73c178b8209fd0a74417035a3f4658b73b5be2a76e41c661e22dd7fe8d6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
maturin/1.12.0
|
Release files / pyruff-0.15.1rc5-cp312-cp312-macosx_10_12_x86_64.whl
| Download URL | pyruff-0.15.1rc5-cp312-cp312-macosx_10_12_x86_64.whl |
|---|---|
| Size | 7.8 MB |
| Tags | CPython 3.12 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
4a6a7e521b56962f534dff3259e13afb4fa4feb2993cdf0729987c35b0756adb
|
|
BLAKE2b-256 checksum How to use checksums |
644ed86ebb89478fb8c96e53c86cfb32914d31d0f50d9a560fc5bbf72c46f698
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
maturin/1.12.0
|
Release files / pyruff-0.15.1rc5-cp311-cp311-win_amd64.whl
| Download URL | pyruff-0.15.1rc5-cp311-cp311-win_amd64.whl |
|---|---|
| Size | 7.5 MB |
| Tags | CPython 3.11 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
ea9f9cbdcae2be20eaef9d944cb781dd5c79041e01a7aba63a41ec8c7f6444a4
|
|
BLAKE2b-256 checksum How to use checksums |
73fbbd905fbf6f3345ca5382bc603bbec6df91f01e0575ecd3b8f36246bbb28a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
maturin/1.12.0
|
Release files / pyruff-0.15.1rc5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | pyruff-0.15.1rc5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 8.2 MB |
| Tags | CPython 3.11 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
323609f12161ce8ef5c55df3d7efc414cd4ca58662d08313396d11ed6c97bdda
|
|
BLAKE2b-256 checksum How to use checksums |
9d1f45a0fc96db92d6a49c23ed10954e0ce39eceb4933275d7cddac80360f131
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
maturin/1.12.0
|
Release files / pyruff-0.15.1rc5-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | pyruff-0.15.1rc5-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 8.1 MB |
| Tags | CPython 3.11 Linux glibc 2.17+ ARM64 |
|
SHA-256 checksum How to use checksums |
5bae8edf01d158ba07e1339fa74ccd88e8b67c6e0d192d87b12a2f5722afcce5
|
|
BLAKE2b-256 checksum How to use checksums |
a01abfa5b6cae7cc7518697730951f677f658e47f80eed75a4829c5e5161d4a9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
maturin/1.12.0
|
Release files / pyruff-0.15.1rc5-cp311-cp311-macosx_11_0_arm64.whl
| Download URL | pyruff-0.15.1rc5-cp311-cp311-macosx_11_0_arm64.whl |
|---|---|
| Size | 7.5 MB |
| Tags | CPython 3.11 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
18f18eb405b4ffa9340d3fbaddaee1070aceb8dd2428b451f7f37363f5bc2775
|
|
BLAKE2b-256 checksum How to use checksums |
f30a4a9e44a2851a099ab48068ebaf305d9a0b2542862e98badfbd315a206358
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
maturin/1.12.0
|
Release files / pyruff-0.15.1rc5-cp311-cp311-macosx_10_12_x86_64.whl
| Download URL | pyruff-0.15.1rc5-cp311-cp311-macosx_10_12_x86_64.whl |
|---|---|
| Size | 7.8 MB |
| Tags | CPython 3.11 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
710adb5167fceca19c730545900cb6ddc9fd5c23272de81425e74f4b3bef404a
|
|
BLAKE2b-256 checksum How to use checksums |
fc7a883fc86f8742b300170b8063d36e9c2b556c00c9a5f6ba7646dac6dcc566
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
maturin/1.12.0
|