This only works setups with a virtual environment at a known consistent location. This way of installing is a workaround until an official solution is available. See astral-sh/ruff#12352.
required-version and project.dependencies are already set so you shouldn't be able to accidentally use an incompatible Ruff version.
Although there's still an issue where config parsing may fail before required-version
tells you about it: astral-sh/ruff#19922
To use, simply extend your Ruff configuration with the one from this project.
extend = ".venv/Beslogic-Ruff-Config/ruff.toml"
If a rule doesn't seem to fit your need, try to see if it's configurable before disabling it: https://docs.astral.sh/ruff/settings/#lint
Never use the following settings, unless you really know that you want to overwrite entire config sections:
- exclude
- include
- fixable
- per-file-ignores
- select
- safe-fixes
- unsafe-fixes
- flake8-gettext.function-names
- flake8-import-conventions.aliases
- flake8-self.ignore-names
- pep8-naming.ignore-names
Instead, always try to use:
- extend-exclude
- extend-include
- extend-fixable
- extend-per-file-ignores
- extend-select
- extend-safe-fixes
- extend-unsafe-fixes
- flake8-gettext.extend-function-names
- flake8-import-conventions.extend-aliases
- flake8-self.extend-ignore-names
- pep8-naming.extend-ignore-names
If you end up with additional configuration that you believe should be applied across all projects. Please open a PR to modify these shared configurations instead.
The following are not part of the default config and are good to know about:
- Use extend-exclude if you need to exclude any file from being checked. Usually for auto-generated files that can't fully be autofixed. Although even then we'd recommend using extend-per-file-ignores instead.
- Use lint.explicit-preview-rules = false OR explicitly add a rule to extend-select to use rules and behaviours still in preview.
- If you are writing a library and want to enforce documentation for all public symbols, consider adding D1 rules to extend-select.
- Similarly, if you want to enforce documenting returns, yields and exceptions, ignore: D406 and D407 (as they are incompatible with pydoclint). Then extend-select: DOC201, DOC402 and/or DOC501 to your liking
- missing-copyright-notice (CPY001) isn't enabled because most projects are either private or consider that setting the license project metadata is sufficient.
- The following rules are currently disabled because they shouldn't be blocking, but Ruff doesn't support warnings yet: flake8-fixme (FIX), missing-todo-link (TD003), try-except-in-loop (PERF203)
Below you should replace <rev>
with the latest revision/commit to pin the configuration version.
If you want to rely on the uv lockfile instead of using an explicit revision, you can run uv lock --upgrade-package Beslogic-Ruff-Config
to update.
uv add git+https://github.com/Beslogic/Beslogic-Ruff-Config --dev --rev <rev>
Which should add the following to you pyproject.toml:
[dependency-groups]
dev = [
"Beslogic-Ruff-Config",
]
[tool.uv.sources]
httpx = { git = "https://github.com/Beslogic/Beslogic-Ruff-Config@<rev>" }
pip install git+https://github.com/microsoft/python-type-stubs.git@<rev>