git-analyser 0.2.2__tar.gz → 0.3.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.
- {git_analyser-0.2.2 → git_analyser-0.3.0}/PKG-INFO +1 -1
- {git_analyser-0.2.2 → git_analyser-0.3.0}/pyproject.toml +1 -1
- {git_analyser-0.2.2 → git_analyser-0.3.0}/src/git_analyser/api.py +6 -0
- {git_analyser-0.2.2 → git_analyser-0.3.0}/src/git_analyser/cli.py +10 -2
- git_analyser-0.3.0/src/git_analyser/manifest.py +26 -0
- {git_analyser-0.2.2 → git_analyser-0.3.0}/uv.lock +1 -1
- {git_analyser-0.2.2 → git_analyser-0.3.0}/.gitignore +0 -0
- {git_analyser-0.2.2 → git_analyser-0.3.0}/LICENSE +0 -0
- {git_analyser-0.2.2 → git_analyser-0.3.0}/README.md +0 -0
- {git_analyser-0.2.2 → git_analyser-0.3.0}/src/git_analyser/__init__.py +0 -0
- {git_analyser-0.2.2 → git_analyser-0.3.0}/src/git_analyser/core.py +0 -0
- {git_analyser-0.2.2 → git_analyser-0.3.0}/src/git_analyser/models.py +0 -0
- {git_analyser-0.2.2 → git_analyser-0.3.0}/tests/conftest.py +0 -0
- {git_analyser-0.2.2 → git_analyser-0.3.0}/tests/test_api.py +0 -0
- {git_analyser-0.2.2 → git_analyser-0.3.0}/tests/test_cli.py +0 -0
- {git_analyser-0.2.2 → git_analyser-0.3.0}/tests/test_core.py +0 -0
- {git_analyser-0.2.2 → git_analyser-0.3.0}/tests/test_invariants.py +0 -0
- {git_analyser-0.2.2 → git_analyser-0.3.0}/tests/test_suspicious_patterns.py +0 -0
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "git-analyser"
|
|
7
|
-
version = "0.
|
|
7
|
+
version = "0.3.0"
|
|
8
8
|
description = "Git repository analyser — commit history, churn, contributor patterns, dispatches to analyser family"
|
|
9
9
|
authors = [{name = "Michael Borck", email = "michael.borck@curtin.edu.au"}]
|
|
10
10
|
readme = "README.md"
|
|
@@ -3,6 +3,7 @@ from fastapi import FastAPI, HTTPException
|
|
|
3
3
|
from pydantic import BaseModel
|
|
4
4
|
|
|
5
5
|
from .core import analyse_repo
|
|
6
|
+
from .manifest import MANIFEST
|
|
6
7
|
from .models import GitAnalysisResult
|
|
7
8
|
|
|
8
9
|
app = FastAPI(title="git-analyser", version=version("git-analyser"))
|
|
@@ -17,6 +18,11 @@ def health():
|
|
|
17
18
|
return {"status": "ok", "version": version("git-analyser")}
|
|
18
19
|
|
|
19
20
|
|
|
21
|
+
@app.get("/manifest")
|
|
22
|
+
def manifest():
|
|
23
|
+
return MANIFEST
|
|
24
|
+
|
|
25
|
+
|
|
20
26
|
@app.post("/analyse", response_model=GitAnalysisResult)
|
|
21
27
|
def analyse(req: AnalyseRequest):
|
|
22
28
|
result = analyse_repo(req.repo)
|
|
@@ -29,6 +29,9 @@ def _build_parser() -> argparse.ArgumentParser:
|
|
|
29
29
|
serve.add_argument("--host", default="127.0.0.1")
|
|
30
30
|
serve.add_argument("--port", type=int, default=8007)
|
|
31
31
|
|
|
32
|
+
# manifest subcommand
|
|
33
|
+
sub.add_parser("manifest", help="Print the capability manifest as JSON")
|
|
34
|
+
|
|
32
35
|
# analyse subcommand (also the default when no subcommand is given)
|
|
33
36
|
analyse = sub.add_parser("analyse", help="Analyse a git repository (default)")
|
|
34
37
|
analyse.add_argument(
|
|
@@ -46,13 +49,18 @@ def main() -> None:
|
|
|
46
49
|
argv = sys.argv[1:]
|
|
47
50
|
|
|
48
51
|
# If first positional arg is not a known subcommand, inject "analyse"
|
|
49
|
-
known_commands = {"serve", "analyse", "--help", "-h", "--version"}
|
|
50
|
-
if argv and not argv[0].startswith("-") and argv[0] not in {"serve", "analyse"}:
|
|
52
|
+
known_commands = {"serve", "analyse", "manifest", "--help", "-h", "--version"}
|
|
53
|
+
if argv and not argv[0].startswith("-") and argv[0] not in {"serve", "analyse", "manifest"}:
|
|
51
54
|
argv = ["analyse"] + argv
|
|
52
55
|
|
|
53
56
|
parser = _build_parser()
|
|
54
57
|
args = parser.parse_args(argv)
|
|
55
58
|
|
|
59
|
+
if args.command == "manifest":
|
|
60
|
+
from .manifest import MANIFEST
|
|
61
|
+
print(json.dumps(MANIFEST, indent=2))
|
|
62
|
+
return
|
|
63
|
+
|
|
56
64
|
if args.command == "serve":
|
|
57
65
|
uvicorn.run(
|
|
58
66
|
"git_analyser.api:app",
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"""Capability manifest for the lens family (consumed by auto-analyser).
|
|
2
|
+
|
|
3
|
+
git-analyser is invoked on a repository path/zip rather than a file extension, so
|
|
4
|
+
it claims no extensions for auto-routing (auto-analyser reaches it explicitly).
|
|
5
|
+
"""
|
|
6
|
+
from __future__ import annotations
|
|
7
|
+
|
|
8
|
+
from importlib.metadata import PackageNotFoundError, version
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def _version() -> str:
|
|
12
|
+
try:
|
|
13
|
+
return version("git-analyser")
|
|
14
|
+
except PackageNotFoundError:
|
|
15
|
+
return "0.0.0"
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
MANIFEST: dict = {
|
|
19
|
+
"name": "git-analyser",
|
|
20
|
+
"version": _version(),
|
|
21
|
+
"role": "analyser",
|
|
22
|
+
"accepts": ["git-repo"],
|
|
23
|
+
"extensions": [],
|
|
24
|
+
"auto_routable": False,
|
|
25
|
+
"produces": "GitAnalysisResult",
|
|
26
|
+
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|