Python

The Python badge, lettered “There should be one obvious way to do it” round its band
Files
.py .pyi
Formats as
Black
Lints
Every rule that reads its code
In ur.toml
[format.python]

Formatted

cart.py, as written
# What a cart costs.
def subtotal(items,tax = 0.2):
    return sum( item.price*item.quantity for item in items )*(1+tax)
def label(item): return item.name+' x'+str(item.quantity)
ur format --style black cart.py
# What a cart costs.
def subtotal(items, tax=0.2):
    return sum(item.price * item.quantity for item in items) * (1 + tax)


def label(item):
    return item.name + " x" + str(item.quantity)

Try it in the playground →

Versions

Ur reads Python as the profiles below name it. Name the versions a project targets in target; without it, Ur reads python-3.15.

ProfileDialect
python-2.7CPython
python-3.7CPython
python-3.8CPython
python-3.9CPython
python-3.10CPython
python-3.11CPython
python-3.12CPython
python-3.13CPython
python-3.14CPython
python-3.15CPython
python-2.7-print-functionFuturePrintFunction