# scope_profiler.h5schema

*module*

Versioning and compatibility helpers for scope-profiler HDF5 files.

[View source](https://github.com/max-models/scope-profiler/blob/devel/src/scope_profiler/h5schema.py#L1-L1)

## scope_profiler.h5schema.CURRENT_SCHEMA_VERSION

*attribute* · *module attribute*

```python
CURRENT_SCHEMA_VERSION = 3
```

[View source](https://github.com/max-models/scope-profiler/blob/devel/src/scope_profiler/h5schema.py#L8-L8)

## scope_profiler.h5schema.SCHEMA_ATTRIBUTE

*attribute* · *module attribute*

```python
SCHEMA_ATTRIBUTE = 'scope_profiler_schema'
```

[View source](https://github.com/max-models/scope-profiler/blob/devel/src/scope_profiler/h5schema.py#L7-L7)

## scope_profiler.h5schema.HDF5SchemaError

*class*

```python
class HDF5SchemaError(ValueError)
```

Bases: `ValueError`

Raised when a profiling file has an invalid or unsupported schema.

[View source](https://github.com/max-models/scope-profiler/blob/devel/src/scope_profiler/h5schema.py#L11-L12)

## scope_profiler.h5schema.migrate_schema

*function*

```python
def migrate_schema(h5file, version: int) -> int
```

Normalize a supported file schema for the reader.

This is intentionally a separate dispatch point even while version 1 is
the only schema. Future readers can add transformations for older layouts
here without spreading version checks through the HDF5 parser. Migration
is read-only: the input file is never modified.

[View source](https://github.com/max-models/scope-profiler/blob/devel/src/scope_profiler/h5schema.py#L44-L54)

## scope_profiler.h5schema.read_schema_version

*function*

```python
def read_schema_version(h5file) -> int
```

Return and validate the schema version stored on an HDF5 file.

Files written before schema versioning was introduced have no attribute;
they are the original layout and are therefore treated as version 1.

[View source](https://github.com/max-models/scope-profiler/blob/devel/src/scope_profiler/h5schema.py#L15-L41)
