Config File Format¶
pyscn reads configuration from TOML. You can keep settings in a dedicated .pyscn.toml file or in a [tool.pyscn] section of your existing pyproject.toml.
File discovery¶
When you run pyscn analyze or pyscn check, pyscn walks up from the target path looking for:
.pyscn.toml(highest priority)pyproject.tomlwith a[tool.pyscn]section
The first file found is used. Parent directories are searched until one matches or the filesystem root is reached. If neither file is found, built-in defaults are used.
You can also pass an explicit path:
This bypasses discovery.
Priority order¶
When a setting appears in multiple places, later wins:
- Built-in defaults (lowest)
pyproject.toml→[tool.pyscn].pyscn.toml- CLI flags (highest)
CLI flags are only considered if they were explicitly set — unchanged defaults don't override config values.
Two file styles¶
If both files exist in the same directory, .pyscn.toml wins.
Generating a starter file¶
This writes a fully-commented .pyscn.toml with every option, its default, and a short description. Edit the values you care about and delete (or leave alone) the rest.
Validation¶
pyscn validates configuration on load and exits with code 2 if anything is wrong. Common validation rules:
- Complexity thresholds must satisfy
low ≥ 1andmedium > low. - Output format must be one of
text,json,yaml,csv,html. - Dead-code severity must be
info,warning, orcritical. - Clone similarity thresholds must be in
[0.0, 1.0]. - At least one include pattern must be specified.
Environment variables¶
pyscn does not read configuration from environment variables. The MCP server uses one exception: PYSCN_CONFIG can point to a config file.