Metadata-Version: 2.4
Name: mesokit-schema
Version: 0.4.0
Summary: Shared data contract for the mesofield -> datakit -> databench pipeline.
Author: Jacob Gronemeyer
License: MIT License
        
        Copyright (c) 2026 Gronemeyer
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://github.com/Gronemeyer/mesokit-schema
Project-URL: Repository, https://github.com/Gronemeyer/mesokit-schema
Project-URL: Issues, https://github.com/Gronemeyer/mesokit-schema/issues
Keywords: neuroscience,schema,pipeline,bids,mesofield
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Science/Research
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pydantic<3.0,>=2.0
Provides-Extra: test
Requires-Dist: pytest; extra == "test"
Dynamic: license-file

# mesokit-schema

Shared data contract for the **mesofield → datakit → databench** pipeline.

This package defines the typed manifests that travel alongside data between the three repos. It is the single source of truth for:

- **`AcquisitionManifest`** — what mesofield writes at the end of a session: the list of producers that ran, the files they wrote, calibration constants, time bases, and session identity. Datakit consumes this instead of globbing the filesystem.
- **`DatasetManifest`** — what datakit writes alongside the dataset table: schema version, datakit version, content hash of the data file, hash of the upstream acquisition manifest, master `TimeBasis`, source-parser versions, declared columns. Databench validates against this on load and concatenates it into provenance.
- **`AnalysisDeclaration`** — what each databench analysis declares about its inputs and parameters, so a dataset can be validated against an analysis *before* it runs.

Plus shared building blocks: `TimeBasis`, `ColumnSpec`, BIDS path helpers, and a single `SCHEMA_VERSION` constant.

## Install

From PyPI:

```sh
pip install mesokit-schema
```

From GitHub (latest main):

```sh
pip install git+https://github.com/Gronemeyer/mesokit-schema.git
```

### Development

For local development across the pipeline, editable-install into all three envs at once:

```sh
./scripts/install-dev.sh                  # all envs
./scripts/install-dev.sh mesofield        # one env
```

The script editable-installs `mesokit-schema` plus the env's own package (`mesofield`, `datakit`, `databench`) into each matching conda env. Override layout via `CONDA_ENVS_ROOT`, `DEV_ROOT`, or `DATABENCH_ROOT` env vars.

Or install manually:

```sh
pip install -e /path/to/mesokit-schema
```

## Versioning

The package exposes `mesokit_schema.SCHEMA_VERSION` (semver). Consumers compare against the `schema_version` field on each manifest and refuse to load anything they don't know how to read. Bump the major version on breaking changes; minor on additive fields.
