Metadata-Version: 2.5
Name: hca-metadata-schema
Version: 0.2.0
Summary: HCA metadata schema: LinkML definitions and the Pydantic models generated from them
Project-URL: Homepage, https://github.com/clevercanary/hca-validation-tools
Author-email: Clever Canary <dave@clevercanary.com>
License-Expression: MIT
Requires-Python: <4.0,>=3.10
Requires-Dist: pydantic<3,>=2
Description-Content-Type: text/markdown

# hca-metadata-schema

The HCA metadata schema: the LinkML YAML definitions and the Pydantic models generated from them.

## Installation

```bash
pip install hca-metadata-schema
```

## Usage

```python
from hca_metadata_schema import CORE_SCHEMA_PATH, __version__
from hca_metadata_schema.generated.core import Cell, Dataset, Donor, Sample

# The Pydantic models validate a record against the schema
Donor(...)

# The LinkML source, for tools that read the schema itself (e.g. linkml-runtime's SchemaView)
CORE_SCHEMA_PATH  # .../hca_metadata_schema/core.yaml
```

The package depends only on pydantic. Reading the YAML with `SchemaView` needs `linkml-runtime`, which
you install yourself.

## Versioning

The schema has one version, in `core.yaml`, and the package version is the same number. What each bump
means is set out in
[`docs/schema-version-contract.md`](https://github.com/clevercanary/hca-validation-tools/blob/main/docs/schema-version-contract.md).

## Development

```bash
make gen-schema       # regenerate generated/core.py from the YAML
make validate-schema  # check every YAML file compiles
uv run pytest tests/ -v
```

After editing the YAML, regenerate the models and the data dictionary (`make -C shared gen-schema
generate-data-dictionary` from the repo root) and commit the result. CI's `generated-schema` job fails if either is
stale, and the opt-in pre-commit hook `schema-generated` regenerates them when a schema YAML file is committed.
