Skip to main content

An intelligent Python code quality analyzer with architectural guidance

Project description

pyscn - Python Code Quality Analyzer

Article PyPI Go License CI

pyscn is a code quality analyzer for Python vibe coders.

Building with Cursor, Claude, or ChatGPT? pyscn performs structural analysis to keep your codebase maintainable.

Quick Start

# Run analysis without installation
uvx pyscn analyze .
# or
pipx run pyscn analyze .

Demo

https://github.com/user-attachments/assets/07f48070-c0dd-437b-9621-cb3963f863ff

Features

  • 🔍 CFG-based dead code detection – Find unreachable code after exhaustive if-elif-else chains
  • 📋 Clone detection with APTED + LSH – Identify refactoring opportunities with tree edit distance
  • 🔗 Coupling metrics (CBO) – Track architecture quality and module dependencies
  • 📊 Cyclomatic complexity analysis – Spot functions that need breaking down

100,000+ lines/sec • Built with Go + tree-sitter

Installation

# Install with pipx (recommended)
pipx install pyscn

# Or with uv
uv tool install pyscn
Alternative installation methods

Build from source

git clone https://github.com/ludo-technologies/pyscn.git
cd pyscn
make build

Go install

go install github.com/ludo-technologies/pyscn/cmd/pyscn@latest

Common Commands

pyscn analyze

Run comprehensive analysis with HTML report

pyscn analyze .                              # All analyses with HTML report
pyscn analyze --json .                       # Generate JSON report
pyscn analyze --select complexity .          # Only complexity analysis
pyscn analyze --select deps .                # Only dependency analysis
pyscn analyze --select complexity,deps,deadcode . # Multiple analyses

pyscn check

Fast CI-friendly quality gate

pyscn check .                      # Quick pass/fail check
pyscn check --max-complexity 15 .  # Custom thresholds

pyscn init

Create configuration file

pyscn init                         # Generate .pyscn.toml

💡 Run pyscn --help or pyscn <command> --help for complete options

Configuration

Create a .pyscn.toml file or add [tool.pyscn] to your pyproject.toml:

# .pyscn.toml
[complexity]
max_complexity = 15

[dead_code]
min_severity = "warning"

[output]
directory = "reports"

⚙️ Run pyscn init to generate a full configuration file with all available options

CI/CD Integration

# GitHub Actions
- uses: actions/checkout@v4
- run: pipx run pyscn check .    # Fail on quality issues

# Pre-commit hook
- repo: local
  hooks:
    - id: pyscn
      name: pyscn check
      entry: pipx run pyscn check .
      language: system
      pass_filenames: false
      types: [python]

Documentation

📚 Development GuideArchitectureTesting

Enterprise Support

For commercial support, custom integrations, or consulting services, contact us at contact@ludo-tech.org

License

MIT License — see LICENSE


Built with ❤️ using Go and tree-sitter

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

pyscn-1.1.1-py3-none-win_amd64.whl (4.9 MB view details)

Uploaded Python 3Windows x86-64

pyscn-1.1.1-py3-none-manylinux_2_17_x86_64.whl (4.8 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ x86-64

pyscn-1.1.1-py3-none-macosx_11_0_arm64.whl (4.4 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

pyscn-1.1.1-py3-none-macosx_10_9_x86_64.whl (4.7 MB view details)

Uploaded Python 3macOS 10.9+ x86-64

File details

Details for the file pyscn-1.1.1-py3-none-win_amd64.whl.

File metadata

  • Download URL: pyscn-1.1.1-py3-none-win_amd64.whl
  • Upload date:
  • Size: 4.9 MB
  • Tags: Python 3, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pyscn-1.1.1-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 aed6d5859649e41f6efd3e920b7c79abf4a73d071dfa74d7015eef9976c7ad1d
MD5 b24b470a8f03d73b8d598e44c2122704
BLAKE2b-256 9c832fb1cea83a23b6a8ccc66d86ea2fa20f6697a8f34965b10250500fa5cae1

See more details on using hashes here.

File details

Details for the file pyscn-1.1.1-py3-none-manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for pyscn-1.1.1-py3-none-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 11fede8f1d5c509f97a3379e3b81a7159024247e3239d1ab736059830f10887d
MD5 3fda5b7301b1dc9290889b90e10a5c66
BLAKE2b-256 59fe56aabb5d6cc52f6645bea9d08b1665bc12ebe3461d4507bdcda007ee81df

See more details on using hashes here.

File details

Details for the file pyscn-1.1.1-py3-none-macosx_11_0_arm64.whl.

File metadata

  • Download URL: pyscn-1.1.1-py3-none-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 4.4 MB
  • Tags: Python 3, macOS 11.0+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pyscn-1.1.1-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 12f16ba4dd52db6e4b9791f8261405c2cf742f6507a4993ab18e8e163ebff269
MD5 6b77f42f9a34a789df59e5b003c4d4c7
BLAKE2b-256 79501e2c8b765ff23c8088aa288be06efdb78ebfdce49b05223dc8063637c3b0

See more details on using hashes here.

File details

Details for the file pyscn-1.1.1-py3-none-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyscn-1.1.1-py3-none-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 2bd4c6900927616c20aad19e6f99e95d074d323de3c2be6b7ffd4c637f792d81
MD5 9d5fda55425df2feb8ebee23332db5e5
BLAKE2b-256 a5be4fa5ac2ef39566737cc6341eee93d68402685a7381c5459e9176dadc89e7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page