argus-proof 0.2.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.
Files changed (83) hide show
  1. argus_proof-0.2.0/.copier-answers.yml +21 -0
  2. argus_proof-0.2.0/.env.example +46 -0
  3. argus_proof-0.2.0/.github/workflows/ci.yml +20 -0
  4. argus_proof-0.2.0/.github/workflows/release.yml +106 -0
  5. argus_proof-0.2.0/.gitignore +11 -0
  6. argus_proof-0.2.0/Dockerfile +27 -0
  7. argus_proof-0.2.0/LICENSE +21 -0
  8. argus_proof-0.2.0/Makefile +27 -0
  9. argus_proof-0.2.0/PKG-INFO +456 -0
  10. argus_proof-0.2.0/README.md +387 -0
  11. argus_proof-0.2.0/pyproject.toml +99 -0
  12. argus_proof-0.2.0/schema/proof-wire.schema.json +1418 -0
  13. argus_proof-0.2.0/src/argus_proof/__init__.py +16 -0
  14. argus_proof-0.2.0/src/argus_proof/_version.py +24 -0
  15. argus_proof-0.2.0/src/argus_proof/acceptance.py +118 -0
  16. argus_proof-0.2.0/src/argus_proof/archive.py +168 -0
  17. argus_proof-0.2.0/src/argus_proof/backends/__init__.py +67 -0
  18. argus_proof-0.2.0/src/argus_proof/backends/a1111.py +150 -0
  19. argus_proof-0.2.0/src/argus_proof/backends/base.py +170 -0
  20. argus_proof-0.2.0/src/argus_proof/backends/comfyui.py +228 -0
  21. argus_proof-0.2.0/src/argus_proof/backends/diffusers.py +256 -0
  22. argus_proof-0.2.0/src/argus_proof/backends/http.py +94 -0
  23. argus_proof-0.2.0/src/argus_proof/backends/pnginfo.py +73 -0
  24. argus_proof-0.2.0/src/argus_proof/backends/remote.py +157 -0
  25. argus_proof-0.2.0/src/argus_proof/backends/workflow.py +144 -0
  26. argus_proof-0.2.0/src/argus_proof/cli.py +467 -0
  27. argus_proof-0.2.0/src/argus_proof/crossrun.py +341 -0
  28. argus_proof-0.2.0/src/argus_proof/evaluate.py +269 -0
  29. argus_proof-0.2.0/src/argus_proof/experiment.py +314 -0
  30. argus_proof-0.2.0/src/argus_proof/explore.py +283 -0
  31. argus_proof-0.2.0/src/argus_proof/grid.py +324 -0
  32. argus_proof-0.2.0/src/argus_proof/hashing.py +37 -0
  33. argus_proof-0.2.0/src/argus_proof/models.py +661 -0
  34. argus_proof-0.2.0/src/argus_proof/moderation.py +356 -0
  35. argus_proof-0.2.0/src/argus_proof/py.typed +1 -0
  36. argus_proof-0.2.0/src/argus_proof/recommend.py +280 -0
  37. argus_proof-0.2.0/src/argus_proof/refinement.py +117 -0
  38. argus_proof-0.2.0/src/argus_proof/reports.py +258 -0
  39. argus_proof-0.2.0/src/argus_proof/scoring/__init__.py +33 -0
  40. argus_proof-0.2.0/src/argus_proof/scoring/base.py +94 -0
  41. argus_proof-0.2.0/src/argus_proof/scoring/gate.py +66 -0
  42. argus_proof-0.2.0/src/argus_proof/scoring/orchestrator.py +135 -0
  43. argus_proof-0.2.0/src/argus_proof/scoring/scorers/__init__.py +42 -0
  44. argus_proof-0.2.0/src/argus_proof/scoring/scorers/_util.py +84 -0
  45. argus_proof-0.2.0/src/argus_proof/scoring/scorers/identity.py +156 -0
  46. argus_proof-0.2.0/src/argus_proof/scoring/scorers/phash.py +138 -0
  47. argus_proof-0.2.0/src/argus_proof/scoring/scorers/quality.py +196 -0
  48. argus_proof-0.2.0/src/argus_proof/scoring/scorers/safety.py +144 -0
  49. argus_proof-0.2.0/src/argus_proof/scoring/summary.py +111 -0
  50. argus_proof-0.2.0/src/argus_proof/server/__init__.py +5 -0
  51. argus_proof-0.2.0/src/argus_proof/server/app.py +451 -0
  52. argus_proof-0.2.0/src/argus_proof/stats.py +83 -0
  53. argus_proof-0.2.0/src/argus_proof/templates/comfyui_sdxl_lora.json +55 -0
  54. argus_proof-0.2.0/tests/fakebackend.py +74 -0
  55. argus_proof-0.2.0/tests/pnghelpers.py +28 -0
  56. argus_proof-0.2.0/tests/test_a1111_backend.py +124 -0
  57. argus_proof-0.2.0/tests/test_acceptance.py +130 -0
  58. argus_proof-0.2.0/tests/test_archive.py +189 -0
  59. argus_proof-0.2.0/tests/test_backends.py +251 -0
  60. argus_proof-0.2.0/tests/test_cli.py +308 -0
  61. argus_proof-0.2.0/tests/test_crossrun.py +282 -0
  62. argus_proof-0.2.0/tests/test_diffusers_backend.py +91 -0
  63. argus_proof-0.2.0/tests/test_evaluate.py +139 -0
  64. argus_proof-0.2.0/tests/test_experiment.py +346 -0
  65. argus_proof-0.2.0/tests/test_explore.py +168 -0
  66. argus_proof-0.2.0/tests/test_grid.py +223 -0
  67. argus_proof-0.2.0/tests/test_models.py +245 -0
  68. argus_proof-0.2.0/tests/test_moderation.py +202 -0
  69. argus_proof-0.2.0/tests/test_pnginfo.py +29 -0
  70. argus_proof-0.2.0/tests/test_recommend.py +273 -0
  71. argus_proof-0.2.0/tests/test_refinement.py +177 -0
  72. argus_proof-0.2.0/tests/test_remote_backend.py +146 -0
  73. argus_proof-0.2.0/tests/test_reports.py +170 -0
  74. argus_proof-0.2.0/tests/test_scorer_util.py +91 -0
  75. argus_proof-0.2.0/tests/test_scorers_identity.py +168 -0
  76. argus_proof-0.2.0/tests/test_scorers_phash.py +124 -0
  77. argus_proof-0.2.0/tests/test_scorers_quality.py +138 -0
  78. argus_proof-0.2.0/tests/test_scorers_safety.py +146 -0
  79. argus_proof-0.2.0/tests/test_scoring.py +271 -0
  80. argus_proof-0.2.0/tests/test_server.py +414 -0
  81. argus_proof-0.2.0/tests/test_smoke.py +8 -0
  82. argus_proof-0.2.0/tests/test_stats.py +45 -0
  83. argus_proof-0.2.0/tests/test_workflow.py +100 -0
@@ -0,0 +1,21 @@
1
+ # Managed by Copier — do not edit by hand.
2
+ # Run `copier update` in this repo to pull template changes.
3
+ _commit: e7a0753
4
+ _src_path: argus-pkg-template
5
+ author: smk762
6
+ cli_name: argus-proof
7
+ description: 'Post-training LoRA evaluation and optimisation: generate samples from
8
+ a trained LoRA and score them against the curated dataset it was trained from'
9
+ dockerfile: Dockerfile
10
+ github_owner: smk762
11
+ has_cli: true
12
+ has_server: true
13
+ image_name: argus-proof
14
+ package_name: argus_proof
15
+ post_test: ''
16
+ project_name: argus-proof
17
+ python_min: '3.11'
18
+ ruff_pin: 0.15.16
19
+ test_extras: dev,server,cli
20
+ version_build_arg: false
21
+
@@ -0,0 +1,46 @@
1
+ # ── Server ───────────────────────────────────────────────────────────
2
+ # Host port for the argus-proof FastAPI server (peer to lens :8100,
3
+ # curator :8101, quarry :8102, forge :8103).
4
+ PROOF_PORT=8104
5
+
6
+ # ── Generation backend ───────────────────────────────────────────────
7
+ # Which engine generates the eval grid (argus_proof.backends.get_backend).
8
+ # Swapping this changes nothing in scoring/report code.
9
+ # comfyui — a running ComfyUI instance
10
+ # diffusers — in-process diffusers SDXL pipeline (needs the [diffusers] extra)
11
+ # a1111 — an AUTOMATIC1111 / SD.Next /sdapi server
12
+ # remote — a hosted/cloud endpoint that speaks the proof wire
13
+ PROOF_BACKEND=comfyui
14
+
15
+ # Local model directory (for comfyui / diffusers / a1111 — checkpoints + LoRAs
16
+ # are resolved and SHA256-pinned into the manifest from here). GET /models lists
17
+ # <dir>/checkpoints and <dir>/loras (the ComfyUI layout). Several roots may be
18
+ # given PATH-style (dir1:dir2), mirroring ComfyUI's extra_model_paths trees.
19
+ PROOF_MODELS_DIR=~/models
20
+
21
+ # ComfyUI workflow template (API-format graph with $placeholders). Unset = the
22
+ # packaged SDXL+LoRA example (argus_proof/templates/comfyui_sdxl_lora.json).
23
+ #PROOF_WORKFLOW_TEMPLATE=/path/to/workflow.json
24
+
25
+ # ── Storage ──────────────────────────────────────────────────────────
26
+ # Where scored EvalReports live (<run_id>.json). Compose mounts a volume here.
27
+ #ARGUS_PROOF_REPORTS_DIR=reports
28
+ # Where generated runs land (<run_id>/ with manifest.json + images); also the
29
+ # root GET /report/{run_id}/image/{image_id} serves from.
30
+ #ARGUS_PROOF_RUNS_DIR=runs
31
+ # Where curator exports are read from (GET /exports + POST /run/stream's
32
+ # `export` field name-resolves under this root).
33
+ #ARGUS_PROOF_EXPORTS_DIR=/data/out
34
+
35
+ # Replay/demo mode (issue #45): serve stored reports read-only and 403 all live
36
+ # GPU eval + writes — for the GPU-less public demo host. Point the two dirs above
37
+ # at the seeded "tape" reports/runs when this is on. GET /health echoes the flag.
38
+ #ARGUS_PROOF_READ_ONLY=1
39
+
40
+ # HTTP backends — the engine's base URL.
41
+ COMFYUI_BASE_URL=http://127.0.0.1:8188
42
+ A1111_BASE_URL=http://127.0.0.1:7860
43
+
44
+ # remote (cloud) backend — the hosted generation endpoint + its bearer token.
45
+ PROOF_REMOTE_URL=https://your-proof-gen.example.com
46
+ PROOF_REMOTE_API_KEY=
@@ -0,0 +1,20 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ concurrency:
10
+ group: ci-${{ github.ref }}
11
+ cancel-in-progress: true
12
+
13
+ jobs:
14
+ ci:
15
+ uses: smk762/argus-ci/.github/workflows/python-ci.yml@v1
16
+ with:
17
+ ruff-version: "0.15.16"
18
+ test-extras: "dev,server,cli"
19
+ post-test: "uv run --no-sync argus-proof schema --check"
20
+
@@ -0,0 +1,106 @@
1
+ name: Release to PyPI
2
+
3
+ # Top-level (non-reusable) on purpose: PyPI trusted publishing cannot run inside
4
+ # a reusable workflow. Keep this file in sync across the suite via `copier update`.
5
+
6
+ on:
7
+ push:
8
+ tags: ["v*"]
9
+
10
+ permissions:
11
+ contents: read
12
+ id-token: write
13
+
14
+ jobs:
15
+ build:
16
+ runs-on: ubuntu-latest
17
+ steps:
18
+ - uses: actions/checkout@v4
19
+ with:
20
+ fetch-depth: 0
21
+ - uses: astral-sh/setup-uv@v6
22
+ with:
23
+ enable-cache: true
24
+ - run: uv build
25
+ - uses: actions/upload-artifact@v4
26
+ with:
27
+ name: dist
28
+ path: dist/
29
+
30
+ test-install:
31
+ runs-on: ubuntu-latest
32
+ needs: build
33
+ strategy:
34
+ matrix:
35
+ python-version: ["3.11", "3.12"]
36
+ steps:
37
+ - uses: actions/download-artifact@v4
38
+ with:
39
+ name: dist
40
+ path: dist/
41
+ - uses: astral-sh/setup-uv@v6
42
+ with:
43
+ enable-cache: true
44
+ - name: Install wheel and smoke-test import
45
+ run: |
46
+ uv venv --python ${{ matrix.python-version }}
47
+ uv pip install dist/*.whl
48
+ uv run --no-sync python -c "import argus_proof; print(f'argus-proof {argus_proof.__version__} OK')"
49
+
50
+ publish-testpypi:
51
+ runs-on: ubuntu-latest
52
+ needs: test-install
53
+ environment: testpypi
54
+ steps:
55
+ - uses: actions/download-artifact@v4
56
+ with:
57
+ name: dist
58
+ path: dist/
59
+ - uses: pypa/gh-action-pypi-publish@release/v1
60
+ with:
61
+ repository-url: https://test.pypi.org/legacy/
62
+
63
+ publish-pypi:
64
+ runs-on: ubuntu-latest
65
+ needs: publish-testpypi
66
+ environment: pypi
67
+ steps:
68
+ - uses: actions/download-artifact@v4
69
+ with:
70
+ name: dist
71
+ path: dist/
72
+ - uses: pypa/gh-action-pypi-publish@release/v1
73
+
74
+ publish-image:
75
+ runs-on: ubuntu-latest
76
+ needs: test-install
77
+ permissions:
78
+ contents: read
79
+ packages: write
80
+ steps:
81
+ - uses: actions/checkout@v4
82
+ with:
83
+ fetch-depth: 0 # hatch-vcs reads the tag from git history
84
+ - uses: docker/setup-buildx-action@v3
85
+ - uses: docker/login-action@v3
86
+ with:
87
+ registry: ghcr.io
88
+ username: ${{ github.actor }}
89
+ password: ${{ secrets.GITHUB_TOKEN }}
90
+ - id: meta
91
+ uses: docker/metadata-action@v5
92
+ with:
93
+ images: ghcr.io/${{ github.repository_owner }}/argus-proof
94
+ tags: |
95
+ type=semver,pattern={{version}}
96
+ type=semver,pattern={{major}}.{{minor}}
97
+ type=raw,value=latest
98
+ - uses: docker/build-push-action@v6
99
+ with:
100
+ context: .
101
+ file: ./Dockerfile
102
+ push: true
103
+ tags: ${{ steps.meta.outputs.tags }}
104
+ labels: ${{ steps.meta.outputs.labels }}
105
+ cache-from: type=gha
106
+ cache-to: type=gha,mode=max
@@ -0,0 +1,11 @@
1
+ .venv/
2
+ __pycache__/
3
+ *.pyc
4
+ dist/
5
+ build/
6
+ *.egg-info/
7
+ .pytest_cache/
8
+ .ruff_cache/
9
+ # hatch-vcs writes this at build time (version derived from git tags)
10
+ src/argus_proof/_version.py
11
+ uv.lock
@@ -0,0 +1,27 @@
1
+ # syntax=docker/dockerfile:1
2
+ FROM python:3.11-slim
3
+
4
+ COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
5
+
6
+ WORKDIR /app
7
+
8
+ # hatch-vcs derives the version from git history, so the build context must
9
+ # include .git (keep it out of .dockerignore for this image) and the image
10
+ # needs the git binary for setuptools-scm to read it (slim ships without it).
11
+ RUN apt-get update \
12
+ && apt-get install -y --no-install-recommends git \
13
+ && rm -rf /var/lib/apt/lists/*
14
+
15
+ COPY . .
16
+
17
+ # Extras baked into the image. Default keeps it light; build with
18
+ # EXTRAS="server,cli,score" for the full scorer stack (torch, insightface, …).
19
+ ARG EXTRAS="server,cli"
20
+
21
+ # pillow + imagehash ride along regardless: they power phash near-dup collapse
22
+ # and diversity (honest group pass-rates) at negligible image cost.
23
+ RUN uv pip install --system --no-cache ".[${EXTRAS}]" pillow imagehash
24
+
25
+ EXPOSE 8104
26
+ CMD ["argus-proof", "serve", "--port", "8104", "--cors"]
27
+
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 smk762
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,27 @@
1
+ UV ?= uv
2
+
3
+ .PHONY: help install lint format test build clean
4
+
5
+ help: ## Show this help
6
+ @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-12s\033[0m %s\n", $$1, $$2}'
7
+
8
+ install: ## Create venv and install with test extras
9
+ $(UV) venv
10
+ $(UV) pip install -e ".[dev,server,cli]"
11
+
12
+ lint: ## Ruff check + format check
13
+ $(UV)x ruff@0.15.16 check src/ tests/
14
+ $(UV)x ruff@0.15.16 format --check src/ tests/
15
+
16
+ format: ## Ruff autoformat + autofix
17
+ $(UV)x ruff@0.15.16 format src/ tests/
18
+ $(UV)x ruff@0.15.16 check --fix src/ tests/
19
+
20
+ test: ## Run the test suite
21
+ $(UV) run --no-sync pytest --tb=short -q
22
+
23
+ build: ## Build sdist + wheel
24
+ $(UV) build
25
+
26
+ clean: ## Remove build + cache artifacts
27
+ rm -rf dist build .venv *.egg-info .pytest_cache .ruff_cache src/argus_proof/_version.py