ruff
The Ruff Python formatter (https://github.com/astral-sh/ruff).
Backend: pants.backend.experimental.python.lint.ruff.check
Config section: [ruff]
Basic options
args
--ruff-args="[<shell_str>, <shell_str>, ...]"
PANTS_RUFF_ARGS
[ruff]
args = [
<shell_str>,
<shell_str>,
...,
]
[]
Arguments to pass directly to Ruff, e.g. --ruff-args='--exclude=foo --ignore=E501'
.
skip
--[no-]ruff-skip
PANTS_RUFF_SKIP
[ruff]
skip = <bool>
False
If true, don't use Ruff when running pants fmt
and pants fix
and pants lint
.
Advanced options
config
--ruff-config=<file_option>
PANTS_RUFF_CONFIG
[ruff]
config = <file_option>
None
Path to the pyproject.toml
or ruff.toml
file to use for configuration (https://github.com/astral-sh/ruff#configuration).
Setting this option will disable [ruff].config_discovery
. Use this option if the config is located in a non-standard location.
config_discovery
--[no-]ruff-config-discovery
PANTS_RUFF_CONFIG_DISCOVERY
[ruff]
config_discovery = <bool>
True
If true, Pants will include any relevant config files during runs (pyproject.toml
, and ruff.toml
).
Use [ruff].config
instead if your config is in a non-standard location.
known_versions
--ruff-known-versions="['<str>', '<str>', ...]"
PANTS_RUFF_KNOWN_VERSIONS
[ruff]
known_versions = [
'<str>',
'<str>',
...,
]
[ "0.6.4|macos_arm64|2648dd09984c82db9f3163ce8762c89536e4bf0e198f17e06a01c0e32214273e|9167424", "0.6.4|macos_x86_64|4438cbc80c6aa0e839abc3abb2a869a27113631cb40aa26540572fb53752c432|9463378", "0.6.4|linux_arm64|a9157a0f062d62c1b1582284a8d10629503f38bc9b7126b614cb7569073180ff|10120541", "0.6.4|linux_x86_64|3ca04aabf7259c59193e4153a865618cad26f73be930ce5f6109e0e6097d037b|10373921", "0.4.9|macos_arm64|5f4506d7ec2ae6ac5a48ba309218a4b825a00d4cad9967b7bbcec1724ef04930|8148128|https://github.com/astral-sh/ruff/releases/download/v0.4.9/ruff-0.4.9-aarch64-apple-darwin.tar.gz", "0.4.9|macos_x86_64|e4d745adb0f5a0b08f2c9ca71e57f451a9b8485ae35b5555d9f5d20fc93a6cb6|8510706|https://github.com/astral-sh/ruff/releases/download/v0.4.9/ruff-0.4.9-x86_64-apple-darwin.tar.gz", "0.4.9|linux_arm64|00c50563f9921a141ddd4ec0371149f3bbfa0369d9d238a143bcc3a932363785|8106747|https://github.com/astral-sh/ruff/releases/download/v0.4.9/ruff-0.4.9-aarch64-unknown-linux-musl.tar.gz", "0.4.9|linux_x86_64|5ceba21dad91e3fa05056ca62f278b0178516cfad8dbf08cf2433c6f1eeb92d3|8863118|https://github.com/astral-sh/ruff/releases/download/v0.4.9/ruff-0.4.9-x86_64-unknown-linux-musl.tar.gz" ]
Known versions to verify downloads against.
Each element is a pipe-separated string of version|platform|sha256|length
or
version|platform|sha256|length|url_override
, where:
version
is the version stringplatform
is one of[linux_arm64,linux_x86_64,macos_arm64,macos_x86_64]
sha256
is the 64-character hex representation of the expected sha256 digest of the download file, as emitted byshasum -a 256
length
is the expected length of the download file in bytes, as emitted bywc -c
- (Optional)
url_override
is a specific url to use instead of the normally generated url for this version
E.g., 3.1.2|macos_x86_64|6d0f18cd84b918c7b3edd0203e75569e0c7caecb1367bbbe409b44e28514f5be|42813
.
and 3.1.2|macos_arm64 |aca5c1da0192e2fd46b7b55ab290a92c5f07309e7b0ebf4e45ba95731ae98291|50926|https://example.mac.org/bin/v3.1.2/mac-aarch64-v3.1.2.tgz
.
Values are space-stripped, so pipes can be indented for readability if necessary.
url_platform_mapping
--ruff-url-platform-mapping="{'key1': val1, 'key2': val2, ...}"
PANTS_RUFF_URL_PLATFORM_MAPPING
[ruff.url_platform_mapping]
key1 = val1
key2 = val2
...
{ "linux_arm64": "aarch64-unknown-linux-musl", "linux_x86_64": "x86_64-unknown-linux-musl", "macos_arm64": "aarch64-apple-darwin", "macos_x86_64": "x86_64-apple-darwin" }
A dictionary mapping platforms to strings to be used when generating the URL to download the tool.
In --url-template
, anytime the {platform}
string is used, Pants will determine the current platform, and substitute {platform}
with the respective value from your dictionary.
For example, if you define {"macos_x86_64": "apple-darwin", "linux_x86_64": "unknown-linux"}
, and run Pants on Linux with an intel architecture, then {platform}
will be substituted in the --url-template
option with unknown-linux
.
url_template
--ruff-url-template=<str>
PANTS_RUFF_URL_TEMPLATE
[ruff]
url_template = <str>
https://github.com/astral-sh/ruff/releases/download/{version}/ruff-{platform}.tar.gz
URL to download the tool, either as a single binary file or a compressed file (e.g. zip file). You can change this to point to your own hosted file, e.g. to work with proxies or for access via the filesystem through a file:$abspath
URL (e.g. file:/this/is/absolute
, possibly by templating the buildroot in a config file).
Use {version}
to have the value from --version
substituted, and {platform}
to have a value from --url-platform-mapping
substituted in, depending on the current platform. For example, https://github.com/.../protoc-{version}-{platform}.zip.
use_unsupported_version
--ruff-use-unsupported-version=<UnsupportedVersionUsage>
PANTS_RUFF_USE_UNSUPPORTED_VERSION
[ruff]
use_unsupported_version = <UnsupportedVersionUsage>
error, warning
default:
error
What action to take in case the requested version of Ruff is not supported.
Supported Ruff versions: >=0.1.2,<1
version
--ruff-version=<str>
PANTS_RUFF_VERSION
[ruff]
version = <str>
0.6.4
Use this version of Ruff.
Supported Ruff versions: >=0.1.2,<1
Deprecated options
console_script
--ruff-console-script=<str>
PANTS_RUFF_CONSOLE_SCRIPT
[ruff]
console_script = <str>
None
Deprecated, will be removed in version: 2.26.0.dev0.
NOW IGNORED: use `version` and `known_versions` options to customise the version of ruff, replacing this option; consider deleting the resolve and `python_requirement` if no longer used. See https://www.pantsbuild.org/2.24/reference/subsystems/ruff
Formerly used to customise the version of Ruff to install.
entry_point
--ruff-entry-point=<str>
PANTS_RUFF_ENTRY_POINT
[ruff]
entry_point = <str>
None
Deprecated, will be removed in version: 2.26.0.dev0.
NOW IGNORED: use `version` and `known_versions` options to customise the version of ruff, replacing this option; consider deleting the resolve and `python_requirement` if no longer used. See https://www.pantsbuild.org/2.24/reference/subsystems/ruff
Formerly used to customise the version of Ruff to install.
install_from_resolve
--ruff-install-from-resolve=<str>
PANTS_RUFF_INSTALL_FROM_RESOLVE
[ruff]
install_from_resolve = <str>
None
Deprecated, will be removed in version: 2.26.0.dev0.
NOW IGNORED: use `version` and `known_versions` options to customise the version of ruff, replacing this option; consider deleting the resolve and `python_requirement` if no longer used. See https://www.pantsbuild.org/2.24/reference/subsystems/ruff
Formerly used to customise the version of Ruff to install.
interpreter_constraints
--ruff-interpreter-constraints="['<str>', '<str>', ...]"
PANTS_RUFF_INTERPRETER_CONSTRAINTS
[ruff]
interpreter_constraints = [
'<str>',
'<str>',
...,
]
[]
Deprecated, will be removed in version: 2.26.0.dev0.
NOW IGNORED: use `version` and `known_versions` options to customise the version of ruff, replacing this option; consider deleting the resolve and `python_requirement` if no longer used. See https://www.pantsbuild.org/2.24/reference/subsystems/ruff
Formerly used to customise the version of Ruff to install.
requirements
--ruff-requirements="['<str>', '<str>', ...]"
PANTS_RUFF_REQUIREMENTS
[ruff]
requirements = [
'<str>',
'<str>',
...,
]
[]
Deprecated, will be removed in version: 2.26.0.dev0.
NOW IGNORED: use `version` and `known_versions` options to customise the version of ruff, replacing this option; consider deleting the resolve and `python_requirement` if no longer used. See https://www.pantsbuild.org/2.24/reference/subsystems/ruff
Formerly used to customise the version of Ruff to install.
Related subsystems
None