aind-diagnostics 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.
- aind_diagnostics-0.2.0/.copier-answers.yml +26 -0
- aind_diagnostics-0.2.0/.github/ISSUE_TEMPLATE/bug_report.md +38 -0
- aind_diagnostics-0.2.0/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
- aind_diagnostics-0.2.0/.github/ISSUE_TEMPLATE/user-story.md +27 -0
- aind_diagnostics-0.2.0/.github/dependabot.yml +19 -0
- aind_diagnostics-0.2.0/.github/workflows/bump-call.yml +33 -0
- aind_diagnostics-0.2.0/.github/workflows/ci-call.yml +43 -0
- aind_diagnostics-0.2.0/.github/workflows/publish-call.yml +25 -0
- aind_diagnostics-0.2.0/.gitignore +153 -0
- aind_diagnostics-0.2.0/.python-version +1 -0
- aind_diagnostics-0.2.0/AGENTS.md +10 -0
- aind_diagnostics-0.2.0/CHANGELOG.md +12 -0
- aind_diagnostics-0.2.0/CLAUDE.md +1 -0
- aind_diagnostics-0.2.0/CONTRIBUTING.md +66 -0
- aind_diagnostics-0.2.0/LICENSE +22 -0
- aind_diagnostics-0.2.0/PKG-INFO +89 -0
- aind_diagnostics-0.2.0/README.md +72 -0
- aind_diagnostics-0.2.0/docs/integration.md +74 -0
- aind_diagnostics-0.2.0/pyproject.toml +88 -0
- aind_diagnostics-0.2.0/scripts/run_linters_and_checks.sh +88 -0
- aind_diagnostics-0.2.0/src/aind_diagnostics/__init__.py +33 -0
- aind_diagnostics-0.2.0/src/aind_diagnostics/models.py +235 -0
- aind_diagnostics-0.2.0/src/aind_diagnostics/py.typed +1 -0
- aind_diagnostics-0.2.0/tests/__init__.py +1 -0
- aind_diagnostics-0.2.0/tests/test_example.py +10 -0
- aind_diagnostics-0.2.0/tests/test_models.py +121 -0
- aind_diagnostics-0.2.0/tests/test_v1_compatibility.py +91 -0
- aind_diagnostics-0.2.0/uv.lock +1839 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Changes here will be overwritten by Copier; NEVER EDIT MANUALLY
|
|
2
|
+
_commit: 0.1.21
|
|
3
|
+
_src_path: /home/galen.lynch/Documents/Code/aind-python-copier-template
|
|
4
|
+
author_email: galen@galenlynch.com
|
|
5
|
+
author_fullname: Galen Lynch
|
|
6
|
+
auto_setup_repo: true
|
|
7
|
+
current_year: '2026'
|
|
8
|
+
github_org: AllenNeuralDynamics
|
|
9
|
+
github_url: https://github.com/AllenNeuralDynamics/aind-diagnostics
|
|
10
|
+
include_agents_md: true
|
|
11
|
+
include_cli: false
|
|
12
|
+
include_commitizen: true
|
|
13
|
+
include_docs: false
|
|
14
|
+
include_notebooks: false
|
|
15
|
+
include_type_hints: true
|
|
16
|
+
institute_name: Allen Institute for Neural Dynamics
|
|
17
|
+
license: MIT
|
|
18
|
+
project_description: Structured diagnostics for scientific data processing
|
|
19
|
+
project_name: AIND diagnostics
|
|
20
|
+
project_slug: aind-diagnostics
|
|
21
|
+
publish_to_pypi: true
|
|
22
|
+
python_package_import_name: aind_diagnostics
|
|
23
|
+
python_version: '3.11'
|
|
24
|
+
target_python_version: '3.13'
|
|
25
|
+
workflow_source: AllenNeuralDynamics/galen-uv-workflows
|
|
26
|
+
workflow_version: v2
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Bug report
|
|
3
|
+
about: Create a report to help us improve
|
|
4
|
+
title: ''
|
|
5
|
+
labels: ''
|
|
6
|
+
assignees: ''
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
**Describe the bug**
|
|
11
|
+
A clear and concise description of what the bug is.
|
|
12
|
+
|
|
13
|
+
**To Reproduce**
|
|
14
|
+
Steps to reproduce the behavior:
|
|
15
|
+
1. Go to '...'
|
|
16
|
+
2. Click on '....'
|
|
17
|
+
3. Scroll down to '....'
|
|
18
|
+
4. See error
|
|
19
|
+
|
|
20
|
+
**Expected behavior**
|
|
21
|
+
A clear and concise description of what you expected to happen.
|
|
22
|
+
|
|
23
|
+
**Screenshots**
|
|
24
|
+
If applicable, add screenshots to help explain your problem.
|
|
25
|
+
|
|
26
|
+
**Desktop (please complete the following information):**
|
|
27
|
+
- OS: [e.g. iOS]
|
|
28
|
+
- Browser [e.g. chrome, safari]
|
|
29
|
+
- Version [e.g. 22]
|
|
30
|
+
|
|
31
|
+
**Smartphone (please complete the following information):**
|
|
32
|
+
- Device: [e.g. iPhone6]
|
|
33
|
+
- OS: [e.g. iOS8.1]
|
|
34
|
+
- Browser [e.g. stock browser, safari]
|
|
35
|
+
- Version [e.g. 22]
|
|
36
|
+
|
|
37
|
+
**Additional context**
|
|
38
|
+
Add any other context about the problem here.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Feature request
|
|
3
|
+
about: Suggest an idea for this project
|
|
4
|
+
title: ''
|
|
5
|
+
labels: ''
|
|
6
|
+
assignees: ''
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
**Is your feature request related to a problem? Please describe.**
|
|
11
|
+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
|
12
|
+
|
|
13
|
+
**Describe the solution you'd like**
|
|
14
|
+
A clear and concise description of what you want to happen.
|
|
15
|
+
|
|
16
|
+
**Describe alternatives you've considered**
|
|
17
|
+
A clear and concise description of any alternative solutions or features you've considered.
|
|
18
|
+
|
|
19
|
+
**Additional context**
|
|
20
|
+
Add any other context or screenshots about the feature request here.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: User story
|
|
3
|
+
about: This template provides a basic structure for user story issues.
|
|
4
|
+
title: ''
|
|
5
|
+
labels: ''
|
|
6
|
+
assignees: ''
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# User story
|
|
11
|
+
As a ..., I want to ..., so I can ...
|
|
12
|
+
|
|
13
|
+
*Ideally, this is in the issue title, but if not, you can put it here. If so, delete this section.*
|
|
14
|
+
|
|
15
|
+
# Acceptance criteria
|
|
16
|
+
- [ ] This is something that can be verified to show that this user story is satisfied.
|
|
17
|
+
|
|
18
|
+
# Sprint Ready Checklist
|
|
19
|
+
- [ ] 1. Acceptance criteria defined
|
|
20
|
+
- [ ] 2. Team understands acceptance criteria
|
|
21
|
+
- [ ] 3. Team has defined solution / steps to satisfy acceptance criteria
|
|
22
|
+
- [ ] 4. Acceptance criteria is verifiable / testable
|
|
23
|
+
- [ ] 5. External / 3rd Party dependencies identified
|
|
24
|
+
- [ ] 6. Ticket is prioritized and sized
|
|
25
|
+
|
|
26
|
+
# Notes
|
|
27
|
+
*Add any helpful notes here.*
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# To get started with Dependabot version updates, you'll need to specify which
|
|
2
|
+
# package ecosystems to update and where the package manifests are located.
|
|
3
|
+
# Please see the documentation for all configuration options:
|
|
4
|
+
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
|
|
5
|
+
|
|
6
|
+
version: 2
|
|
7
|
+
updates:
|
|
8
|
+
# Enable version updates for GitHub Actions
|
|
9
|
+
- package-ecosystem: "github-actions"
|
|
10
|
+
# Workflow files stored in the default location of `.github/workflows`
|
|
11
|
+
# You don't need to specify `/.github/workflows` for `directory`. You can use `directory: "/"`.
|
|
12
|
+
directory: "/"
|
|
13
|
+
schedule:
|
|
14
|
+
interval: "weekly"
|
|
15
|
+
# Enable version updates for pip
|
|
16
|
+
- package-ecosystem: "pip"
|
|
17
|
+
directory: "/"
|
|
18
|
+
schedule:
|
|
19
|
+
interval: "weekly"
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
name: Bump Version
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_run:
|
|
5
|
+
workflows: ["CI"]
|
|
6
|
+
branches: [ main ]
|
|
7
|
+
types: [ completed ]
|
|
8
|
+
workflow_dispatch:
|
|
9
|
+
|
|
10
|
+
permissions:
|
|
11
|
+
contents: write # needed to push commits/tags
|
|
12
|
+
id-token: write # needed if your reusable workflow exchanges OIDC tokens
|
|
13
|
+
|
|
14
|
+
concurrency:
|
|
15
|
+
group: bump-${{ github.workflow }}-${{ github.event.workflow_run.head_branch || github.ref }}
|
|
16
|
+
cancel-in-progress: true
|
|
17
|
+
|
|
18
|
+
jobs:
|
|
19
|
+
bump:
|
|
20
|
+
# Only run when:
|
|
21
|
+
# • a CI run just succeeded (and the head commit message doesn't start with 'bump:')
|
|
22
|
+
# • OR this is a manual dispatch
|
|
23
|
+
if: >
|
|
24
|
+
(github.event_name == 'workflow_run' &&
|
|
25
|
+
github.event.workflow_run.conclusion == 'success' &&
|
|
26
|
+
!startsWith(github.event.workflow_run.head_commit.message, 'bump:')) ||
|
|
27
|
+
(github.event_name == 'workflow_dispatch' &&
|
|
28
|
+
github.ref == 'refs/heads/main')
|
|
29
|
+
uses: AllenNeuralDynamics/galen-uv-workflows/.github/workflows/bump-version.yml@v2
|
|
30
|
+
with:
|
|
31
|
+
default-branch: main
|
|
32
|
+
secrets:
|
|
33
|
+
repo-token: ${{ secrets.SERVICE_TOKEN }}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_dispatch:
|
|
5
|
+
push:
|
|
6
|
+
branches: [ main ]
|
|
7
|
+
pull_request:
|
|
8
|
+
branches: [ main ]
|
|
9
|
+
types: [opened, synchronize, reopened, ready_for_review]
|
|
10
|
+
|
|
11
|
+
permissions:
|
|
12
|
+
contents: read
|
|
13
|
+
pull-requests: read
|
|
14
|
+
|
|
15
|
+
concurrency:
|
|
16
|
+
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
|
|
17
|
+
cancel-in-progress: true
|
|
18
|
+
|
|
19
|
+
jobs:
|
|
20
|
+
run-ci:
|
|
21
|
+
strategy:
|
|
22
|
+
matrix:
|
|
23
|
+
os: [ubuntu-latest]
|
|
24
|
+
# Floor and ceiling. They coincide when a project targets its own
|
|
25
|
+
# minimum, and a matrix must not then run the same version twice.
|
|
26
|
+
python-version: ["3.10", "3.13"]
|
|
27
|
+
|
|
28
|
+
if: >
|
|
29
|
+
(github.event_name != 'pull_request' || github.event.pull_request.draft == false) &&
|
|
30
|
+
github.actor != 'github-actions[bot]' &&
|
|
31
|
+
!(github.event_name == 'push' && startsWith(github.event.head_commit.message, 'bump:'))
|
|
32
|
+
|
|
33
|
+
uses: AllenNeuralDynamics/galen-uv-workflows/.github/workflows/ci.yml@v2
|
|
34
|
+
with:
|
|
35
|
+
os: ${{ matrix.os }}
|
|
36
|
+
python-version: ${{ matrix.python-version }}
|
|
37
|
+
package-name: aind_diagnostics
|
|
38
|
+
run-mypy: true
|
|
39
|
+
secrets:
|
|
40
|
+
# Passed on to `uv sync` as a git `url.insteadOf` credential, so
|
|
41
|
+
# internal or private git dependencies pinned in [tool.uv.sources]
|
|
42
|
+
# can be cloned. Harmless to leave in when all deps are public.
|
|
43
|
+
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
name: "Release"
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- 'v[0-9]*' # semver tags
|
|
7
|
+
workflow_dispatch:
|
|
8
|
+
|
|
9
|
+
permissions:
|
|
10
|
+
contents: write # create release + upload assets
|
|
11
|
+
|
|
12
|
+
concurrency:
|
|
13
|
+
group: release
|
|
14
|
+
cancel-in-progress: false # let releases finish
|
|
15
|
+
|
|
16
|
+
jobs:
|
|
17
|
+
run-release:
|
|
18
|
+
uses: AllenNeuralDynamics/galen-uv-workflows/.github/workflows/publish.yml@v2
|
|
19
|
+
with:
|
|
20
|
+
tag-name: ${{ github.ref_name }}
|
|
21
|
+
python-version: "3.13"
|
|
22
|
+
publish-to-pypi: true
|
|
23
|
+
secrets:
|
|
24
|
+
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
|
25
|
+
pypi-token: ${{ secrets.AIND_PYPI_TOKEN }}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
pip-wheel-metadata/
|
|
24
|
+
share/python-wheels/
|
|
25
|
+
*.egg-info/
|
|
26
|
+
.installed.cfg
|
|
27
|
+
*.egg
|
|
28
|
+
MANIFEST
|
|
29
|
+
|
|
30
|
+
# PyInstaller
|
|
31
|
+
# Usually these files are written by a python script from a template
|
|
32
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
33
|
+
*.manifest
|
|
34
|
+
*.spec
|
|
35
|
+
|
|
36
|
+
# Installer logs
|
|
37
|
+
pip-log.txt
|
|
38
|
+
pip-delete-this-directory.txt
|
|
39
|
+
|
|
40
|
+
# Unit test / coverage reports
|
|
41
|
+
htmlcov/
|
|
42
|
+
.tox/
|
|
43
|
+
.nox/
|
|
44
|
+
.coverage
|
|
45
|
+
.coverage.*
|
|
46
|
+
.cache
|
|
47
|
+
nosetests.xml
|
|
48
|
+
coverage.xml
|
|
49
|
+
*.cover
|
|
50
|
+
*.py,cover
|
|
51
|
+
.hypothesis/
|
|
52
|
+
.pytest_cache/
|
|
53
|
+
|
|
54
|
+
# Translations
|
|
55
|
+
*.mo
|
|
56
|
+
*.pot
|
|
57
|
+
|
|
58
|
+
# Django stuff:
|
|
59
|
+
*.log
|
|
60
|
+
local_settings.py
|
|
61
|
+
db.sqlite3
|
|
62
|
+
db.sqlite3-journal
|
|
63
|
+
|
|
64
|
+
# Flask stuff:
|
|
65
|
+
instance/
|
|
66
|
+
.webassets-cache
|
|
67
|
+
|
|
68
|
+
# Scrapy stuff:
|
|
69
|
+
.scrapy
|
|
70
|
+
|
|
71
|
+
# Sphinx documentation
|
|
72
|
+
docs/build/
|
|
73
|
+
|
|
74
|
+
# PyBuilder
|
|
75
|
+
target/
|
|
76
|
+
|
|
77
|
+
# Jupyter Notebook
|
|
78
|
+
.ipynb_checkpoints
|
|
79
|
+
|
|
80
|
+
# IPython
|
|
81
|
+
profile_default/
|
|
82
|
+
ipython_config.py
|
|
83
|
+
|
|
84
|
+
# pyenv
|
|
85
|
+
# .python-version
|
|
86
|
+
|
|
87
|
+
# pipenv
|
|
88
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
89
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
90
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
91
|
+
# install all needed dependencies.
|
|
92
|
+
#Pipfile.lock
|
|
93
|
+
|
|
94
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
|
|
95
|
+
__pypackages__/
|
|
96
|
+
|
|
97
|
+
# Celery stuff
|
|
98
|
+
celerybeat-schedule
|
|
99
|
+
celerybeat.pid
|
|
100
|
+
|
|
101
|
+
# SageMath parsed files
|
|
102
|
+
*.sage.py
|
|
103
|
+
|
|
104
|
+
# Environments
|
|
105
|
+
.env
|
|
106
|
+
.venv
|
|
107
|
+
env/
|
|
108
|
+
venv/
|
|
109
|
+
ENV/
|
|
110
|
+
env.bak/
|
|
111
|
+
venv.bak/
|
|
112
|
+
|
|
113
|
+
# Spyder project settings
|
|
114
|
+
.spyderproject
|
|
115
|
+
.spyproject
|
|
116
|
+
|
|
117
|
+
# Rope project settings
|
|
118
|
+
.ropeproject
|
|
119
|
+
|
|
120
|
+
# mkdocs documentation
|
|
121
|
+
/site
|
|
122
|
+
|
|
123
|
+
# mypy
|
|
124
|
+
.mypy_cache/
|
|
125
|
+
.dmypy.json
|
|
126
|
+
dmypy.json
|
|
127
|
+
|
|
128
|
+
# Pyre type checker
|
|
129
|
+
.pyre/
|
|
130
|
+
|
|
131
|
+
# PyCharm
|
|
132
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
133
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
134
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
135
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
136
|
+
.idea/
|
|
137
|
+
|
|
138
|
+
# MacOs
|
|
139
|
+
**/.DS_Store
|
|
140
|
+
|
|
141
|
+
# VSCode
|
|
142
|
+
.vscode/
|
|
143
|
+
|
|
144
|
+
# Scratch / working directory
|
|
145
|
+
scratch/
|
|
146
|
+
|
|
147
|
+
# Claude
|
|
148
|
+
.claude/
|
|
149
|
+
|
|
150
|
+
# Repo setup scripts (generated by template, not meant to be committed)
|
|
151
|
+
setup_repo.sh
|
|
152
|
+
configure_repo.sh
|
|
153
|
+
POST_GEN.md
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.13
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# AGENTS.md
|
|
2
|
+
|
|
3
|
+
Instructions for coding agents in this repository. [CONTRIBUTING.md](CONTRIBUTING.md) holds setup,
|
|
4
|
+
checks, tests and conventions, and applies to agents as to people: read it before running or
|
|
5
|
+
changing anything. [README.md](README.md) documents use.
|
|
6
|
+
|
|
7
|
+
- Run every command through `uv`; never bare `pip` or `python`.
|
|
8
|
+
- Before calling a change done, run `./scripts/run_linters_and_checks.sh -c`.
|
|
9
|
+
- Keep this file to what only an agent needs; development practice belongs in CONTRIBUTING.md,
|
|
10
|
+
usage in README.md, and what only Claude Code needs in CLAUDE.md.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## v0.2.0 (2026-12-01)
|
|
9
|
+
|
|
10
|
+
### Feat
|
|
11
|
+
|
|
12
|
+
- add portable structured diagnostics
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@AGENTS.md
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# Contributing to AIND diagnostics
|
|
2
|
+
|
|
3
|
+
This document is for people changing aind-diagnostics: setting up, running the checks and tests,
|
|
4
|
+
and the conventions a change follows. Using the package is documented in [README.md](README.md).
|
|
5
|
+
|
|
6
|
+
## Setup
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
uv sync
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
`uv sync` creates `.venv` holding the package and the dev group. `uv` manages the environment and
|
|
13
|
+
the lockfile, `uv.lock`: run commands with `uv run`, add a dependency with `uv add <package>` and a
|
|
14
|
+
development tool with `uv add --group dev <package>`, and never install with bare `pip`. The
|
|
15
|
+
jupyter group adds a kernel (`uv sync --group jupyter`).
|
|
16
|
+
|
|
17
|
+
## Checks
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
./scripts/run_linters_and_checks.sh -c
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Without `-c` the script only formats. With it, the script also runs ruff's linter, mypy, interrogate,
|
|
24
|
+
codespell on the files git tracks, and pytest with coverage, passing any arguments after `--` to
|
|
25
|
+
pytest. It runs in the existing `.venv` and does not sync it.
|
|
26
|
+
|
|
27
|
+
The same checks, one at a time:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
uv run --frozen ruff format
|
|
31
|
+
uv run --frozen ruff check
|
|
32
|
+
uv run --frozen mypy
|
|
33
|
+
uv run --frozen interrogate -v src
|
|
34
|
+
git ls-files -z | xargs -0 uv run --frozen codespell --check-filenames
|
|
35
|
+
uv run --frozen pytest --cov aind_diagnostics
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Tests
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
uv run pytest # the whole suite
|
|
42
|
+
uv run pytest tests/test_example.py # one file
|
|
43
|
+
uv run pytest -k "version" # tests whose names match
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Conventions
|
|
47
|
+
|
|
48
|
+
The package supports Python 3.10 to match its scientific-library consumers.
|
|
49
|
+
The Copier template currently offers 3.11 as its oldest answer; after rendering,
|
|
50
|
+
the package minimum, Ruff target, and CI floor are adjusted to 3.10. Preserve
|
|
51
|
+
those overrides when updating the template. Development runs on Python 3.13.
|
|
52
|
+
|
|
53
|
+
- Source lives in `src/aind_diagnostics/` and tests in `tests/`; hatchling builds the
|
|
54
|
+
wheel.
|
|
55
|
+
- ruff sets a line length of 120 and numpy-style docstrings, and exempts tests from the
|
|
56
|
+
docstring and annotation rules. interrogate fails below 30%
|
|
57
|
+
docstring coverage of `src`.
|
|
58
|
+
- mypy checks `src/aind_diagnostics` in strict mode.
|
|
59
|
+
- Comments and docstrings say what the code does not: why it is written this way, and what breaks
|
|
60
|
+
otherwise. They carry no history; the reason for a change belongs in its commit message.
|
|
61
|
+
- `scratch/` is gitignored and excluded from the linters, for work that is not kept.
|
|
62
|
+
- Commit messages follow [Conventional Commits](https://www.conventionalcommits.org/) (`feat:`,
|
|
63
|
+
`fix:`, `docs:`, `chore:`): an imperative title, and a body giving what changed and why. After CI
|
|
64
|
+
passes on `main`, the bump workflow uses commitizen to bump the version from them and update
|
|
65
|
+
`CHANGELOG.md`.
|
|
66
|
+
- A change a user would notice updates README.md in the same commit.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Allen Institute for Neural Dynamics
|
|
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.
|
|
22
|
+
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: aind-diagnostics
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Structured diagnostics for scientific data processing
|
|
5
|
+
Project-URL: Repository, https://github.com/AllenNeuralDynamics/aind-diagnostics/
|
|
6
|
+
Project-URL: Issues, https://github.com/AllenNeuralDynamics/aind-diagnostics/issues
|
|
7
|
+
Project-URL: Changelog, https://github.com/AllenNeuralDynamics/aind-diagnostics/blob/main/CHANGELOG.md
|
|
8
|
+
Author: Allen Institute for Neural Dynamics
|
|
9
|
+
Author-email: Galen Lynch <galen@galenlynch.com>
|
|
10
|
+
License-Expression: MIT
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Requires-Python: >=3.10
|
|
14
|
+
Requires-Dist: pydantic<3,>=2.10
|
|
15
|
+
Requires-Dist: typing-extensions>=4.12
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
|
|
18
|
+
# AIND diagnostics
|
|
19
|
+
|
|
20
|
+
`aind-diagnostics` gives Python libraries a common way to explain failed checks.
|
|
21
|
+
A diagnostic records what was expected, what was observed, which input is affected,
|
|
22
|
+
and what the user can do next. Reports retain that evidence as JSON and provide a
|
|
23
|
+
short explanation for people reading pipeline output.
|
|
24
|
+
|
|
25
|
+
The package targets PyPI and Python 3.10 or newer. Once released, install it with
|
|
26
|
+
`uv add aind-diagnostics`. For development, use `uv sync` in this checkout.
|
|
27
|
+
|
|
28
|
+
```python
|
|
29
|
+
from aind_diagnostics import Diagnostic, DiagnosticError, DiagnosticReport
|
|
30
|
+
|
|
31
|
+
missing = Diagnostic(
|
|
32
|
+
code="input.collection_absent",
|
|
33
|
+
message="The requested collection was not found.",
|
|
34
|
+
expected="A recorded collection named ProbeA.",
|
|
35
|
+
observed={"available_collections": ["ProbeB", "ProbeC"]},
|
|
36
|
+
subject={"asset": "recording-123", "collection": "ProbeA"},
|
|
37
|
+
next_step="Check the collection name against the recording metadata.",
|
|
38
|
+
)
|
|
39
|
+
report = DiagnosticReport(diagnostics=(missing,), facts={"inputs_inspected": 1})
|
|
40
|
+
print(report.render())
|
|
41
|
+
payload = report.to_dict()
|
|
42
|
+
# Stop an operation while retaining evidence for the execution host:
|
|
43
|
+
raise DiagnosticError(report)
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Reports and causes
|
|
47
|
+
|
|
48
|
+
Each diagnostic has a stable `id`, a `code`, a severity (`error`, `warning`, or
|
|
49
|
+
`info`), and an outcome. Use `failed` for an observed unmet expectation, `unknown`
|
|
50
|
+
when inspection could not establish the answer, `unsupported` for a known case
|
|
51
|
+
that the software cannot handle, and `blocked` when another failed check prevented
|
|
52
|
+
evaluation. A blocked diagnostic links to its prerequisites through `caused_by`.
|
|
53
|
+
|
|
54
|
+
Construct a report containing both causes and consequences. Reports reject
|
|
55
|
+
repeated IDs, missing references, and cycles. Their text groups root causes and
|
|
56
|
+
lists affected inputs; their JSON retains every diagnostic. `diagnostic.updated(...)`
|
|
57
|
+
validates changes and recomputes the ID when evidence changes. Pydantic's
|
|
58
|
+
`model_copy(update=...)` skips validation and should not be used for this purpose.
|
|
59
|
+
|
|
60
|
+
One report holds up to 2,000 diagnostics. A generated explanation is at most
|
|
61
|
+
12,000 characters; an explanation supplied by a producer can be up to 16,000.
|
|
62
|
+
Larger sets of checks should be split into reports for separate work units.
|
|
63
|
+
|
|
64
|
+
The wire format has its own `schema_version`, currently `1.0.0`, independent of
|
|
65
|
+
the package release. `validate_report(payload)` validates incoming JSON, preserves
|
|
66
|
+
the producer's summary, and accepts diagnostic codes it has never seen. Generate
|
|
67
|
+
the schema with `DiagnosticReport.model_json_schema()`.
|
|
68
|
+
|
|
69
|
+
`subject`, `observed`, `evidence`, and `facts` contain JSON values. Their domain
|
|
70
|
+
meaning belongs to the library producing them. For example, an ephys library
|
|
71
|
+
defines what constitutes a valid recording; this package validates the report
|
|
72
|
+
structure and its causal graph. Display summaries are bounded; full evidence
|
|
73
|
+
remains in the report. URL queries are redacted before identity calculation and
|
|
74
|
+
serialization. Producers must omit credentials in other forms themselves.
|
|
75
|
+
|
|
76
|
+
## Integration
|
|
77
|
+
|
|
78
|
+
Scientific libraries depend only on this package and Pydantic. Execution hosts
|
|
79
|
+
can catch `DiagnosticError` or inspect an exception's `diagnostic_report`
|
|
80
|
+
attribute. `ReportedFailure` carries a validated report received from another
|
|
81
|
+
process. `combined_report` provides a display aggregate; keep individual worker
|
|
82
|
+
reports when facts with the same key refer to different jobs.
|
|
83
|
+
|
|
84
|
+
Code Ocean report files and exception rendering belong in
|
|
85
|
+
`aind-code-ocean-pipeline-utils[diagnostics]`. Fetching reports from remote
|
|
86
|
+
computations belongs in `aind-codeocean-dispatch[diagnostics]`. Neither is a
|
|
87
|
+
dependency of this package.
|
|
88
|
+
|
|
89
|
+
Development and validation commands are in [CONTRIBUTING.md](CONTRIBUTING.md).
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# AIND diagnostics
|
|
2
|
+
|
|
3
|
+
`aind-diagnostics` gives Python libraries a common way to explain failed checks.
|
|
4
|
+
A diagnostic records what was expected, what was observed, which input is affected,
|
|
5
|
+
and what the user can do next. Reports retain that evidence as JSON and provide a
|
|
6
|
+
short explanation for people reading pipeline output.
|
|
7
|
+
|
|
8
|
+
The package targets PyPI and Python 3.10 or newer. Once released, install it with
|
|
9
|
+
`uv add aind-diagnostics`. For development, use `uv sync` in this checkout.
|
|
10
|
+
|
|
11
|
+
```python
|
|
12
|
+
from aind_diagnostics import Diagnostic, DiagnosticError, DiagnosticReport
|
|
13
|
+
|
|
14
|
+
missing = Diagnostic(
|
|
15
|
+
code="input.collection_absent",
|
|
16
|
+
message="The requested collection was not found.",
|
|
17
|
+
expected="A recorded collection named ProbeA.",
|
|
18
|
+
observed={"available_collections": ["ProbeB", "ProbeC"]},
|
|
19
|
+
subject={"asset": "recording-123", "collection": "ProbeA"},
|
|
20
|
+
next_step="Check the collection name against the recording metadata.",
|
|
21
|
+
)
|
|
22
|
+
report = DiagnosticReport(diagnostics=(missing,), facts={"inputs_inspected": 1})
|
|
23
|
+
print(report.render())
|
|
24
|
+
payload = report.to_dict()
|
|
25
|
+
# Stop an operation while retaining evidence for the execution host:
|
|
26
|
+
raise DiagnosticError(report)
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Reports and causes
|
|
30
|
+
|
|
31
|
+
Each diagnostic has a stable `id`, a `code`, a severity (`error`, `warning`, or
|
|
32
|
+
`info`), and an outcome. Use `failed` for an observed unmet expectation, `unknown`
|
|
33
|
+
when inspection could not establish the answer, `unsupported` for a known case
|
|
34
|
+
that the software cannot handle, and `blocked` when another failed check prevented
|
|
35
|
+
evaluation. A blocked diagnostic links to its prerequisites through `caused_by`.
|
|
36
|
+
|
|
37
|
+
Construct a report containing both causes and consequences. Reports reject
|
|
38
|
+
repeated IDs, missing references, and cycles. Their text groups root causes and
|
|
39
|
+
lists affected inputs; their JSON retains every diagnostic. `diagnostic.updated(...)`
|
|
40
|
+
validates changes and recomputes the ID when evidence changes. Pydantic's
|
|
41
|
+
`model_copy(update=...)` skips validation and should not be used for this purpose.
|
|
42
|
+
|
|
43
|
+
One report holds up to 2,000 diagnostics. A generated explanation is at most
|
|
44
|
+
12,000 characters; an explanation supplied by a producer can be up to 16,000.
|
|
45
|
+
Larger sets of checks should be split into reports for separate work units.
|
|
46
|
+
|
|
47
|
+
The wire format has its own `schema_version`, currently `1.0.0`, independent of
|
|
48
|
+
the package release. `validate_report(payload)` validates incoming JSON, preserves
|
|
49
|
+
the producer's summary, and accepts diagnostic codes it has never seen. Generate
|
|
50
|
+
the schema with `DiagnosticReport.model_json_schema()`.
|
|
51
|
+
|
|
52
|
+
`subject`, `observed`, `evidence`, and `facts` contain JSON values. Their domain
|
|
53
|
+
meaning belongs to the library producing them. For example, an ephys library
|
|
54
|
+
defines what constitutes a valid recording; this package validates the report
|
|
55
|
+
structure and its causal graph. Display summaries are bounded; full evidence
|
|
56
|
+
remains in the report. URL queries are redacted before identity calculation and
|
|
57
|
+
serialization. Producers must omit credentials in other forms themselves.
|
|
58
|
+
|
|
59
|
+
## Integration
|
|
60
|
+
|
|
61
|
+
Scientific libraries depend only on this package and Pydantic. Execution hosts
|
|
62
|
+
can catch `DiagnosticError` or inspect an exception's `diagnostic_report`
|
|
63
|
+
attribute. `ReportedFailure` carries a validated report received from another
|
|
64
|
+
process. `combined_report` provides a display aggregate; keep individual worker
|
|
65
|
+
reports when facts with the same key refer to different jobs.
|
|
66
|
+
|
|
67
|
+
Code Ocean report files and exception rendering belong in
|
|
68
|
+
`aind-code-ocean-pipeline-utils[diagnostics]`. Fetching reports from remote
|
|
69
|
+
computations belongs in `aind-codeocean-dispatch[diagnostics]`. Neither is a
|
|
70
|
+
dependency of this package.
|
|
71
|
+
|
|
72
|
+
Development and validation commands are in [CONTRIBUTING.md](CONTRIBUTING.md).
|