Python
- 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)
Versions
Ur reads Python as the profiles below name it. Name the versions a project targets in target; without it, Ur reads python-3.14.
| Profile | Dialect |
|---|---|
python-2.7 | CPython |
python-3.7 | CPython |
python-3.8 | CPython |
python-3.9 | CPython |
python-3.10 | CPython |
python-3.11 | CPython |
python-3.12 | CPython |
python-3.13 | CPython |
python-3.14 | CPython |
python-2.7-print-function | FuturePrintFunction |