Repository risk analysis tool (Code Periscope).
Project description
Code Periscope
Code Periscope analyzes a Git repository’s history and generates a risk-focused report that highlights “hot files/modules” (high churn, low ownership, fix-heavy change patterns, etc.).
By default it keeps the output folder small: it writes a stable report_model.json plus one report (report.md or report.html) and deletes intermediate CSVs. Use --debug to keep all CSV artifacts.
It’s designed for quick, local exploration during engineering planning:
- “What parts of this repo look risky right now?”
- “Where is change volume accelerating?”
- “Which files/modules behave like hot spots vs stable areas?”
What this is not
Code Periscope is not a static code analysis / linting tool.
In particular, it is not:
- a security scanner (SAST)
- a dependency vulnerability scanner
- a code quality gate meant to fail CI
- a replacement for linters/formatters/type checkers
It focuses on repository history signals (churn, ownership concentration, fix-heavy patterns, trending hotspots) to help you prioritize where to look.
For the technical deep dive (pipeline, datasets, metrics, report model), see: how-it-works.md.
Prerequisites
- Python 3.11+
- Network access if you want to analyze remote repos via
--git-url
Install
From PyPI:
python3 -m pip install -U pip
python3 -m pip install code-periscope
Quickstart
Analyze a local repo:
code-periscope --repo /path/to/repo --out out/
# Keep intermediate CSV artifacts (datasets) too:
code-periscope --repo /path/to/repo --out out/ --debug
# Emit HTML instead of Markdown:
code-periscope --repo /path/to/repo --out out/ --out-format html
# If you're running from source without installing (e.g. CI), use the module entrypoint:
python3 -m code_periscope --repo /path/to/repo --out out/
Analyze a remote repo URL (it will clone into a local cache directory):
code-periscope --git-url https://github.com/OWNER/REPO.git --out out/
# From source without installing
python3 -m code_periscope --git-url https://github.com/OWNER/REPO.git --out out/
Project
- License: MIT (see
LICENSE) - Contributing: see
CONTRIBUTING.md - Code of Conduct: see
CODE_OF_CONDUCT.md
Development
Repository layout
This repository is a single-package project:
src/code_periscope/core— analytics engine (ingest, metrics, clustering, scoring) and repository cloning/cachingsrc/code_periscope/renderers— Markdown/HTML renderers for the stable report modelsrc/code_periscope/cli.py— CLI adapter (Typer/Rich)
Install (editable)
python3 -m venv .venv
source .venv/bin/activate
make install
Test
make test
Build wheels
python3 -m pip install -U build
make build
Versioning
This project currently uses a single version for the code-periscope package.
Releasing (PyPI)
Publishing is handled by .github/workflows/publish.yml.
- Bump
version = "..."inpyproject.toml. - Commit the version bump.
- Create and push a tag:
git tag vX.Y.Z
git push origin vX.Y.Z
The workflow will build and publish the distribution.
Required GitHub secrets
PYPI_API_TOKEN: PyPI API token for thecode-periscopeproject.- (Optional)
TEST_PYPI_API_TOKEN: token for TestPyPI, used when manually dispatching the workflow fortestpypi.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file code_periscope-0.2.0.tar.gz.
File metadata
- Download URL: code_periscope-0.2.0.tar.gz
- Upload date:
- Size: 46.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cd37c33f94a1d8b456512e09e425c15d3656efcd82e1b84d09f83e8e8018ceb7
|
|
| MD5 |
cfca06320db32049a9ba44c92b6ec800
|
|
| BLAKE2b-256 |
149f529bc38c5accd3460a20db8c020296b6dc7c7fa7239ad0f10816f534972d
|
File details
Details for the file code_periscope-0.2.0-py3-none-any.whl.
File metadata
- Download URL: code_periscope-0.2.0-py3-none-any.whl
- Upload date:
- Size: 52.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5d12fb9815722fb1d4e7a1c9c5a607a30cd4df3c3f4fbefbb2fa7392d53a1228
|
|
| MD5 |
3b62beb28dbca355d4ba6aa42eac1737
|
|
| BLAKE2b-256 |
dd47858a27f7c98040a35f0cf081f24bdf8a456e46b3e3bf2c22129d95e86c8e
|