uv format: Code Formatting Comes to uv (experimentally!)

uv format: Code Formatting Comes to uv (experimentally!)

August 21, 2025

The latest uv release (0.8.13) quietly introduced an experimental new command that Python developers have been waiting for: uv format. This addition brings code formatting directly into uv’s toolkit, eliminating the need to juggle multiple tools for basic Python development workflows.

What is uv format?

The uv format command provides Python code formatting through uv’s interface. Under the hood, it calls Ruff’s formatter to automatically style your code according to consistent standards.

Getting Started

First, make sure you’re running uv 0.8.13 or later. If you need to upgrade, check out our guide on upgrading uv.

Once upgraded, formatting your project is straightforward:

# Format all Python files in your project
uv format

# Check formatting without making changes
uv format --check

# See what would change without applying it
uv format --diff

The command works just like running ruff format in your project root, but through uv’s interface.

Passing Arguments to Ruff

You can pass additional arguments to Ruff by placing them after --:

# Set a specific line length
uv format -- --line-length 100

# Format only specific files
uv format -- src/mymodule/core.py

# Use multiple Ruff options
uv format -- --line-length 88 --preview

This flexibility means you can customize formatting behavior without losing uv’s conveniences.

Warning

Since this is an experimental feature, expect some rough edges:

  • The command may change in future releases
  • Integration with uv’s project model might evolve
  • Error handling and output formatting could improve

Try out uv format in your next project and see how it fits into your development workflow. The experimental nature means your feedback could help shape how this feature evolves.

Last updated on

Please submit corrections and feedback...