Skip to main content

pyrere (Python Repo Review)

PyPI version Python 3.10+ License: MIT CI

Code Knowledge Graph — static analysis + LLM-assisted refactoring pipeline for Python repositories.

pyrere parses a Python repository with tree-sitter, builds a typed graph of modules, classes and functions, optionally enriches it with pyright / grimp / pycg, annotates it with static-analysis issues (ruff, vulture, bandit), and opens an interactive in-browser viewer.


Installation

pip install pyrere

With optional enrichment / flow tools:

pip install "pyrere[all]"          # everything
pip install "pyrere[flow]"         # ruff + vulture + bandit
pip install "pyrere[enrichment]"   # pyright + grimp + pycg

Note — pyright requires Node.js: pyright is a Node.js program installed via a thin pip shim. pip install pyrere[enrichment] will succeed on machines without Node.js, but running the enrichment step will fail at runtime. Install Node.js 18+ from https://nodejs.org before using the enrichment extra. pyrere degrades gracefully when pyright is absent — the enrichment step is simply skipped with a printed warning.

Note — pycg compatibility: pycg (a points-to call-graph tool included in the enrichment extra) is a research project with limited maintenance and known install issues on Python 3.11+. pyrere handles a missing or broken pycg gracefully — the call-graph enrichment step is skipped automatically. If you hit install errors with pip install "pyrere[enrichment]" try omitting pycg:

pip install "pyrere[flow]" pyright grimp

Quick start

# Analyse the current directory and open the viewer
pyrere .

# Analyse a specific repo
pyrere /path/to/your/repo

# Use a custom port (default: 8000)
pyrere /path/to/your/repo --port 8080

The viewer will open at http://localhost:8000.


Python API

from pyrere import build_graph, enrich_graph, annotate_graph

graph = build_graph("/path/to/repo")
enrich_graph(graph, "/path/to/repo")   # optional: pyright/grimp/pycg
annotate_graph(graph, "/path/to/repo") # optional: ruff/vulture/bandit

print(f"{len(graph.nodes)} nodes, {len(graph.edges)} edges")

tree-sitter version note

The default install uses the legacy bundle (tree-sitter < 0.22, tree-sitter-languages) which ships pre-compiled grammars for ~100 languages and requires no compiler.

Pre-built wheels for tree-sitter-languages are available for the most common platforms (CPython 3.10-3.12 on Linux x86_64/arm64, macOS, Windows x64). On other platforms (e.g. Alpine Linux, RISC-V, PyPy) pip will attempt to build from source and will need a C compiler (gcc / clang) plus the Python headers (python3-dev / python3-devel).

To use the modern per-language packages instead (no compiler required on all platforms that have a tree-sitter-python wheel), install manually:

pip install "tree-sitter>=0.22" tree-sitter-python

and update dependencies in your local pyproject.toml accordingly.


Viewer and internet access

The interactive graph viewer loads vis-network from the unpkg CDN at a pinned version. An active internet connection is required the first time the viewer is opened in each browser session.

For offline use, download the JS file once and place it alongside the viewer:

curl -Lo "$(python -c "import pyrere, os; print(os.path.join(os.path.dirname(pyrere.__file__), '_viewer', 'vis-network.min.js'))")" \
  https://unpkg.com/vis-network@9.1.9/standalone/umd/vis-network.min.js

Then edit _viewer/index.html to change the <script src="..."> line to <script src="vis-network.min.js">.


Development

git clone https://github.com/3ivis/pyrere
cd pyrere
pip install -e ".[dev]"
pytest

License

MIT

Metadata

Release files for pyrere 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyrere 0.1.0
File Size Uploaded Provenance
pyrere-0.1.0.tar.gz 40.7 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for pyrere 0.1.0
File Interpreter ABI Platform
pyrere-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 83.7 kB

Release files / pyrere-0.1.0.tar.gz

Download URL pyrere-0.1.0.tar.gz
Size 40.7 kB
Tags Source
SHA-256 checksum
How to use checksums
018a1e17ca4a9a9a93171fccb9eb7b3bed3a6ce12efe95166fa994a1f86ccbee
BLAKE2b-256 checksum
How to use checksums
c794730d74e9176cca1feb8796e549e08bf65e8f4f78aa798d03b1062c469664
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.8

Release files / pyrere-0.1.0-py3-none-any.whl

Download URL pyrere-0.1.0-py3-none-any.whl
Size 43.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2cd6d94c42bc26eb33e4355323f638d94cf22c7974a1aea6626a7c53a0acd493
BLAKE2b-256 checksum
How to use checksums
8b80bb526c50398844c49be629e2e81e22cf30b93d320a5b30eefbb0b04f0807
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.8

Security for pyrere 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page