biogrounder 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.
- biogrounder-0.2.0/.claude-plugin/marketplace.json +11 -0
- biogrounder-0.2.0/.claude-plugin/plugin.json +9 -0
- biogrounder-0.2.0/.containerignore +9 -0
- biogrounder-0.2.0/.git-blame-ignore-revs +3 -0
- biogrounder-0.2.0/.gitattributes +2 -0
- biogrounder-0.2.0/.github/CODEOWNERS +2 -0
- biogrounder-0.2.0/.github/ISSUE_TEMPLATE/config.yml +5 -0
- biogrounder-0.2.0/.github/ISSUE_TEMPLATE/gold-example.yml +42 -0
- biogrounder-0.2.0/.github/ISSUE_TEMPLATE/proposal.yml +39 -0
- biogrounder-0.2.0/.github/ISSUE_TEMPLATE/wrong-answer.yml +37 -0
- biogrounder-0.2.0/.github/dependabot.yml +24 -0
- biogrounder-0.2.0/.github/pull_request_template.md +26 -0
- biogrounder-0.2.0/.github/workflows/ci.yml +58 -0
- biogrounder-0.2.0/.github/workflows/knowledge.yml +34 -0
- biogrounder-0.2.0/.github/workflows/release.yml +116 -0
- biogrounder-0.2.0/.github/workflows/upstream.yml +140 -0
- biogrounder-0.2.0/.gitignore +11 -0
- biogrounder-0.2.0/.mcp.json +13 -0
- biogrounder-0.2.0/CONTRIBUTING.md +130 -0
- biogrounder-0.2.0/Containerfile +42 -0
- biogrounder-0.2.0/LICENSE +66 -0
- biogrounder-0.2.0/PKG-INFO +894 -0
- biogrounder-0.2.0/README.md +870 -0
- biogrounder-0.2.0/TESTING.md +148 -0
- biogrounder-0.2.0/knowledge/config.yaml +169 -0
- biogrounder-0.2.0/knowledge/dictionary.yaml +7 -0
- biogrounder-0.2.0/knowledge/examples/cftr-f508del.yaml +29 -0
- biogrounder-0.2.0/knowledge/examples/duchenne-dystrophin.yaml +32 -0
- biogrounder-0.2.0/knowledge/examples/lep-ob-mouse.yaml +32 -0
- biogrounder-0.2.0/knowledge/guidelines.yaml +35 -0
- biogrounder-0.2.0/knowledge/sources.yaml +341 -0
- biogrounder-0.2.0/pyproject.toml +75 -0
- biogrounder-0.2.0/schemas/dictionary.schema.json +87 -0
- biogrounder-0.2.0/schemas/example.schema.json +168 -0
- biogrounder-0.2.0/schemas/guidelines.schema.json +43 -0
- biogrounder-0.2.0/schemas/proposal.schema.json +68 -0
- biogrounder-0.2.0/scripts/check_upstream.py +270 -0
- biogrounder-0.2.0/server.json +29 -0
- biogrounder-0.2.0/skills/ontology-grounding/SKILL.md +80 -0
- biogrounder-0.2.0/src/biogrounder/__init__.py +3 -0
- biogrounder-0.2.0/src/biogrounder/api.py +500 -0
- biogrounder-0.2.0/src/biogrounder/benchmarks.py +352 -0
- biogrounder-0.2.0/src/biogrounder/brain.py +579 -0
- biogrounder-0.2.0/src/biogrounder/checks.py +449 -0
- biogrounder-0.2.0/src/biogrounder/cli.py +413 -0
- biogrounder-0.2.0/src/biogrounder/config.py +88 -0
- biogrounder-0.2.0/src/biogrounder/credentials.py +114 -0
- biogrounder-0.2.0/src/biogrounder/export.py +163 -0
- biogrounder-0.2.0/src/biogrounder/genes.py +152 -0
- biogrounder-0.2.0/src/biogrounder/grounding.py +208 -0
- biogrounder-0.2.0/src/biogrounder/httpcache.py +49 -0
- biogrounder-0.2.0/src/biogrounder/identifiers.py +170 -0
- biogrounder-0.2.0/src/biogrounder/knowledge.py +449 -0
- biogrounder-0.2.0/src/biogrounder/mcp_server.py +849 -0
- biogrounder-0.2.0/src/biogrounder/models.py +346 -0
- biogrounder-0.2.0/src/biogrounder/ols.py +226 -0
- biogrounder-0.2.0/src/biogrounder/omop.py +176 -0
- biogrounder-0.2.0/src/biogrounder/outputs.py +481 -0
- biogrounder-0.2.0/src/biogrounder/phenopacket.py +192 -0
- biogrounder-0.2.0/src/biogrounder/pipeline.py +1392 -0
- biogrounder-0.2.0/src/biogrounder/security.py +88 -0
- biogrounder-0.2.0/src/biogrounder/sources.py +1456 -0
- biogrounder-0.2.0/src/biogrounder/textsim.py +120 -0
- biogrounder-0.2.0/src/biogrounder/validation.py +216 -0
- biogrounder-0.2.0/tests/__init__.py +0 -0
- biogrounder-0.2.0/tests/conftest.py +771 -0
- biogrounder-0.2.0/tests/test_benchmarks.py +170 -0
- biogrounder-0.2.0/tests/test_check_upstream.py +91 -0
- biogrounder-0.2.0/tests/test_connections.py +104 -0
- biogrounder-0.2.0/tests/test_core.py +376 -0
- biogrounder-0.2.0/tests/test_exports.py +114 -0
- biogrounder-0.2.0/tests/test_hardening.py +214 -0
- biogrounder-0.2.0/tests/test_live.py +190 -0
- biogrounder-0.2.0/tests/test_llm.py +149 -0
- biogrounder-0.2.0/tests/test_namo.py +72 -0
- biogrounder-0.2.0/tests/test_outputs.py +187 -0
- biogrounder-0.2.0/tests/test_refer.py +264 -0
- biogrounder-0.2.0/tests/test_servers.py +141 -0
- biogrounder-0.2.0/tests/test_sources.py +195 -0
- biogrounder-0.2.0/tests/test_validation.py +414 -0
- biogrounder-0.2.0/uv.lock +872 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "biogrounder",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Ground biomedical text to verified ontology IDs and medical codes, check answers in both directions, find literature connections, and propose improvements for review. Bundles the MCP server and the ontology-grounding skill.",
|
|
5
|
+
"author": { "name": "djportUCD" },
|
|
6
|
+
"homepage": "https://github.com/djportUCD/biogrounder",
|
|
7
|
+
"repository": "https://github.com/djportUCD/biogrounder",
|
|
8
|
+
"keywords": ["ontology", "mondo", "monarch", "biocuration", "grounding", "mcp"]
|
|
9
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
name: New test case (worked example)
|
|
2
|
+
description: Propose a text and the IDs a good answer must, and must not, contain.
|
|
3
|
+
labels: [gold-example]
|
|
4
|
+
body:
|
|
5
|
+
- type: markdown
|
|
6
|
+
attributes:
|
|
7
|
+
value: >-
|
|
8
|
+
Worked examples are the test set *and* what the model learns from. See TESTING.md for the format.
|
|
9
|
+
A pull request adding a file to `knowledge/examples/` is even better: CI checks every ID in it.
|
|
10
|
+
- type: textarea
|
|
11
|
+
id: text
|
|
12
|
+
attributes:
|
|
13
|
+
label: The text
|
|
14
|
+
description: A real description (an abstract, a strain description, a gene summary) you have the right to share.
|
|
15
|
+
validations:
|
|
16
|
+
required: true
|
|
17
|
+
- type: textarea
|
|
18
|
+
id: expected
|
|
19
|
+
attributes:
|
|
20
|
+
label: Terms a good answer must contain
|
|
21
|
+
description: One per line, `mention -> ID`, e.g. `severely obese -> MP:0001261`.
|
|
22
|
+
render: yaml
|
|
23
|
+
validations:
|
|
24
|
+
required: true
|
|
25
|
+
- type: textarea
|
|
26
|
+
id: forbidden
|
|
27
|
+
attributes:
|
|
28
|
+
label: What must NOT be in the answer
|
|
29
|
+
description: >-
|
|
30
|
+
Look-alike IDs that would be wrong, and why (e.g. `HP:0001513: human term in a mouse text`), or phrases
|
|
31
|
+
that must stay ungrounded (e.g. a negated finding, `no seizures`).
|
|
32
|
+
render: yaml
|
|
33
|
+
- type: textarea
|
|
34
|
+
id: notes
|
|
35
|
+
attributes:
|
|
36
|
+
label: Judgment calls
|
|
37
|
+
description: Anything a curator would need to know. The model reads these notes.
|
|
38
|
+
- type: input
|
|
39
|
+
id: source
|
|
40
|
+
attributes:
|
|
41
|
+
label: Where the text comes from
|
|
42
|
+
description: A PMID, DOI or URL, so others can check it and its licence.
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
name: Proposed change (dictionary, guideline, source, test or code)
|
|
2
|
+
description: A fix or improvement, for example one drafted with the MCP server's propose_change tool.
|
|
3
|
+
labels: [proposal]
|
|
4
|
+
body:
|
|
5
|
+
- type: markdown
|
|
6
|
+
attributes:
|
|
7
|
+
value: >-
|
|
8
|
+
If an AI drafted this, read it before you submit: you are vouching that it describes a real problem.
|
|
9
|
+
Maintainers review every proposal; nothing is applied automatically.
|
|
10
|
+
- type: dropdown
|
|
11
|
+
id: kind
|
|
12
|
+
attributes:
|
|
13
|
+
label: Kind
|
|
14
|
+
options: [example, dictionary, guideline, source, test, code, other]
|
|
15
|
+
validations:
|
|
16
|
+
required: true
|
|
17
|
+
- type: textarea
|
|
18
|
+
id: problem
|
|
19
|
+
attributes:
|
|
20
|
+
label: Problem
|
|
21
|
+
description: What went wrong or is missing, with the text, run or test that shows it.
|
|
22
|
+
validations:
|
|
23
|
+
required: true
|
|
24
|
+
- type: textarea
|
|
25
|
+
id: diagnosis
|
|
26
|
+
attributes:
|
|
27
|
+
label: Diagnosis
|
|
28
|
+
description: Why it happened, as far as you can tell.
|
|
29
|
+
- type: textarea
|
|
30
|
+
id: change
|
|
31
|
+
attributes:
|
|
32
|
+
label: Proposed change
|
|
33
|
+
description: YAML for knowledge files, a diff or a plain description for code.
|
|
34
|
+
render: text
|
|
35
|
+
- type: textarea
|
|
36
|
+
id: evidence
|
|
37
|
+
attributes:
|
|
38
|
+
label: Evidence
|
|
39
|
+
description: Run IDs, test names, ontology IDs, PMIDs or links.
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
name: Wrong or missing term
|
|
2
|
+
description: A description was grounded to the wrong ID, or a concept was missed.
|
|
3
|
+
labels: [wrong-answer]
|
|
4
|
+
body:
|
|
5
|
+
- type: textarea
|
|
6
|
+
id: text
|
|
7
|
+
attributes:
|
|
8
|
+
label: The text
|
|
9
|
+
description: The description you gave it (shorten it if it is long; don't paste anything confidential).
|
|
10
|
+
validations:
|
|
11
|
+
required: true
|
|
12
|
+
- type: textarea
|
|
13
|
+
id: got
|
|
14
|
+
attributes:
|
|
15
|
+
label: What it returned
|
|
16
|
+
description: The mention and the ID it chose (or that it found nothing). A run_id helps if you have one.
|
|
17
|
+
validations:
|
|
18
|
+
required: true
|
|
19
|
+
- type: textarea
|
|
20
|
+
id: expected
|
|
21
|
+
attributes:
|
|
22
|
+
label: What it should have returned
|
|
23
|
+
description: The right ID and why. Check it with `biogrounder lookup <ID>`.
|
|
24
|
+
validations:
|
|
25
|
+
required: true
|
|
26
|
+
- type: textarea
|
|
27
|
+
id: diagnosis
|
|
28
|
+
attributes:
|
|
29
|
+
label: Why it went wrong (if you know)
|
|
30
|
+
description: >-
|
|
31
|
+
Was the right ID among the candidates (`ground`), was it chosen badly, or was the concept never read
|
|
32
|
+
from the text? The `check_support` and `score_answer` tools can help.
|
|
33
|
+
- type: input
|
|
34
|
+
id: model
|
|
35
|
+
attributes:
|
|
36
|
+
label: Model and setup
|
|
37
|
+
description: e.g. client mode in Claude Desktop, anthropic claude-opus-5-5, ollama qwen3.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Weekly pull requests that update the locked Python packages (uv.lock) and the pinned GitHub Actions.
|
|
2
|
+
# CI runs on each one; a maintainer merges it. The CRAFT corpus and uv image pins are watched by
|
|
3
|
+
# .github/workflows/upstream.yml instead.
|
|
4
|
+
version: 2
|
|
5
|
+
updates:
|
|
6
|
+
- package-ecosystem: uv
|
|
7
|
+
directory: /
|
|
8
|
+
schedule:
|
|
9
|
+
interval: weekly
|
|
10
|
+
day: monday
|
|
11
|
+
groups:
|
|
12
|
+
python-packages:
|
|
13
|
+
patterns: ["*"]
|
|
14
|
+
update-types: [minor, patch]
|
|
15
|
+
open-pull-requests-limit: 5
|
|
16
|
+
|
|
17
|
+
- package-ecosystem: github-actions
|
|
18
|
+
directory: /
|
|
19
|
+
schedule:
|
|
20
|
+
interval: weekly
|
|
21
|
+
day: monday
|
|
22
|
+
groups:
|
|
23
|
+
actions:
|
|
24
|
+
patterns: ["*"]
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
## What this changes
|
|
2
|
+
|
|
3
|
+
<!-- One or two sentences. Link the issue or proposal it answers, if any. -->
|
|
4
|
+
|
|
5
|
+
## Kind
|
|
6
|
+
|
|
7
|
+
- [ ] Worked example (test case)
|
|
8
|
+
- [ ] Dictionary entry or review
|
|
9
|
+
- [ ] Guideline
|
|
10
|
+
- [ ] Outside source
|
|
11
|
+
- [ ] Test
|
|
12
|
+
- [ ] Code
|
|
13
|
+
|
|
14
|
+
## Checks
|
|
15
|
+
|
|
16
|
+
- [ ] `biogrounder validate` passes (CI runs it too: every ID must exist and be current)
|
|
17
|
+
- [ ] `pytest -m "not live"` passes
|
|
18
|
+
- [ ] If it changes how terms are chosen: `evaluate` before and after (or `score_answer` per example in client mode)
|
|
19
|
+
|
|
20
|
+
| | precision | recall | lenient recall | forbidden found |
|
|
21
|
+
|---|---|---|---|---|
|
|
22
|
+
| before | | | | |
|
|
23
|
+
| after | | | | |
|
|
24
|
+
|
|
25
|
+
- [ ] If an AI drafted any of it, I have read and checked all of it
|
|
26
|
+
- [ ] No API keys, personal data or text I don't have the right to share
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
on:
|
|
3
|
+
push:
|
|
4
|
+
pull_request:
|
|
5
|
+
permissions:
|
|
6
|
+
contents: read
|
|
7
|
+
jobs:
|
|
8
|
+
lint:
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
steps:
|
|
11
|
+
- uses: actions/checkout@v7
|
|
12
|
+
- uses: astral-sh/setup-uv@36300bab3f61b84e19f32b6bd26b7897f3c7e951 # v10.4.2 (setup-uv publishes no major tag)
|
|
13
|
+
- run: uv run --locked --only-group dev ruff check --output-format=github
|
|
14
|
+
- run: uv run --locked --only-group dev ruff format --check
|
|
15
|
+
|
|
16
|
+
test:
|
|
17
|
+
runs-on: ubuntu-latest
|
|
18
|
+
strategy:
|
|
19
|
+
matrix:
|
|
20
|
+
python: ["3.15"]
|
|
21
|
+
steps:
|
|
22
|
+
- uses: actions/checkout@v7
|
|
23
|
+
- uses: astral-sh/setup-uv@36300bab3f61b84e19f32b6bd26b7897f3c7e951 # v10.4.2 (setup-uv publishes no major tag)
|
|
24
|
+
with:
|
|
25
|
+
python-version: ${{ matrix.python }}
|
|
26
|
+
enable-cache: true
|
|
27
|
+
- run: uv sync --locked
|
|
28
|
+
- run: uv run pytest -m "not live" -q
|
|
29
|
+
- run: uv run biogrounder validate --offline
|
|
30
|
+
|
|
31
|
+
container:
|
|
32
|
+
# Build the Linux image with Podman and check it serves the API as a non-root user.
|
|
33
|
+
runs-on: ubuntu-latest
|
|
34
|
+
steps:
|
|
35
|
+
- uses: actions/checkout@v7
|
|
36
|
+
- run: podman build -t biogrounder .
|
|
37
|
+
- name: Smoke test
|
|
38
|
+
run: |
|
|
39
|
+
set -euo pipefail
|
|
40
|
+
test "$(podman run --rm biogrounder id -u)" != "0"
|
|
41
|
+
podman run --rm biogrounder python --version | grep -q "Python 3.15"
|
|
42
|
+
podman run -d --name biogrounder biogrounder
|
|
43
|
+
# Ask the API from inside the container (no dependence on the runner's port forwarding).
|
|
44
|
+
podman exec biogrounder python -c "
|
|
45
|
+
import json, time, urllib.request
|
|
46
|
+
for _ in range(30):
|
|
47
|
+
try:
|
|
48
|
+
s = json.load(urllib.request.urlopen('http://127.0.0.1:8000/status', timeout=5))
|
|
49
|
+
break
|
|
50
|
+
except OSError:
|
|
51
|
+
time.sleep(2)
|
|
52
|
+
else:
|
|
53
|
+
raise SystemExit('the API never answered')
|
|
54
|
+
assert s['brain'] == 'client', s
|
|
55
|
+
print(s)
|
|
56
|
+
"
|
|
57
|
+
- if: always()
|
|
58
|
+
run: podman logs biogrounder || true
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
name: Knowledge check
|
|
2
|
+
# Every ID in the knowledge files must exist, be current and carry the label written next to it.
|
|
3
|
+
# Runs on pull requests that touch knowledge/, and weekly, because ontologies retire terms over time.
|
|
4
|
+
on:
|
|
5
|
+
pull_request:
|
|
6
|
+
paths: ["knowledge/**", "schemas/**", "src/biogrounder/models.py"]
|
|
7
|
+
schedule:
|
|
8
|
+
- cron: "17 6 * * 1"
|
|
9
|
+
workflow_dispatch:
|
|
10
|
+
|
|
11
|
+
# Read-only, no secrets: safe to run on pull requests from forks (never use pull_request_target here).
|
|
12
|
+
permissions:
|
|
13
|
+
contents: read
|
|
14
|
+
|
|
15
|
+
jobs:
|
|
16
|
+
validate:
|
|
17
|
+
runs-on: ubuntu-latest
|
|
18
|
+
steps:
|
|
19
|
+
- uses: actions/checkout@v7
|
|
20
|
+
- uses: astral-sh/setup-uv@36300bab3f61b84e19f32b6bd26b7897f3c7e951 # v10.4.2 (setup-uv publishes no major tag)
|
|
21
|
+
- run: uv sync --locked --no-dev
|
|
22
|
+
- name: Check the files and every ID in them (public services, no keys)
|
|
23
|
+
run: |
|
|
24
|
+
set -o pipefail
|
|
25
|
+
uv run --no-dev biogrounder validate | tee validate.txt
|
|
26
|
+
- name: Summary
|
|
27
|
+
if: always()
|
|
28
|
+
run: |
|
|
29
|
+
{
|
|
30
|
+
echo "### Knowledge check"
|
|
31
|
+
echo '```'
|
|
32
|
+
tail -n 60 validate.txt || true
|
|
33
|
+
echo '```'
|
|
34
|
+
} >> "$GITHUB_STEP_SUMMARY"
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
# Push a tag like v0.3.0 to publish that version: to PyPI (so `uvx biogrounder mcp` installs it), as a
|
|
3
|
+
# GitHub release, and to the MCP Registry (so MCP clients, GitHub's registry included, list it).
|
|
4
|
+
# No tokens are stored: PyPI and the MCP Registry both trust this workflow's GitHub OIDC identity.
|
|
5
|
+
# One-time setup on pypi.org: a trusted publisher for owner djportUCD, repository biogrounder,
|
|
6
|
+
# workflow release.yml, environment pypi. See CONTRIBUTING.md, "Releasing".
|
|
7
|
+
on:
|
|
8
|
+
push:
|
|
9
|
+
tags: ["v*"]
|
|
10
|
+
|
|
11
|
+
permissions:
|
|
12
|
+
contents: read
|
|
13
|
+
|
|
14
|
+
concurrency:
|
|
15
|
+
group: release
|
|
16
|
+
cancel-in-progress: false
|
|
17
|
+
|
|
18
|
+
jobs:
|
|
19
|
+
pypi:
|
|
20
|
+
runs-on: ubuntu-latest
|
|
21
|
+
environment:
|
|
22
|
+
name: pypi
|
|
23
|
+
url: https://pypi.org/project/biogrounder/
|
|
24
|
+
permissions:
|
|
25
|
+
id-token: write # PyPI trusted publishing
|
|
26
|
+
contents: write # the GitHub release
|
|
27
|
+
env:
|
|
28
|
+
TAG: ${{ github.ref_name }}
|
|
29
|
+
steps:
|
|
30
|
+
- uses: actions/checkout@v7
|
|
31
|
+
- uses: astral-sh/setup-uv@36300bab3f61b84e19f32b6bd26b7897f3c7e951 # v10.4.2 (setup-uv publishes no major tag)
|
|
32
|
+
|
|
33
|
+
- name: The tag matches every version in the repository
|
|
34
|
+
run: |
|
|
35
|
+
python3 - <<'PY'
|
|
36
|
+
import json, os, re, sys
|
|
37
|
+
want = os.environ["TAG"].removeprefix("v")
|
|
38
|
+
found = {
|
|
39
|
+
"src/biogrounder/__init__.py": re.search(r'__version__ = "([^"]+)"', open("src/biogrounder/__init__.py").read()).group(1),
|
|
40
|
+
"server.json": json.load(open("server.json"))["version"],
|
|
41
|
+
"server.json packages[0]": json.load(open("server.json"))["packages"][0]["version"],
|
|
42
|
+
".claude-plugin/plugin.json": json.load(open(".claude-plugin/plugin.json"))["version"],
|
|
43
|
+
}
|
|
44
|
+
wrong = {k: v for k, v in found.items() if v != want}
|
|
45
|
+
if wrong:
|
|
46
|
+
sys.exit(f"tag {want} does not match: {wrong}")
|
|
47
|
+
print("version", want)
|
|
48
|
+
PY
|
|
49
|
+
|
|
50
|
+
- run: uv sync --locked
|
|
51
|
+
- run: uv run pytest -m "not live" -q
|
|
52
|
+
- run: uv run biogrounder validate --offline
|
|
53
|
+
- run: uv build
|
|
54
|
+
|
|
55
|
+
- name: The built package installs and starts, from an empty folder and home
|
|
56
|
+
run: |
|
|
57
|
+
set -euo pipefail
|
|
58
|
+
wheel="$(ls "$GITHUB_WORKSPACE"/dist/*.whl)"
|
|
59
|
+
home="$(mktemp -d)"; cd "$(mktemp -d)"
|
|
60
|
+
HOME="$home" uvx --from "$wheel" biogrounder status
|
|
61
|
+
test -f "$home/.biogrounder/knowledge/config.yaml"
|
|
62
|
+
|
|
63
|
+
- name: Publish to PyPI
|
|
64
|
+
run: uv publish --trusted-publishing always
|
|
65
|
+
|
|
66
|
+
- name: GitHub release
|
|
67
|
+
env:
|
|
68
|
+
GH_TOKEN: ${{ github.token }}
|
|
69
|
+
run: gh release create "$TAG" dist/* --verify-tag --generate-notes --title "BioGrounder $TAG"
|
|
70
|
+
|
|
71
|
+
mcp-registry:
|
|
72
|
+
needs: pypi
|
|
73
|
+
runs-on: ubuntu-latest
|
|
74
|
+
permissions:
|
|
75
|
+
id-token: write # MCP Registry login with this workflow's GitHub identity
|
|
76
|
+
contents: read
|
|
77
|
+
env:
|
|
78
|
+
TAG: ${{ github.ref_name }}
|
|
79
|
+
MCP_PUBLISHER_VERSION: v1.8.1
|
|
80
|
+
steps:
|
|
81
|
+
- uses: actions/checkout@v7
|
|
82
|
+
|
|
83
|
+
- name: Wait for PyPI to serve the new version (the registry checks it there)
|
|
84
|
+
run: |
|
|
85
|
+
version="${TAG#v}"
|
|
86
|
+
for _ in $(seq 1 30); do
|
|
87
|
+
if curl -sf "https://pypi.org/pypi/biogrounder/$version/json" > /dev/null; then exit 0; fi
|
|
88
|
+
sleep 20
|
|
89
|
+
done
|
|
90
|
+
echo "PyPI does not show biogrounder $version after 10 minutes" >&2
|
|
91
|
+
exit 1
|
|
92
|
+
|
|
93
|
+
- name: Install cosign
|
|
94
|
+
uses: sigstore/cosign-installer@6f9f17788090df1f26f669e9d70d6ae9567deba6 # v4.1.2
|
|
95
|
+
|
|
96
|
+
- name: Download and verify mcp-publisher
|
|
97
|
+
run: |
|
|
98
|
+
set -euo pipefail
|
|
99
|
+
os="$(uname -s | tr '[:upper:]' '[:lower:]')"
|
|
100
|
+
arch="$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/')"
|
|
101
|
+
archive="mcp-publisher_${os}_${arch}.tar.gz"
|
|
102
|
+
base_url="https://github.com/modelcontextprotocol/registry/releases/download/${MCP_PUBLISHER_VERSION}"
|
|
103
|
+
|
|
104
|
+
curl --fail --location --silent --show-error --output "$archive" "$base_url/$archive"
|
|
105
|
+
curl --fail --location --silent --show-error --output "$archive.sigstore.json" "$base_url/$archive.sigstore.json"
|
|
106
|
+
cosign verify-blob \
|
|
107
|
+
--bundle "$archive.sigstore.json" \
|
|
108
|
+
--certificate-identity "https://github.com/modelcontextprotocol/registry/.github/workflows/release.yml@refs/tags/${MCP_PUBLISHER_VERSION}" \
|
|
109
|
+
--certificate-oidc-issuer "https://token.actions.githubusercontent.com" \
|
|
110
|
+
"$archive"
|
|
111
|
+
tar xzf "$archive" mcp-publisher
|
|
112
|
+
rm -f "$archive" "$archive.sigstore.json"
|
|
113
|
+
|
|
114
|
+
- run: ./mcp-publisher validate
|
|
115
|
+
- run: ./mcp-publisher login github-oidc
|
|
116
|
+
- run: ./mcp-publisher publish
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
name: Upstream watch
|
|
2
|
+
# Weekly: do the outside services still answer the way the code expects, do the files we download still
|
|
3
|
+
# parse, do the links in the docs still work, and are the pinned versions (CRAFT, uv image) current?
|
|
4
|
+
# - What can be fixed mechanically (a link that moved permanently, a newer pinned release) is fixed on the
|
|
5
|
+
# branch upstream/auto-fix, checked with the offline tests, and offered as a pull request for review.
|
|
6
|
+
# - Anything else (a source that changed its answers or file format, a broken link) opens or updates one
|
|
7
|
+
# issue labelled "upstream", naming the failing test or link, for a person (or an AI drafting a fix).
|
|
8
|
+
# Scheduled and manual runs only: no pull-request trigger, so nothing untrusted runs with these permissions.
|
|
9
|
+
on:
|
|
10
|
+
schedule:
|
|
11
|
+
- cron: "41 6 * * 1"
|
|
12
|
+
workflow_dispatch:
|
|
13
|
+
|
|
14
|
+
permissions:
|
|
15
|
+
contents: read
|
|
16
|
+
|
|
17
|
+
concurrency:
|
|
18
|
+
group: upstream-watch
|
|
19
|
+
cancel-in-progress: false
|
|
20
|
+
|
|
21
|
+
jobs:
|
|
22
|
+
watch:
|
|
23
|
+
runs-on: ubuntu-latest
|
|
24
|
+
permissions:
|
|
25
|
+
contents: write # to push the upstream/auto-fix branch (never main)
|
|
26
|
+
pull-requests: write # to offer it as a pull request
|
|
27
|
+
issues: write # to report what a person needs to fix
|
|
28
|
+
steps:
|
|
29
|
+
- uses: actions/checkout@v7
|
|
30
|
+
- uses: astral-sh/setup-uv@36300bab3f61b84e19f32b6bd26b7897f3c7e951 # v10.4.2 (setup-uv publishes no major tag)
|
|
31
|
+
- run: uv sync --locked
|
|
32
|
+
|
|
33
|
+
- name: Live tests (every outside source, the downloaded files, the benchmark corpora; no keys)
|
|
34
|
+
id: live
|
|
35
|
+
continue-on-error: true
|
|
36
|
+
env:
|
|
37
|
+
BIOGROUNDER_KNOWLEDGE_DIR: ${{ runner.temp }}/knowledge
|
|
38
|
+
BIOGROUNDER_BENCHMARK_DIR: ${{ runner.temp }}/benchmarks
|
|
39
|
+
run: |
|
|
40
|
+
set -o pipefail
|
|
41
|
+
cp -r knowledge "$BIOGROUNDER_KNOWLEDGE_DIR"
|
|
42
|
+
uv run pytest -m live -q -rs 2>&1 | tee live.txt
|
|
43
|
+
|
|
44
|
+
- name: Links and pinned versions; fix what can be fixed mechanically
|
|
45
|
+
id: links
|
|
46
|
+
env:
|
|
47
|
+
GITHUB_TOKEN: ${{ github.token }}
|
|
48
|
+
run: |
|
|
49
|
+
set +e
|
|
50
|
+
uv run python scripts/check_upstream.py --fix --report links-report.md
|
|
51
|
+
code=$?
|
|
52
|
+
set -e
|
|
53
|
+
# Exit 0: all current. 1: something found (reported below). 2 or a missing report: the check itself failed.
|
|
54
|
+
if [ "$code" -ge 2 ] || [ ! -s links-report.md ]; then
|
|
55
|
+
echo "crashed=true" >> "$GITHUB_OUTPUT"
|
|
56
|
+
printf '## Upstream check\n\nThe link and pin check itself failed (exit %s); see the run log.\n' "$code" > links-report.md
|
|
57
|
+
fi
|
|
58
|
+
cat links-report.md >> "$GITHUB_STEP_SUMMARY"
|
|
59
|
+
if grep -qE "^### Broken links|is no longer found" links-report.md; then echo "broken=true" >> "$GITHUB_OUTPUT"; fi
|
|
60
|
+
|
|
61
|
+
- name: Offer the fixes as a pull request
|
|
62
|
+
id: pr
|
|
63
|
+
continue-on-error: true
|
|
64
|
+
env:
|
|
65
|
+
GH_TOKEN: ${{ github.token }}
|
|
66
|
+
run: |
|
|
67
|
+
set -euo pipefail
|
|
68
|
+
if git diff --quiet; then echo "Nothing to fix."; exit 0; fi
|
|
69
|
+
uv run pytest -m "not live" -q
|
|
70
|
+
uv run ruff check
|
|
71
|
+
branch=upstream/auto-fix
|
|
72
|
+
git config user.name "github-actions[bot]"
|
|
73
|
+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
|
74
|
+
git switch -C "$branch"
|
|
75
|
+
git commit -qam "Upstream watch: update moved links and pinned versions"
|
|
76
|
+
git push --force origin "$branch"
|
|
77
|
+
{
|
|
78
|
+
cat links-report.md
|
|
79
|
+
echo
|
|
80
|
+
echo "The offline tests passed on this branch before it was pushed. CI does not start by itself on a"
|
|
81
|
+
echo "pull request opened by a workflow: close and reopen it (or push to it) to run CI before merging."
|
|
82
|
+
} > pr.md
|
|
83
|
+
if gh pr view "$branch" --json state -q .state 2>/dev/null | grep -q OPEN; then
|
|
84
|
+
gh pr edit "$branch" --body-file pr.md
|
|
85
|
+
elif ! gh pr create --head "$branch" --title "Upstream watch: moved links and newer pinned versions" --body-file pr.md; then
|
|
86
|
+
# A repository can forbid workflows to open pull requests; then a person opens it in one click.
|
|
87
|
+
echo "Open the pull request from ${{ github.server_url }}/${{ github.repository }}/compare/main...$branch?expand=1" | tee -a "$GITHUB_STEP_SUMMARY"
|
|
88
|
+
fi
|
|
89
|
+
|
|
90
|
+
- name: Report what a person needs to fix
|
|
91
|
+
# always(): report even when an earlier step failed (a failed step would otherwise skip this one).
|
|
92
|
+
if: >-
|
|
93
|
+
always() && !cancelled() && (steps.live.outcome == 'failure' || steps.links.outputs.broken == 'true'
|
|
94
|
+
|| steps.links.outputs.crashed == 'true' || steps.links.outcome == 'failure' || steps.pr.outcome == 'failure')
|
|
95
|
+
env:
|
|
96
|
+
GH_TOKEN: ${{ github.token }}
|
|
97
|
+
RUN: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
|
|
98
|
+
LIVE: ${{ steps.live.outcome }}
|
|
99
|
+
LINKS: ${{ steps.links.outcome }}
|
|
100
|
+
PR: ${{ steps.pr.outcome }}
|
|
101
|
+
run: |
|
|
102
|
+
set -euo pipefail
|
|
103
|
+
touch links-report.md live.txt
|
|
104
|
+
{
|
|
105
|
+
echo "The weekly upstream watch found something a person needs to look at ([run]($RUN))."
|
|
106
|
+
if [ "$LINKS" = failure ] || grep -q "check itself failed" links-report.md; then
|
|
107
|
+
echo
|
|
108
|
+
echo "- The link and pin check itself failed; see the run log."
|
|
109
|
+
fi
|
|
110
|
+
if [ "$PR" = failure ]; then
|
|
111
|
+
echo
|
|
112
|
+
echo "- The mechanical fixes could not be offered as a pull request (the offline tests or ruff failed on"
|
|
113
|
+
echo " them, or the push was refused); see the run log. The fixes are listed in the run summary."
|
|
114
|
+
fi
|
|
115
|
+
if [ "$LIVE" = failure ]; then
|
|
116
|
+
echo
|
|
117
|
+
echo "### Live tests"
|
|
118
|
+
echo
|
|
119
|
+
echo "A failing live test usually means an outside service changed its answers or its file format; the"
|
|
120
|
+
echo "test names the source. Fix the adapter in \`src/biogrounder/sources.py\` (or the parser in"
|
|
121
|
+
echo "\`benchmarks.py\`) and its mocked test, then open a pull request."
|
|
122
|
+
echo
|
|
123
|
+
echo '```'
|
|
124
|
+
grep -E "^(FAILED|ERROR)|^E " live.txt | head -n 40 || true
|
|
125
|
+
echo '```'
|
|
126
|
+
fi
|
|
127
|
+
for section in "Broken links" "Pinned versions that could not be checked"; do
|
|
128
|
+
if grep -q "^### $section" links-report.md; then
|
|
129
|
+
echo
|
|
130
|
+
sed -n "/^### $section/,/^### /p" links-report.md | sed '$ { /^### /d }'
|
|
131
|
+
fi
|
|
132
|
+
done
|
|
133
|
+
} > issue.md
|
|
134
|
+
gh label create upstream --color FBCA04 --description "An outside source or link changed" 2>/dev/null || true
|
|
135
|
+
number="$(gh issue list --label upstream --state open --json number -q '.[0].number')"
|
|
136
|
+
if [ -n "$number" ]; then
|
|
137
|
+
gh issue comment "$number" --body-file issue.md
|
|
138
|
+
else
|
|
139
|
+
gh issue create --title "Upstream watch: an outside source or link changed" --label upstream --body-file issue.md
|
|
140
|
+
fi
|