Skip to content
d3 Wiki
04.02

Python style

Consistent Python across data scripts and Rhino tools, which run in different interpreters.

Updated
Oct 3, 2026
On this page

Purpose

Consistent Python across data scripts and Rhino tools, which run in different interpreters.

The standard

  • Format and lint with ruff (black-compatible). Type hints on all public functions; mypy on data/CLI packages.

  • Projects use pyproject.toml + uv; no requirements.txt drift, no global installs.

  • Docstrings in Google style. Modules under ~400 lines.

  • Logging via logging, never print, except in Rhino where print is the console (see 10.03).

  • Rhino scripts: keep geometry logic in importable modules (testable outside Rhino) and a thin __main__ that talks to rhinoscriptsyntax / RhinoCommon.

  • Pin dependency versions; regenerate uv.lock in its own commit.

Anti-patterns

Notebooks as production code; from x import *; mutating global state in Rhino scripts.

Owner: [TEAM] · Last reviewed: 2026-09