Skip to content

Commit a823cf3

Browse files
committed
chore: refresh contrib template scaffolding
1 parent 9004ea3 commit a823cf3

3 files changed

Lines changed: 131 additions & 10 deletions

File tree

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
.PHONY: help test lint lint-fix typecheck check build
2+
3+
PACKAGE_DIR := $(notdir $(abspath $(CURDIR)))
4+
COVERAGE_XML := ../../../coverage-evaluators-$(PACKAGE_DIR).xml
5+
6+
help:
7+
@echo "Agent Control contrib evaluator template"
8+
@echo ""
9+
@echo " make test - run pytest"
10+
@echo " make lint - run ruff check"
11+
@echo " make lint-fix - run ruff check --fix"
12+
@echo " make typecheck - run mypy"
13+
@echo " make check - run lint, typecheck, and tests"
14+
@echo " make build - build package"
15+
16+
test:
17+
uv run --with pytest --with pytest-asyncio --with pytest-cov pytest tests --cov=src --cov-report=xml:$(COVERAGE_XML) -q
18+
19+
lint:
20+
uv run --with ruff ruff check --config ../../../pyproject.toml src/
21+
22+
lint-fix:
23+
uv run --with ruff ruff check --config ../../../pyproject.toml --fix src/
24+
25+
typecheck:
26+
uv run --with mypy mypy --config-file ../../../pyproject.toml src/
27+
28+
check: lint typecheck test
29+
30+
build:
31+
uv build
Lines changed: 90 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,93 @@
1-
# Evaluator Template
1+
# Contrib Evaluator Template
22

3-
Starter template for creating a custom evaluator package.
3+
This directory is scaffolding for a new contrib evaluator package.
4+
5+
It is intentionally excluded from repo automation until you convert it into a real package. In
6+
particular, `template/` does not participate in root `make check`, CI, semantic-release, or
7+
publishing because it ships a `pyproject.toml.template` placeholder instead of a real
8+
`pyproject.toml`.
9+
10+
## Naming contract
11+
12+
Pick `<name>` as a short lowercase single-word identifier such as `galileo`, `cisco`, or
13+
`budget`. That same value should appear in the steady-state package shape:
14+
15+
- directory: `evaluators/contrib/<name>/`
16+
- pip package: `agent-control-evaluator-<name>`
17+
- Python module: `agent_control_evaluator_<name>`
18+
- extra name: `agent-control-evaluators[<name>]`
19+
- entry-point namespace: `<name>.<evaluator_id>`
20+
21+
The template uses `{{NAME}}` for that package identifier. It does not use `{{ORG}}`.
22+
23+
## Scaffold a new contrib package
24+
25+
1. Copy the template and rename the manifest:
26+
27+
```bash
28+
cp -r evaluators/contrib/template evaluators/contrib/<name>
29+
mv evaluators/contrib/<name>/pyproject.toml.template \
30+
evaluators/contrib/<name>/pyproject.toml
31+
```
32+
33+
2. Replace placeholders in `pyproject.toml`:
34+
35+
- `{{NAME}}` -> contrib package identifier
36+
- `{{EVALUATOR}}` -> evaluator snake_case id
37+
- `{{CLASS}}` -> evaluator class name
38+
- `{{AUTHOR}}` -> authoring team
39+
40+
3. Add package code and tests:
41+
42+
- `src/agent_control_evaluator_<name>/`
43+
- `tests/`
44+
45+
4. Validate the package locally:
46+
47+
```bash
48+
make lint
49+
make lint-fix
50+
make typecheck
51+
make test
52+
make check
53+
make build
54+
```
55+
56+
## Canonical install docs
57+
58+
Contributor-facing and user-facing package docs should treat this as the canonical install path:
59+
60+
```bash
61+
pip install "agent-control-evaluators[<name>]"
62+
```
63+
64+
Direct wheel installs such as `pip install agent-control-evaluator-<name>` can still be
65+
documented, but they are secondary to the extra on `agent-control-evaluators`.
66+
67+
## Expected repo wiring
68+
69+
After the new package exists as a real contrib package, wire it into the repo contract:
70+
71+
1. Add the extra to `evaluators/builtin/pyproject.toml`:
72+
73+
```toml
74+
[project.optional-dependencies]
75+
<name> = ["agent-control-evaluator-<name>>=<current-version>"]
76+
```
77+
78+
2. Add the workspace source pin to `evaluators/builtin/pyproject.toml`:
79+
80+
```toml
81+
[tool.uv.sources]
82+
agent-control-evaluator-<name> = { path = "../contrib/<name>", editable = true }
83+
```
84+
85+
3. Add the package to the root semantic-release version train in `pyproject.toml`:
86+
87+
```toml
88+
"evaluators/contrib/<name>/pyproject.toml:project.version",
89+
```
90+
91+
Until those steps are done, the package is still scaffolding rather than a real contrib package.
492

593
Docs: https://docs.agentcontrol.dev/concepts/evaluators/contributing-evaluator

evaluators/contrib/template/pyproject.toml.template

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,36 @@
11
[project]
2-
name = "agent-control-evaluator-{{ORG}}"
3-
version = "3.0.0"
4-
description = "{{ORG}} evaluators for agent-control"
2+
name = "agent-control-evaluator-{{NAME}}"
3+
version = "7.5.0"
4+
description = "{{NAME}} evaluators for agent-control"
5+
readme = "README.md"
56
requires-python = ">=3.12"
67
license = { text = "Apache-2.0" }
78
authors = [{ name = "{{AUTHOR}}" }]
89
dependencies = [
9-
"agent-control-evaluators>=3.0.0",
10-
"agent-control-models>=3.0.0",
10+
"agent-control-evaluators>=7.5.0",
11+
"agent-control-models>=7.5.0",
1112
# Add your package-specific dependencies here
1213
]
1314

1415
[project.optional-dependencies]
1516
dev = [
1617
"pytest>=8.0.0",
1718
"pytest-asyncio>=0.23.0",
19+
"pytest-cov>=4.0.0",
1820
"ruff>=0.1.0",
1921
"mypy>=1.8.0",
2022
]
2123

2224
[project.entry-points."agent_control.evaluators"]
23-
# Format: "org.evaluator_name" = "package.module:Class"
24-
"{{ORG}}.{{EVALUATOR}}" = "agent_control_evaluator_{{ORG}}.{{EVALUATOR}}:{{CLASS}}"
25+
# Format: "<name>.<evaluator_name>" = "package.module:Class"
26+
"{{NAME}}.{{EVALUATOR}}" = "agent_control_evaluator_{{NAME}}.{{EVALUATOR}}:{{CLASS}}"
2527

2628
[build-system]
2729
requires = ["hatchling"]
2830
build-backend = "hatchling.build"
2931

3032
[tool.hatch.build.targets.wheel]
31-
packages = ["src/agent_control_evaluator_{{ORG}}"]
33+
packages = ["src/agent_control_evaluator_{{NAME}}"]
3234

3335
[tool.uv.sources]
3436
agent-control-evaluators = { path = "../../builtin", editable = true }

0 commit comments

Comments
 (0)