Skip to main content

PolyglotMiner

Empirical Git Repository & Migration Intelligence Platform

PyPI Python Version Version License: MIT Storage: SQLite UI: Web Studio

PolyglotMiner is a high-throughput research platform and CLI tool suite for analyzing longitudinal codebase evolution, multi-language composition dynamics, and cross-language software migrations across Git repositories at scale.

Installation & Quick Start • Overview & Methodology • CLI Command Reference • Web Studio & API • Architecture • Citation


Installation & Quick Start

1. Install via pip (Recommended)

pip install polyglotminer

Both polyglotminer and its short alias pgminer are immediately available in your terminal.

# Verify environment health
polyglotminer doctor

# Launch the interactive terminal wizard (TUI)
polyglotminer
Or install from source / Git (for development)
git clone https://github.com/SariYanouche/PolyglotMiner.git
cd PolyglotMiner
python -m venv .venv
source .venv/bin/activate       # On Windows: .\.venv\Scripts\Activate.ps1
pip install -e .

2. Configure Autocompletion & Auth (Optional)

# Enable tab autocompletion for your shell (PowerShell, Bash, Zsh, Fish)
polyglotminer completion --install

# (Optional) High-volume candidate harvesting without GitHub rate-limits (60 -> 5,000 req/hr)
gh auth login   # or: export GITHUB_TOKEN="ghp_..."

Overview & Methodology

PolyglotMiner traverses repository histories without checking out physical file trees or downloading file blobs, achieving mining throughputs exceeding 70+ repositories per minute.

  • $O(1)$ Memory Blobless Tree Diffing: Traverses commit trees via native git ls-tree -r streaming with zero blob network calls.
  • Native Subprocess Streaming: Direct git rev-list and git log --name-status pipelines eliminate commit-object memory allocation overhead.
  • Dual Execution Modes: Fast Empirical Module Mode (default, file-turnover analysis) or Physical LOC Mode (--full-loc, batched git cat-file --batch streaming).
  • Noise & False-Positive Elimination: Excludes C/C++/Objective-C header pairings (.h vs .c/.cpp/.m), identical renames/moves, DevOps/CI glue scripts (.sh, .bat, Dockerfiles), and vendor directories (node_modules/, Pods/, vendor/).

Empirical Migration Archetypes

Archetype Defining Empirical Criteria
Direct File Replacement Verified 1-to-1 file conversion (e.g. Parser.java $\to$ Parser.kt) in co-changes
Incremental Migration Macro inverse displacement with Pearson correlation $r \le -0.25$ and source contraction $\ge 25%$
Heterogeneous Interop Long-term concurrent multi-language co-existence ($r \approx 0$)
Polyglot Co-Growth Concurrent expansion of both languages across milestones ($r > 0$)

$$\text{Milestone Pearson Correlation: } r = \frac{\sum (s_i - \bar{s})(t_i - \bar{t})}{\sqrt{\sum (s_i - \bar{s})^2 \sum (t_i - \bar{t})^2}} \le -0.25$$


CLI Command Reference

Both polyglotminer and its short alias pgminer are registered executable commands.

Command Aliases Description Quick Example
scan s Point-in-time language distribution & LOC metrics polyglotminer scan . --open
history h, evol Longitudinal equidistant milestone trajectories polyglotminer history repo -k 10 --open
compare c, diff Pairwise 2-commit delta & churn inspector polyglotminer compare . HEAD~10 HEAD
mine cochange Mined multi-language commits & file replacements polyglotminer mine repo --min-loc 10
campaign harvest Multiprocess batch discovery & mining pipeline polyglotminer campaign -p "C->C++,JS->TS"
ui serve Launch interactive Web Analytics Studio polyglotminer ui --port 8080
saved bookmarks List and export curated benchmark corpus polyglotminer saved --export-csv corpus.csv
bookmark star Tag or annotate a repository in SQLite polyglotminer bookmark repo -c "Java->Kotlin"
rebuild b Instant HTML dashboard re-compilation polyglotminer rebuild --open
list ls List stored snapshots, runs, and repositories polyglotminer list
clean rm Delete reports, snapshots, or database records polyglotminer clean my-repo --yes
doctor check System diagnostics & dependency health-check polyglotminer doctor
completion Auto-detect shell and install tab-completion polyglotminer completion --install

Key Command Examples

# 1. Point-in-time profiling (local directory or remote repository)
polyglotminer scan https://github.com/facebook/react --commit v18.2.0 --open

# 2. Longitudinal evolution trajectory across 10 milestone intervals
polyglotminer history handmux/handmux --samples 10 --open

# 3. Directed migration campaign (target specific transitions e.g. C -> C++ or JS -> TS)
polyglotminer campaign -p "C->C++,JS->TS" --workers 4 --limit 50 --open

# 4. Continuous overnight mining loop with stratified star sampling
polyglotminer campaign --min-stars 50 --max-stars 5000 --seed 42 --workers 2 --loop

# 5. Mine multi-language co-changes with minimum LOC delta threshold
polyglotminer mine carlphilipp/chicago-commutes --source-lang Java --target-lang Kotlin --export-csv pairs.csv

# 6. Pairwise 2-commit turnover comparison
polyglotminer compare vuejs/vue v2.6.0 v3.0.0 --open
PolyglotMiner CLI Terminal Evolution Output

Web Analytics Studio

Launch the dedicated read-only analytics suite with polyglotminer ui (default: http://localhost:8080).

PolyglotMiner Interactive Analytics Studio
  • Graph Navigator & Spotlight Visualizations: Instant navigation across transition ecosystems, turnover archetypes, star tier distributions, and commit depth brackets.
  • Live Heuristic Tuning: Interactive threshold sliders (candidate pairs threshold, minimum confidence score, archetype filtering) with instant client-side recalculation.
  • Instant SSR & Skeleton Shimmers: Virtualized tables and lightweight SQLite streaming (<10MB RAM) for lag-free exploration of large datasets.
  • Academic Export Suite: 1-click export of publication-ready high-resolution figures (300 DPI PNG), LaTeX booktabs tables, and CSV datasets.
  • REST API: Integrates /api/summary, /api/corpus, /api/repositories, /api/repositories/saved, /api/cochanges, and dynamic /<owner>/<repo>/evolution_latest.html routing.

Database Architecture

Analytical state is stored in an embedded SQLite database (reports/polyglotminer.db) with Write-Ahead Logging (WAL):

Table Primary Key Description
repositories name_with_owner Discovered corpus metadata, stars, composition, bookmarks, and status
snapshots id Point-in-time scan metrics, file counts, code/comment/blank lines
evolution_runs run_id Longitudinal trajectories, milestone sample counts, and migration pairs
cochange_commits id Commits modifying $\ge 2$ languages with net directional churn deltas
migration_pairs id 1-to-1 file replacements, deleted/added snippets, and similarity confidence
  • Process Recycling: Campaign workers recycle processes every 25 repositories (maxtasksperchild=25) for 100% OS memory reclamation.
  • Watchdog & Failure Resilience: 75-second per-repository watchdog timeout. Failed or timeout repositories are permanently tracked in SQLite so resume queues never stall.

Verification & Tests

# Run full automated test suite
python -m unittest discover tests

# Run specific verification suites
python -m unittest tests/test_cli_smoke.py
python -m unittest tests/test_directed_campaign.py
python -m unittest tests/test_header_migration_exclusion.py

Repository Structure

PolyglotMiner/
├── polyglotminer/                  # Core research package
│   ├── __init__.py                 # Version and package metadata (v1.0.1)
│   ├── cli.py                      # Unified CLI parser and router
│   ├── scanner.py                  # Single-commit line-counting and tokenizer
│   ├── evolution.py                # Milestone sampler and trajectory engine
│   ├── cochange.py                 # Multi-language commit and snippet extractor
│   ├── campaign.py                 # Multiprocess mass-mining campaign engine
│   ├── cache.py                    # Git clone cache pool (.cache/repos/)
│   ├── languages.py                # Language specifications and color maps
│   ├── config.py                   # Vendor and asset exclusion rules
│   ├── db.py                       # SQLite persistence layer (WAL mode)
│   ├── storage.py                  # Storage orchestration
│   ├── server.py                   # Embedded REST API and Web Studio server
│   ├── doctor.py                   # System diagnostics & dependency check
│   ├── completion.py               # Shell autocompletion generator
│   ├── wizard.py                   # Interactive quick-start terminal wizard (TUI)
│   ├── models.py                   # Analytical data structures
│   ├── reporters/                  # CLI and HTML formatters
│   └── templates/                  # Web Studio Jinja2 templates
├── tests/                          # Automated verification test suite
├── main.py                         # Universal entry point
├── requirements.txt                # Package dependencies
├── setup.py                        # Setuptools build configuration
└── README.md                       # Documentation

Citation

If you use PolyglotMiner in academic publications, please cite:

@software{polyglotminer2026,
  author = {Sari, Yanouche},
  title = {PolyglotMiner: An Empirical Research Platform for Longitudinal Software Evolution and Cross-Language Migration Mining},
  year = {2026},
  version = {1.0.2},
  url = {https://github.com/SariYanouche/PolyglotMiner}
}

Metadata

Release files for polyglotminer 1.0.2

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

Source distribution (sdist)

Source distribution for polyglotminer 1.0.2
File Size Uploaded
polyglotminer-1.0.2.tar.gz 1.0 MB Details

Built distribution (wheel)

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

Total release size: 2.1 MB

Release files / polyglotminer-1.0.2.tar.gz

Download URL polyglotminer-1.0.2.tar.gz
Size 1.0 MB
Tags Source
SHA-256 checksum
How to use checksums
21e0cfd99d8bfea293494814723f5074e8d84ed0a8d303325aab4da803e7273d
BLAKE2b-256 checksum
How to use checksums
7791d95e0383874f8aa75dc1cc7f145b2812628127fc8514c2852828448170dd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.2

Release files / polyglotminer-1.0.2-py3-none-any.whl

Download URL polyglotminer-1.0.2-py3-none-any.whl
Size 1.0 MB
Tags Python 3
SHA-256 checksum
How to use checksums
6331b7ef3fd39e0d197a80f1ddabab86f86a898076adc7a66dc63dc0ef67aea5
BLAKE2b-256 checksum
How to use checksums
cfaa3eb6c573dec7216c69be3adda0e9b6cf7212d1a68619d953f826bd8a307b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.2

Release history Release notifications | RSS feed

1.1.0

2 release files

This release

1.0.2 This release

2 release files

1.0.1

2 release files

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