pyscn
Tool · Free
A Python static analyzer that detects duplicates, complex functions, unreachable code, and architectural issues. Creates HTML/JSON reports and provides agent skills and an optional MCP server.
What you can use for free
The local CLI, skills, and pyscn-mcp are free under MIT and require no LLM/API for analysis itself.
Paid features and costs
Polyscan GitHub App is a separate service: the README lists free weekly audit reports for public repositories. Check other workflows' terms separately. Commercial support, integrations, and consulting are available by contacting the developers; the README does not state their costs. An external AI agent may have its own costs.
Access and limitations
The local CLI, skills, and pyscn-mcp are free under MIT and require no LLM/API for analysis itself. Polyscan GitHub App is a separate service: the README lists free weekly audit reports for public repositories. Check other workflows' terms separately. Commercial support, integrations, and consulting are available by contacting the developers; the README does not state their costs. An external AI agent may have its own costs.
Use cases
- Check Python code after AI generation
- Find refactoring candidates and circular imports
Example workflow
A possible workflow; this is not a report of hands-on testing.
Example workflow with pyscn: Check Python code after AI generation.
Before you start
- A diff or a small section of code, and a description of the expected behavior.
- The tech stack version and a reproducible example of the issue or a baseline measurement.
- A Python project or source directory; analysis settings in .pyscn.toml or [tool.pyscn] in pyproject.toml. JavaScript/TypeScript are covered by other analyzers in the Polyscan family.
Steps
- For the task “Check Python code after AI generation,” submit a bounded section with its context and criteria for review. A possible first run: pyscn analyze src/ for an HTML report, or pyscn analyze --json --output - src/ for JSON processing.
- Assess findings by impact; confirm each issue in the code or a reproducible example.
- Fix confirmed causes and repeat the same check on the changed result.
Check your result
- Findings identify a specific cause and consequence; unconfirmed assumptions are kept separate.
- The improvement is measured or confirmed through behavior; recommendations match the project's version.
Choosing pyscn
Check Python code after AI generation
Choose this when
- Check Python code after AI generation
- Find refactoring candidates and circular imports
Requirements
- Access to Python source files. Installation is documented through uv/pipx or a ready-made Go binary; the Intel Mac PyPI wheel was removed in v1.5.1, and the README suggests Homebrew or go install. MCP requires a compatible client and a path to pyscn-mcp/uvx.
Things to consider
- Costs and limits of free use: Polyscan GitHub App is a separate service: the README lists free weekly audit reports for public repositories. Check other workflows' terms separately. Commercial support, integrations, and consulting are available by contacting the developers; the README does not state their costs. An external AI agent may have its own costs.
- Terms of use: MIT for pyscn code: use, modification, and distribution are permitted with copyright and permission notices retained. Code is provided without warranties; the hosted App and commercial support have separate terms.
Frequently asked questions
What can you use for free in pyscn?
The local CLI, skills, and pyscn-mcp are free under MIT and require no LLM/API for analysis itself.
What additional costs might arise with pyscn?
Polyscan GitHub App is a separate service: the README lists free weekly audit reports for public repositories. Check other workflows' terms separately. Commercial support, integrations, and consulting are available by contacting the developers; the README does not state their costs. An external AI agent may have its own costs.
What terms of use matter for pyscn?
MIT for pyscn code: use, modification, and distribution are permitted with copyright and permission notices retained. Code is provided without warranties; the hosted App and commercial support have separate terms.
Which environment can you use pyscn in?
pyscn analyzes Python; HTML and JSON are report formats. The engine is built on Go and tree-sitter. For JavaScript/TypeScript, the README refers to other Polyscan analyzers; an HTML report does not mean analysis of HTML/CSS.
How do you get started with pyscn?
For the task “Check Python code after AI generation,” submit a bounded section with its context and criteria for review. A possible first run: pyscn analyze src/ for an HTML report, or pyscn analyze --json --output - src/ for JSON processing. Assess findings by their impact; confirm the problem in the code or a reproducible example. Fix confirmed causes and repeat the same check on the changed result.
What should you consider when choosing pyscn?
The skills support Codex, and MCP exposes the same analysis. Verify static findings before changing or deleting code.
Is MCP required for pyscn?
The MCP server is an optional way to expose analysis to an agent. The CLI produces static reports; skills for coding environments and the Polyscan GitHub App are available separately.
How can pyscn be used in CI?
pyscn check performs a pass/fail check with configurable thresholds, such as --max-complexity 15 and --max-cycles 0; --select chooses analyses. pyscn init creates .pyscn.toml. A possible process: first choose thresholds appropriate to the project, then add check to the pipeline and examine the reasons for each failure separately; a successful quality gate does not replace functional tests.
Which architectural problems can pyscn detect?
The README describes circular imports, layer-rule violations with clean/layered/hexagonal/MVC presets, module communities, CBO coupling, and LCOM4 cohesion. These are structural metrics and candidates for investigation, not proof that every flagged module needs rewriting.
How are MCP settings selected?
pyscn-mcp uses TOML settings. PYSCN_CONFIG specifies an explicit file; without it, discovery proceeds upward from the working directory, prioritizing .pyscn.toml over [tool.pyscn] in pyproject.toml. YAML/JSON and separate home/XDG paths are not searched. An invalid PYSCN_CONFIG does not cause analyze_code to silently switch to another file: this call reports a configuration error.
Tech stack
- Python
License
MIT for pyscn code: use, modification, and distribution are permitted with copyright and permission notices retained. Code is provided without warranties; the hosted App and commercial support have separate terms.
MIT — permissive license
You can use, modify, distribute, and sell the code, including in a closed-source commercial product. When sharing copies or substantial portions of the code, retain the license text and copyright notice. You do not need to open-source your entire project; the author provides no warranties.
License termsUsage details
The skills support Codex, and MCP exposes the same analysis. Verify static findings before changing or deleting code.
Technologies and topics
- Python
- Static analysis
- MCP