---
title: "python code formatter and linter - codefmt"
url: https://codefmt.dev/python
updated: 2026-10-02
sources:
  - https://codefmt.dev/python
licence: "© codefmt. Cite with attribution to https://codefmt.dev."
---

# python formatter and linter for automation platforms

codefmt formats and lints Python for Zapier, n8n, Pipedream, Make, and HubSpot Data Hub code steps with Ruff, running entirely in your browser via WebAssembly. it understands each platform's injected globals (input_data in Zapier, _items in n8n, pd in Pipedream) so your snippet parses and lints cleanly without a local Python install.

## what the tool does

- formats with Ruff's Black-compatible formatter: 88-character lines, 4-space indentation, magic trailing comma support
- lints with a curated Ruff rule set (Pyflakes, pycodestyle, isort, pep8-naming, pyupgrade, bugbear, bandit security, comprehensions, simplify, and Ruff-specific rules)
- wraps your snippet in the platform's runtime shell so platform globals are not flagged as undefined
- formatting and linting run in your browser via WebAssembly, so no Python install is 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 with a Black-compatible formatter. Ruff's own benchmarks put its formatter over 30x faster than Black, with matching output in nearly all code. 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, Pipedream, Make, and HubSpot Data Hub 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.

## for agents and automation

- format API: POST https://codefmt.dev/api/format (OpenAPI: https://codefmt.dev/api/openapi.json, code up to 51,200 characters, 50KB of ASCII (400 above it), request body up to 100KB, counted in bytes (413 above it), no authentication)
- MCP server: POST https://codefmt.dev/api/mcp (tools: format_code, format_json, ask_codefmt; manifest: https://codefmt.dev/.well-known/mcp.json)
- rate limit: 60 requests per minute per ip across format api calls, mcp and a2a tool calls, and /ask (mcp handshakes and listings are not counted). the count is kept per server instance, so treat it as a ceiling to stay under rather than an exact budget. the format api reports where you stand in RateLimit headers and its 429 carries Retry-After; /ask answers a 429 with the message in answer, and an mcp tool call over the limit returns a tool result saying to try again in a minute
- auth statement: https://codefmt.dev/auth.md (no accounts, api keys or oauth; send no authorization header)
- site index for agents: https://codefmt.dev/llms.txt
- full reference (request bodies for every language, a copy-paste curl command, platform globals, troubleshooting): https://codefmt.dev/llms-full.txt
