Repository navigation
Enable ruff format preview and replace black/blacken-docs - #21484
Conversation
- Enable `preview = true` in `[tool.ruff.format]` to format Python code
blocks in Markdown files
- Add `extension = { mdx = "markdown" }` for MDX file support
- Remove `black` and `blacken-docs` dependencies
- Remove `blacken-docs` pre-commit hook (replaced by ruff format)
- Update format pre-commit hook to include md/mdx files
Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>
🛠 DevTools 🛠
Install mlflow from this PRFor Databricks, use the following command: |
| [tool.ruff.format] | ||
| preview = true | ||
| docstring-code-format = true |
There was a problem hiding this comment.
Enable preview mode for the formatter to unlock Markdown code block formatting (replaces blacken-docs). See astral-sh/ruff#23434 — as of ruff 0.15.x, *.md is now included by default in file discovery when preview is enabled.
🤖 Generated with Claude
| required-version = "0.15.5" | ||
| force-exclude = true | ||
| extend-include = ["*.ipynb"] | ||
| extension = { mdx = "markdown" } |
There was a problem hiding this comment.
Map .mdx files to the markdown language so ruff discovers and formats Python code blocks in them automatically. See astral-sh/ruff#23574 for the documented approach.
🤖 Generated with Claude
| lint = [ | ||
| "ruff==0.15.5", | ||
| "black==23.7.0", | ||
| "blacken-docs==1.18.0", | ||
| "pre-commit==4.0.1", |
There was a problem hiding this comment.
Removed black and blacken-docs — both are now fully replaced by ruff format with preview mode enabled.
🤖 Generated with Claude
| entry: uv run --only-group lint dev/format.py | ||
| language: system | ||
| files: '\.(py|ipynb)$' | ||
| files: '\.(py|ipynb|md|mdx)$' |
There was a problem hiding this comment.
Extended the format hook to cover md and mdx files (previously only py and ipynb). This replaces the removed blacken-docs hook which handled rst|md|mdx. RST is excluded here because ruff does not support RST formatting.
🤖 Generated with Claude
|
Most of the changes in this PR are auto-generated by |
Signed-off-by: harupy <17039389+harupy@users.noreply.github.com> Co-authored-by: Claude <noreply@anthropic.com>
Related Issues/PRs
Relates to astral-sh/ruff#23434, astral-sh/ruff#23574
What changes are proposed in this pull request?
Enable
preview = truefor[tool.ruff.format]and removeblack/blacken-docsdependencies. Ruff's preview formatter now supports formatting Python code blocks in Markdown files, makingblacken-docsredundant. Also addsextension = { mdx = "markdown" }so ruff treats.mdxfiles as Markdown.How is this PR tested?
Pre-commit hooks pass on all files.
Does this PR require documentation update?
Does this PR require updating the MLflow Skills repository?
Release Notes
Is this a user-facing change?
What component(s), interfaces, languages, and integrations does this PR affect?
Components
area/build: Build and test infrastructure for MLflowHow should the PR be classified in the release notes? Choose one:
rn/none- No description will be included. The PR will be mentioned only by the PR number in the "Small Bugfixes and Documentation Updates" sectionShould this PR be included in the next patch release?
🤖 Generated with Claude Code