Static Analysis

Type checkers inspect code without running it. They can catch mistakes such as passing a string where a function expects an integer, or accessing a field that no longer exists.

Mountaineer generates frontend types from your Python controllers but does not bundle a Python type checker. Configure checks for both languages to catch errors across that boundary.

Python

We currently recommend ty, Astral's Python type checker. It's fast, integrates cleanly with uv, and works well in CI once your project paths are scoped in pyproject.toml.

uv add --dev ty

Then add a basic configuration to your pyproject.toml:

[tool.ty.src]
include = ["my_app"]

Then, to run against your project:

uv run ty check

Typescript

Use TypeScript's compiler, tsc, to check frontend types without building the application. Install it in your views project:

npm install typescript --save-dev

Set the checks in tsconfig.json. The strict family checks types, while the final two options also check return paths and switch fallthrough:

{
  "compilerOptions": {
    "strict": true,
    "noImplicitAny": true,
    "strictNullChecks": true,
    "strictFunctionTypes": true,
    "strictBindCallApply": true,
    "strictPropertyInitialization": true,
    "noImplicitReturns": true,
    "noFallthroughCasesInSwitch": true
  }
}
ParameterDescription
strictEnables all strict type-checking options. Setting this to true is the easiest way to ensure you're using TypeScript's strictest settings.
noImplicitAnyRaises error on expressions and declarations with an implied any type.
strictNullChecksWhen enabled, null and undefined are not in the domain of every type.
strictFunctionTypesEnsures functions' parameters are correctly typed.
strictBindCallApplyEnforce stricter checking of the bind, call, and apply methods on functions.
strictPropertyInitializationEnsures class properties are initialized in the constructor.
noImplicitReturnsReport error when not all code paths in function return a value.
noFallthroughCasesInSwitchPrevent fall-through cases in switch statements.

Then, to run against your project:

{
  "scripts": {
    "typecheck": "tsc --noEmit"
  }
}
npm run typecheck