python code formatter

codefmt supports python as a language option for platforms that support it — zapier, n8n, and pipedream all offer python code actions. select any of these platforms, then toggle js / py in the header to switch to python mode.

python formatting and linting is powered by ruff — the fastest python linter and formatter, written in rust, with 500+ lint rules and black-compatible formatting. it runs entirely in your browser via webassembly — no python installation needed.

frequently asked questions

what formatter engine powers the python formatting?

codefmt uses Ruff for all python formatting and linting. Ruff is a rust-based python tool that is fully Black-compatible — it produces the same output as Black but runs orders of magnitude faster. formatting runs entirely in your browser via WebAssembly, so no python installation is needed.

what lint rules are available for python?

codefmt enables a curated set of Ruff lint rules: F (Pyflakes), E/W (pycodestyle errors and warnings), I (isort import sorting), N (pep8-naming), UP (pyupgrade), B (flake8-bugbear), S (flake8-bandit security), C4 (flake8-comprehensions), SIM (flake8-simplify), and RUF (Ruff-specific rules). this gives you 500+ checks covering correctness, security, and style.

which automation platforms support python code actions?

Zapier, n8n, and Pipedream all support python code actions. select any of these platforms in codefmt, then toggle the js/py switch to enter python mode. codefmt understands each platform's python runtime globals and won't flag them as undefined.

what is the default line length and indentation for python formatting?

codefmt uses 88 characters line length and 4-space indentation — the PEP 8 and Black standard. this matches what Ruff and Black produce by default, so your code will be consistent with the broader python ecosystem.

how does magic trailing comma work in python formatting?

when you add a trailing comma after the last element in a list, dict, function call, or function signature, Ruff's formatter will keep the collection expanded across multiple lines — even if it would fit on one line. removing the trailing comma allows the formatter to collapse it back to a single line. this gives you explicit control over multiline formatting.