Skip to main content
The National Archives logo

The National Archives Ruff config

Latest release PyPi version Licence

These configurations are included in the tna-python-dev Docker image as part of the format command.

Two Ruff configurations are available:

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) and PLC0415 (import-outside-top-level) - some imports like in Django settings files are added later on in the file, sometimes under conditionals
  • F401 (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"

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tna_ruff_config-0.2.0.tar.gz (3.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tna_ruff_config-0.2.0-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file tna_ruff_config-0.2.0.tar.gz.

File metadata

  • Download URL: tna_ruff_config-0.2.0.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for tna_ruff_config-0.2.0.tar.gz
Algorithm Hash digest
SHA256 1a1f666974fdead2d0e2f5108937ad2f07f97af0b7b04f5f5a90e09dc6f2f909
MD5 ada77cc2a52053d5b57dd398deb5be50
BLAKE2b-256 c6f9abc31a3458edfc55c87ca9b3ebcfdcb7d9fdc1cf7d19b8c8e87e9bfde8c1

See more details on using hashes here.

Provenance

The following attestation bundles were made for tna_ruff_config-0.2.0.tar.gz:

Publisher: publish.yml on nationalarchives/ruff-config

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tna_ruff_config-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for tna_ruff_config-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 02ae87ab9d78385aeb8a7fc1792fd4e845d8cc068a6f8c9fc036c7f4b59e455f
MD5 72d9007fa1892a0e5163748761ce549b
BLAKE2b-256 bcb5dad54ea3414dcf8ef0a6fdf0e229bdd9bf58dd1a084a8fc4a1ac92bca3bf

See more details on using hashes here.

Provenance

The following attestation bundles were made for tna_ruff_config-0.2.0-py3-none-any.whl:

Publisher: publish.yml on nationalarchives/ruff-config

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page