ruff¶
A Dagger module for linting and formatting Python code with Ruff.
It exposes two generators: check (ruff check --fix) and format (ruff format).
dagger generate applies their changes, and dagger check --generated fails while
either would change a file. check also fails on violations ruff can't fix.
Installation¶
Usage¶
Checks¶
Fail when the workspace isn't linted or formatted:
Auto-fix¶
Apply the fixes and formatting to the workspace:
Excluding paths¶
Gitignored files are never uploaded to the Dagger engine. exclude sets the glob
patterns of other workspace paths to leave out, replacing the default ["**/.git"].
Set it in dagger.toml:
ruff version detection¶
The module reads the ruff version from the first of these files in the workspace root that sets one:
uv.lock: the pinned package versionruff.toml/.ruff.toml:required-versionpyproject.toml:[tool.ruff].required-version
You can override this with --version or supply your own --ctr.