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
- AI-generated context - Claude analyzes your project to enhance reviews
- 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 claude-init |
Generate AI project context |
glreview claude-sync |
Update AI context for changed files |
glreview claude-context [PATH] |
View AI-generated context |
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:
signoffwarns if file changed during review (use--acknowledgeto proceed)cancelcloses the GitLab issue by default (use--leave-opento skip)cancel --restartkeeps 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 evaluate: organization, readability, purpose, error handling, test coverage, corner cases, documentation, integration, performance, and security.
Large files are automatically chunked.
AI-Generated Project Context
For better reviews, let Claude analyze your project structure:
# Generate project context (one-time setup)
glreview claude-init
# View the generated context
glreview claude-context # Project overview
glreview claude-context src/module.py # Module-specific context
# Update after significant changes
glreview claude-sync
This creates .glreview/context.json which should be committed to version control.
Claude analyzes your codebase to identify:
- Project conventions - coding patterns, architecture, style
- Test associations - which test files cover which modules (regardless of naming conventions)
- Import relationships - what depends on what
- Module purposes - what each module does
When you run claude-review, this context is automatically included, giving Claude:
- The actual test file content for the module being reviewed
- Project conventions to check against
- Understanding of how the module fits in the larger codebase
The context file is human-editable - you can refine Claude's analysis or add notes.
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.
Setup
-
Create a Project Access Token with
write_repositoryscope:- Settings → Access Tokens → Add new token
- Role: Maintainer, Scopes:
write_repository
-
Add it as a CI variable:
- Settings → CI/CD → Variables
- Key:
PUSH_TOKEN, Value: the token, Masked: yes
-
Add CI configuration:
glreview ci-config
Example Configuration
review-sync:
variables:
GIT_TERMINAL_PROMPT: "0"
script:
- pip install glreview
- git config user.email "gitlab-ci@$CI_SERVER_HOST"
- git config user.name "GitLab CI"
- git remote set-url origin "https://oauth2:${PUSH_TOKEN}@${CI_SERVER_HOST}/${CI_PROJECT_PATH}.git"
- git checkout $CI_COMMIT_BRANCH
- glreview report --sync --format markdown --output REVIEW_COVERAGE.md
- git add REVIEW_COVERAGE.md review_registry.json || true
- 'git diff --cached --quiet || git commit -m "chore: update review registry"'
- 'git diff origin/$CI_COMMIT_BRANCH --quiet && echo "No changes to push" || git push origin HEAD:$CI_COMMIT_BRANCH -o ci.skip'
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
Run glreview ci-config for complete configuration including MR sync and release gates.
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
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 glreview-0.2.0.tar.gz.
File metadata
- Download URL: glreview-0.2.0.tar.gz
- Upload date:
- Size: 75.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7b2cffd9d7aeef1ca56b45c26f797ac03f3be5772e685309ee7b65d382327409
|
|
| MD5 |
99f7b48e076d964a136948bc4c36e3ef
|
|
| BLAKE2b-256 |
8cf8846c0a806b198fef7fb0a8006dca62dbd39f24fa61dd09d819e38d8308c2
|
File details
Details for the file glreview-0.2.0-py3-none-any.whl.
File metadata
- Download URL: glreview-0.2.0-py3-none-any.whl
- Upload date:
- Size: 47.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
93c7aafb1f039b05d58f91c7a9a916200ee3eabcbcb4d411da17459665287ae5
|
|
| MD5 |
7369a955ce29183c2badf8a5f0df6186
|
|
| BLAKE2b-256 |
2b2054b0a23ed90fee9efa6a327ce4669298a0ab5b1cf337d95bcad55c0e7d0f
|