glreview 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,8 @@
1
+ __pycache__/
2
+ *.pyc
3
+ *.egg-info/
4
+ _version.py
5
+ *.egg
6
+ dist/
7
+ build/
8
+ .eggs/
@@ -0,0 +1,211 @@
1
+ Metadata-Version: 2.4
2
+ Name: glreview
3
+ Version: 0.1.0
4
+ Summary: GitLab code review tracking for scientific software
5
+ Author-email: Chad Hanna <chad.hanna@ligo.org>
6
+ License: MIT
7
+ Project-URL: Homepage, https://git.ligo.org/chad.hanna/glreview
8
+ Project-URL: Documentation, https://git.ligo.org/chad.hanna/glreview
9
+ Project-URL: Repository, https://git.ligo.org/chad.hanna/glreview
10
+ Project-URL: Issues, https://git.ligo.org/chad.hanna/glreview/-/issues
11
+ Keywords: gitlab,code-review,scientific-software,ci-cd
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Environment :: Console
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Intended Audience :: Science/Research
16
+ Classifier: License :: OSI Approved :: MIT License
17
+ Classifier: Operating System :: OS Independent
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3.10
20
+ Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Programming Language :: Python :: 3.12
22
+ Classifier: Topic :: Software Development :: Quality Assurance
23
+ Classifier: Topic :: Software Development :: Version Control :: Git
24
+ Requires-Python: >=3.10
25
+ Description-Content-Type: text/markdown
26
+ Requires-Dist: click>=8.0
27
+ Requires-Dist: jinja2>=3.0
28
+ Requires-Dist: python-gitlab>=4.0
29
+ Requires-Dist: tomli>=2.0; python_version < "3.11"
30
+ Provides-Extra: dev
31
+ Requires-Dist: pytest>=8.0; extra == "dev"
32
+ Requires-Dist: pytest-cov; extra == "dev"
33
+ Requires-Dist: black; extra == "dev"
34
+ Requires-Dist: isort; extra == "dev"
35
+ Requires-Dist: flake8; extra == "dev"
36
+ Requires-Dist: mypy; extra == "dev"
37
+
38
+ # glreview
39
+
40
+ GitLab code review tracking for scientific software.
41
+
42
+ ## Features
43
+
44
+ - **Track review status** of source modules with git commit precision
45
+ - **GitLab integration** - creates issues, verifies completion, closes on cancel
46
+ - **AI-assisted review** - Claude Code integration for automated analysis
47
+ - **Change detection** - warns if code changes during review
48
+ - **Module analysis** - shows classes/functions in review issues
49
+ - **Customizable templates** - Jinja2-based issue templates
50
+ - **CI-friendly** - exit codes for automated checks
51
+ - **Priority rules** - pattern-based priority assignment
52
+
53
+ ## Installation
54
+
55
+ ```bash
56
+ pip install glreview
57
+ ```
58
+
59
+ ## GitLab Authentication
60
+
61
+ For GitLab integration, set an environment variable:
62
+
63
+ ```bash
64
+ export GITLAB_PRIVATE_TOKEN=glpat-xxxxxxxxxxxx
65
+
66
+ # For self-hosted GitLab
67
+ export GITLAB_URL=https://gitlab.example.com
68
+ ```
69
+
70
+ In CI pipelines, `CI_JOB_TOKEN` is used automatically.
71
+
72
+ ## Quick Start
73
+
74
+ ```bash
75
+ # Initialize in your project
76
+ glreview init
77
+
78
+ # Check status
79
+ glreview status
80
+
81
+ # Start a review (creates GitLab issue)
82
+ glreview start src/mymodule/core.py --assignee @reviewer
83
+
84
+ # After review is complete (issue closed)
85
+ glreview signoff src/mymodule/core.py
86
+ ```
87
+
88
+ ## Commands
89
+
90
+ | Command | Description |
91
+ |---------|-------------|
92
+ | `glreview init` | Initialize (idempotent - safe to re-run) |
93
+ | `glreview status` | Show review progress and module status |
94
+ | `glreview start PATH` | Start a review (creates GitLab issue) |
95
+ | `glreview signoff PATH` | Sign off on a completed review |
96
+ | `glreview cancel PATH` | Cancel or restart a review |
97
+ | `glreview claude-review PATH` | Run AI-assisted review with Claude |
98
+ | `glreview report` | Generate coverage report (markdown/json/badge) |
99
+ | `glreview list` | List all modules |
100
+ | `glreview reviewers` | List available reviewers |
101
+ | `glreview check` | CI check for changes |
102
+ | `glreview sync` | Sync registry with filesystem |
103
+ | `glreview ci-config` | Print recommended GitLab CI configuration |
104
+
105
+ ## Review Lifecycle
106
+
107
+ ```
108
+ ┌─────────────┐
109
+ │ needs_review│◄──────────────────┐
110
+ └──────┬──────┘ │
111
+ │ start │ cancel
112
+ ▼ │
113
+ ┌─────────────┐ │
114
+ │ in_progress │───────────────────┤
115
+ └──────┬──────┘ │
116
+ │ signoff │
117
+ ▼ │
118
+ ┌─────────────┐ code changes │
119
+ │ reviewed │───────────────────┘
120
+ └─────────────┘ (re-review)
121
+ ```
122
+
123
+ **Key behaviors:**
124
+ - `signoff` warns if file changed during review (use `--acknowledge` to proceed)
125
+ - `cancel` closes the GitLab issue by default (use `--leave-open` to skip)
126
+ - `cancel --restart` keeps the issue open and updates the start commit
127
+
128
+ ## AI-Assisted Review
129
+
130
+ Use Claude Code for automated code analysis:
131
+
132
+ ```bash
133
+ # Run review (requires claude CLI)
134
+ glreview claude-review src/module.py
135
+
136
+ # Post findings to GitLab issue
137
+ glreview claude-review src/module.py --post
138
+
139
+ # Preview prompt without running
140
+ glreview claude-review src/module.py --dry-run
141
+ ```
142
+
143
+ Reviews check: correctness, scientific rigor, robustness, and maintainability.
144
+ Large files are automatically chunked.
145
+
146
+ ## Configuration
147
+
148
+ Add to `pyproject.toml`:
149
+
150
+ ```toml
151
+ [tool.glreview]
152
+ sources = ["src/**/*.py"]
153
+ exclude = ["**/_version.py", "**/test_*.py"]
154
+
155
+ # Custom issue template (optional)
156
+ issue_template = ".glreview/issue_template.md"
157
+
158
+ # Priority rules (first match wins)
159
+ [[tool.glreview.priority]]
160
+ pattern = "src/**/core.py"
161
+ level = "critical"
162
+ reviewers_required = 2
163
+
164
+ [[tool.glreview.priority]]
165
+ pattern = "src/**/*.py"
166
+ level = "medium"
167
+ reviewers_required = 1
168
+ ```
169
+
170
+ ## CI Integration
171
+
172
+ glreview can automatically sync and report on every push:
173
+
174
+ ```bash
175
+ # Print full CI configuration
176
+ glreview ci-config
177
+ ```
178
+
179
+ **Basic setup** - sync registry and generate coverage on MRs and main:
180
+
181
+ ```yaml
182
+ review-sync:
183
+ script:
184
+ - pip install glreview
185
+ - glreview report --sync --commit -m "chore: update review registry [skip ci]"
186
+ - git push # Push updated registry
187
+ rules:
188
+ - if: $CI_PIPELINE_SOURCE == "merge_request_event"
189
+ - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
190
+ ```
191
+
192
+ **Release gate** - require 100% coverage for releases:
193
+
194
+ ```yaml
195
+ release-gate:
196
+ script:
197
+ - pip install glreview
198
+ - glreview report --format json | python -c "
199
+ import sys,json
200
+ c = json.load(sys.stdin)['coverage_pct']
201
+ sys.exit(0 if c == 100 else 1)
202
+ "
203
+ rules:
204
+ - if: $CI_COMMIT_TAG
205
+ ```
206
+
207
+ Run `glreview ci-config` for complete configuration with proper git push setup.
208
+
209
+ ## License
210
+
211
+ MIT
@@ -0,0 +1,174 @@
1
+ # glreview
2
+
3
+ GitLab code review tracking for scientific software.
4
+
5
+ ## Features
6
+
7
+ - **Track review status** of source modules with git commit precision
8
+ - **GitLab integration** - creates issues, verifies completion, closes on cancel
9
+ - **AI-assisted review** - Claude Code integration for automated analysis
10
+ - **Change detection** - warns if code changes during review
11
+ - **Module analysis** - shows classes/functions in review issues
12
+ - **Customizable templates** - Jinja2-based issue templates
13
+ - **CI-friendly** - exit codes for automated checks
14
+ - **Priority rules** - pattern-based priority assignment
15
+
16
+ ## Installation
17
+
18
+ ```bash
19
+ pip install glreview
20
+ ```
21
+
22
+ ## GitLab Authentication
23
+
24
+ For GitLab integration, set an environment variable:
25
+
26
+ ```bash
27
+ export GITLAB_PRIVATE_TOKEN=glpat-xxxxxxxxxxxx
28
+
29
+ # For self-hosted GitLab
30
+ export GITLAB_URL=https://gitlab.example.com
31
+ ```
32
+
33
+ In CI pipelines, `CI_JOB_TOKEN` is used automatically.
34
+
35
+ ## Quick Start
36
+
37
+ ```bash
38
+ # Initialize in your project
39
+ glreview init
40
+
41
+ # Check status
42
+ glreview status
43
+
44
+ # Start a review (creates GitLab issue)
45
+ glreview start src/mymodule/core.py --assignee @reviewer
46
+
47
+ # After review is complete (issue closed)
48
+ glreview signoff src/mymodule/core.py
49
+ ```
50
+
51
+ ## Commands
52
+
53
+ | Command | Description |
54
+ |---------|-------------|
55
+ | `glreview init` | Initialize (idempotent - safe to re-run) |
56
+ | `glreview status` | Show review progress and module status |
57
+ | `glreview start PATH` | Start a review (creates GitLab issue) |
58
+ | `glreview signoff PATH` | Sign off on a completed review |
59
+ | `glreview cancel PATH` | Cancel or restart a review |
60
+ | `glreview claude-review PATH` | Run AI-assisted review with Claude |
61
+ | `glreview report` | Generate coverage report (markdown/json/badge) |
62
+ | `glreview list` | List all modules |
63
+ | `glreview reviewers` | List available reviewers |
64
+ | `glreview check` | CI check for changes |
65
+ | `glreview sync` | Sync registry with filesystem |
66
+ | `glreview ci-config` | Print recommended GitLab CI configuration |
67
+
68
+ ## Review Lifecycle
69
+
70
+ ```
71
+ ┌─────────────┐
72
+ │ needs_review│◄──────────────────┐
73
+ └──────┬──────┘ │
74
+ │ start │ cancel
75
+ ▼ │
76
+ ┌─────────────┐ │
77
+ │ in_progress │───────────────────┤
78
+ └──────┬──────┘ │
79
+ │ signoff │
80
+ ▼ │
81
+ ┌─────────────┐ code changes │
82
+ │ reviewed │───────────────────┘
83
+ └─────────────┘ (re-review)
84
+ ```
85
+
86
+ **Key behaviors:**
87
+ - `signoff` warns if file changed during review (use `--acknowledge` to proceed)
88
+ - `cancel` closes the GitLab issue by default (use `--leave-open` to skip)
89
+ - `cancel --restart` keeps the issue open and updates the start commit
90
+
91
+ ## AI-Assisted Review
92
+
93
+ Use Claude Code for automated code analysis:
94
+
95
+ ```bash
96
+ # Run review (requires claude CLI)
97
+ glreview claude-review src/module.py
98
+
99
+ # Post findings to GitLab issue
100
+ glreview claude-review src/module.py --post
101
+
102
+ # Preview prompt without running
103
+ glreview claude-review src/module.py --dry-run
104
+ ```
105
+
106
+ Reviews check: correctness, scientific rigor, robustness, and maintainability.
107
+ Large files are automatically chunked.
108
+
109
+ ## Configuration
110
+
111
+ Add to `pyproject.toml`:
112
+
113
+ ```toml
114
+ [tool.glreview]
115
+ sources = ["src/**/*.py"]
116
+ exclude = ["**/_version.py", "**/test_*.py"]
117
+
118
+ # Custom issue template (optional)
119
+ issue_template = ".glreview/issue_template.md"
120
+
121
+ # Priority rules (first match wins)
122
+ [[tool.glreview.priority]]
123
+ pattern = "src/**/core.py"
124
+ level = "critical"
125
+ reviewers_required = 2
126
+
127
+ [[tool.glreview.priority]]
128
+ pattern = "src/**/*.py"
129
+ level = "medium"
130
+ reviewers_required = 1
131
+ ```
132
+
133
+ ## CI Integration
134
+
135
+ glreview can automatically sync and report on every push:
136
+
137
+ ```bash
138
+ # Print full CI configuration
139
+ glreview ci-config
140
+ ```
141
+
142
+ **Basic setup** - sync registry and generate coverage on MRs and main:
143
+
144
+ ```yaml
145
+ review-sync:
146
+ script:
147
+ - pip install glreview
148
+ - glreview report --sync --commit -m "chore: update review registry [skip ci]"
149
+ - git push # Push updated registry
150
+ rules:
151
+ - if: $CI_PIPELINE_SOURCE == "merge_request_event"
152
+ - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
153
+ ```
154
+
155
+ **Release gate** - require 100% coverage for releases:
156
+
157
+ ```yaml
158
+ release-gate:
159
+ script:
160
+ - pip install glreview
161
+ - glreview report --format json | python -c "
162
+ import sys,json
163
+ c = json.load(sys.stdin)['coverage_pct']
164
+ sys.exit(0 if c == 100 else 1)
165
+ "
166
+ rules:
167
+ - if: $CI_COMMIT_TAG
168
+ ```
169
+
170
+ Run `glreview ci-config` for complete configuration with proper git push setup.
171
+
172
+ ## License
173
+
174
+ MIT
@@ -0,0 +1,92 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0", "setuptools_scm[toml]>=6.2"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "glreview"
7
+ dynamic = ["version"]
8
+ description = "GitLab code review tracking for scientific software"
9
+ readme = "README.md"
10
+ license = {text = "MIT"}
11
+ requires-python = ">=3.10"
12
+ authors = [
13
+ {name = "Chad Hanna", email = "chad.hanna@ligo.org"},
14
+ ]
15
+ classifiers = [
16
+ "Development Status :: 4 - Beta",
17
+ "Environment :: Console",
18
+ "Intended Audience :: Developers",
19
+ "Intended Audience :: Science/Research",
20
+ "License :: OSI Approved :: MIT License",
21
+ "Operating System :: OS Independent",
22
+ "Programming Language :: Python :: 3",
23
+ "Programming Language :: Python :: 3.10",
24
+ "Programming Language :: Python :: 3.11",
25
+ "Programming Language :: Python :: 3.12",
26
+ "Topic :: Software Development :: Quality Assurance",
27
+ "Topic :: Software Development :: Version Control :: Git",
28
+ ]
29
+ keywords = ["gitlab", "code-review", "scientific-software", "ci-cd"]
30
+ dependencies = [
31
+ "click>=8.0",
32
+ "jinja2>=3.0",
33
+ "python-gitlab>=4.0",
34
+ "tomli>=2.0;python_version<'3.11'",
35
+ ]
36
+
37
+ [project.optional-dependencies]
38
+ dev = [
39
+ "pytest>=8.0",
40
+ "pytest-cov",
41
+ "black",
42
+ "isort",
43
+ "flake8",
44
+ "mypy",
45
+ ]
46
+
47
+ [project.scripts]
48
+ glreview = "glreview.cli:main"
49
+
50
+ [project.urls]
51
+ Homepage = "https://git.ligo.org/chad.hanna/glreview"
52
+ Documentation = "https://git.ligo.org/chad.hanna/glreview"
53
+ Repository = "https://git.ligo.org/chad.hanna/glreview"
54
+ Issues = "https://git.ligo.org/chad.hanna/glreview/-/issues"
55
+
56
+ [tool.setuptools_scm]
57
+ write_to = "src/glreview/_version.py"
58
+
59
+ [tool.setuptools.packages.find]
60
+ where = ["src"]
61
+
62
+ [tool.setuptools.package-data]
63
+ glreview = ["templates/*"]
64
+
65
+ [tool.black]
66
+ line-length = 88
67
+
68
+ [tool.isort]
69
+ profile = "black"
70
+
71
+ [tool.mypy]
72
+ ignore_missing_imports = true
73
+
74
+ [tool.pytest.ini_options]
75
+ testpaths = ["tests"]
76
+ addopts = "-v"
77
+
78
+ # Example glreview configuration (for self-hosting)
79
+ [tool.glreview]
80
+ sources = ["src/**/*.py"]
81
+ exclude = ["**/_version.py"]
82
+ registry = "review_registry.json"
83
+
84
+ [[tool.glreview.priority]]
85
+ pattern = "src/glreview/cli.py"
86
+ level = "critical"
87
+ reviewers_required = 2
88
+
89
+ [[tool.glreview.priority]]
90
+ pattern = "src/glreview/*.py"
91
+ level = "high"
92
+ reviewers_required = 1
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,8 @@
1
+ """glreview - GitLab code review tracking for scientific software."""
2
+
3
+ try:
4
+ from ._version import version as __version__
5
+ except ImportError:
6
+ __version__ = "0.0.0.dev0"
7
+
8
+ __all__ = ["__version__"]
@@ -0,0 +1,34 @@
1
+ # file generated by setuptools-scm
2
+ # don't change, don't track in version control
3
+
4
+ __all__ = [
5
+ "__version__",
6
+ "__version_tuple__",
7
+ "version",
8
+ "version_tuple",
9
+ "__commit_id__",
10
+ "commit_id",
11
+ ]
12
+
13
+ TYPE_CHECKING = False
14
+ if TYPE_CHECKING:
15
+ from typing import Tuple
16
+ from typing import Union
17
+
18
+ VERSION_TUPLE = Tuple[Union[int, str], ...]
19
+ COMMIT_ID = Union[str, None]
20
+ else:
21
+ VERSION_TUPLE = object
22
+ COMMIT_ID = object
23
+
24
+ version: str
25
+ __version__: str
26
+ __version_tuple__: VERSION_TUPLE
27
+ version_tuple: VERSION_TUPLE
28
+ commit_id: COMMIT_ID
29
+ __commit_id__: COMMIT_ID
30
+
31
+ __version__ = version = '0.1.0'
32
+ __version_tuple__ = version_tuple = (0, 1, 0)
33
+
34
+ __commit_id__ = commit_id = 'gbb35870ad'