Skip to main content

GitLab code review tracking for scientific software

Project description

glreview

GitLab code review tracking for scientific software.

Features

  • Track review status of source modules with git commit precision
  • GitLab integration - creates issues, verifies completion, closes on cancel
  • AI-assisted review - Claude Code integration for automated analysis
  • Change detection - warns if code changes during review
  • Module analysis - shows classes/functions in review issues
  • Customizable templates - Jinja2-based issue templates
  • CI-friendly - exit codes for automated checks
  • Priority rules - pattern-based priority assignment

Installation

pip install glreview

GitLab Authentication

For GitLab integration, set an environment variable:

export GITLAB_PRIVATE_TOKEN=glpat-xxxxxxxxxxxx

# For self-hosted GitLab
export GITLAB_URL=https://gitlab.example.com

In CI pipelines, CI_JOB_TOKEN is used automatically.

Quick Start

# Initialize in your project
glreview init

# Check status
glreview status

# Start a review (creates GitLab issue)
glreview start src/mymodule/core.py --assignee @reviewer

# After review is complete (issue closed)
glreview signoff src/mymodule/core.py

Commands

Command Description
glreview init Initialize (idempotent - safe to re-run)
glreview status Show review progress and module status
glreview start PATH Start a review (creates GitLab issue)
glreview signoff PATH Sign off on a completed review
glreview cancel PATH Cancel or restart a review
glreview claude-review PATH Run AI-assisted review with Claude
glreview report Generate coverage report (markdown/json/badge)
glreview list List all modules
glreview reviewers List available reviewers
glreview check CI check for changes
glreview sync Sync registry with filesystem
glreview ci-config Print recommended GitLab CI configuration

Review Lifecycle

  ┌─────────────┐
  │ needs_review│◄──────────────────┐
  └──────┬──────┘                   │
         │ start                    │ cancel
         ▼                          │
  ┌─────────────┐                   │
  │ in_progress │───────────────────┤
  └──────┬──────┘                   │
         │ signoff                  │
         ▼                          │
  ┌─────────────┐   code changes    │
  │  reviewed   │───────────────────┘
  └─────────────┘   (re-review)

Key behaviors:

  • signoff warns if file changed during review (use --acknowledge to proceed)
  • cancel closes the GitLab issue by default (use --leave-open to skip)
  • cancel --restart keeps the issue open and updates the start commit

AI-Assisted Review

Use Claude Code for automated code analysis:

# Run review (requires claude CLI)
glreview claude-review src/module.py

# Post findings to GitLab issue
glreview claude-review src/module.py --post

# Preview prompt without running
glreview claude-review src/module.py --dry-run

Reviews check: correctness, scientific rigor, robustness, and maintainability. Large files are automatically chunked.

Configuration

Add to pyproject.toml:

[tool.glreview]
sources = ["src/**/*.py"]
exclude = ["**/_version.py", "**/test_*.py"]

# Custom issue template (optional)
issue_template = ".glreview/issue_template.md"

# Priority rules (first match wins)
[[tool.glreview.priority]]
pattern = "src/**/core.py"
level = "critical"
reviewers_required = 2

[[tool.glreview.priority]]
pattern = "src/**/*.py"
level = "medium"
reviewers_required = 1

CI Integration

glreview can automatically sync and report on every push:

# Print full CI configuration
glreview ci-config

Basic setup - sync registry and generate coverage on MRs and main:

review-sync:
  script:
    - pip install glreview
    - glreview report --sync --commit -m "chore: update review registry [skip ci]"
    - git push  # Push updated registry
  rules:
    - if: $CI_PIPELINE_SOURCE == "merge_request_event"
    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH

Release gate - require 100% coverage for releases:

release-gate:
  script:
    - pip install glreview
    - glreview report --format json | python -c "
        import sys,json
        c = json.load(sys.stdin)['coverage_pct']
        sys.exit(0 if c == 100 else 1)
      "
  rules:
    - if: $CI_COMMIT_TAG

Run glreview ci-config for complete configuration with proper git push setup.

License

MIT

Project details


Download files

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

Source Distribution

glreview-0.1.0.tar.gz (28.8 kB view details)

Uploaded Source

Built Distribution

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

glreview-0.1.0-py3-none-any.whl (30.2 kB view details)

Uploaded Python 3

File details

Details for the file glreview-0.1.0.tar.gz.

File metadata

  • Download URL: glreview-0.1.0.tar.gz
  • Upload date:
  • Size: 28.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.11

File hashes

Hashes for glreview-0.1.0.tar.gz
Algorithm Hash digest
SHA256 8174b89d3d6cdd7ef761c3d1fb3ebe747923df6ae77a775fc218834f7390b1a4
MD5 2f75f8a666788f603fba710377d443d0
BLAKE2b-256 2c04d145b778217fff7e2fd7fecfd07c8686dccfba0744fc30bcf0815d9c0c25

See more details on using hashes here.

File details

Details for the file glreview-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: glreview-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 30.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.11

File hashes

Hashes for glreview-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c560b37c0f496320cdeab0227e314e6f3c3974c5574ba5b8e5801ab34571c9b4
MD5 9b99fd607124d205590dba3745912c81
BLAKE2b-256 49bf760a6b638ba6f0b357f592ccdd560cb5ef43bb8496d19db4575325526ac9

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