The National Archives Ruff config
These configurations are included in the tna-python-dev Docker image as part of the format command.
Two Ruff configurations are available:
ruff.toml- a general purpose Ruff configurationruff-strict.toml- a configuration with a stricter set of rules
Standard configuration
The standard configuration ruff.toml includes the following rules:
| Rule | Purpose | Defined by |
|---|---|---|
E4, E7, E9 |
Subset of pycodestyle errors | Ruff default configuration |
F |
Pyflakes | Ruff default configuration |
W |
pycodestyle warnings | ruff.toml |
C901 |
mccabe "Function is too complex" | ruff.toml |
B |
flake8-bugbear | ruff.toml |
I |
isort | ruff.toml |
Ignores
Certain rules are ignored for __init__.py files:
E402(module-import-not-at-top-of-file) andPLC0415(import-outside-top-level) - some imports like in Django settings files are added later on in the file, sometimes under conditionalsF401(unused-import) - imports don't have to be used in module files which also helps with Django settings
Strict configuration
Extra rules are included in ruff-strict.toml. You can find more information on each of the rules in the Ruff rules documentation.
Using from PyPI
# Install with Poetry
poetry add tna-ruff-config
TNA_RUFF_CONFIG_DIRECTORY="$(poetry run python -c 'from sysconfig import get_path; print(get_path("platlib"))')/tna_ruff_config"
# ...or pip
pip install tna-ruff-config
TNA_RUFF_CONFIG_DIRECTORY="$(python -c 'from sysconfig import get_path; print(get_path("platlib"))')/tna_ruff_config"
# Run Ruff check using the standard config
ruff check /app --fix --config "$TNA_RUFF_CONFIG_DIRECTORY/ruff.toml"
# Run the Ruff formatter using the standard config
ruff format /app --config "$TNA_RUFF_CONFIG_DIRECTORY/ruff.toml"
Metadata
Release files for tna-ruff-config 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| tna_ruff_config-0.2.0.tar.gz | 3.2 kB | With provenance | Details for tna_ruff_config-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| tna_ruff_config-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for tna_ruff_config-0.2.0-py3-none-any.whl |
Total release size: 7.4 kB
Release files / tna_ruff_config-0.2.0.tar.gz
| Download URL | tna_ruff_config-0.2.0.tar.gz |
|---|---|
| Size | 3.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1a1f666974fdead2d0e2f5108937ad2f07f97af0b7b04f5f5a90e09dc6f2f909
|
|
BLAKE2b-256 checksum How to use checksums |
c6f9abc31a3458edfc55c87ca9b3ebcfdcb7d9fdc1cf7d19b8c8e87e9bfde8c1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 29, 2026.
Transparency logRelease files / tna_ruff_config-0.2.0-py3-none-any.whl
| Download URL | tna_ruff_config-0.2.0-py3-none-any.whl |
|---|---|
| Size | 4.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
02ae87ab9d78385aeb8a7fc1792fd4e845d8cc068a6f8c9fc036c7f4b59e455f
|
|
BLAKE2b-256 checksum How to use checksums |
bcb5dad54ea3414dcf8ef0a6fdf0e229bdd9bf58dd1a084a8fc4a1ac92bca3bf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 29, 2026.
Transparency logSecurity for tna-ruff-config 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for tna_ruff_config-0.2.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 29, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.