Metadata-Version: 2.4
Name: atlas-chai
Version: 2.7.0
Summary: Python bindings for CHAI conditions database library
Keywords: conditions,database,CREST,ATLAS,physics
Author: CERN ATLAS
Maintainer-Email: Joe Gibson <joseph.gibson@cern.ch>
License-Expression: Apache-2.0
License-File: LICENSE
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Science/Research
Classifier: Topic :: Scientific/Engineering :: Physics
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: C++
Project-URL: Homepage, https://gitlab.cern.ch/crest-db/chai
Project-URL: Documentation, https://gitlab.cern.ch/crest-db/chai/-/blob/master/python/README.md
Project-URL: Repository, https://gitlab.cern.ch/crest-db/chai.git
Project-URL: Issues, https://gitlab.cern.ch/crest-db/chai/-/issues
Requires-Python: >=3.12
Description-Content-Type: text/markdown

# atlas-chai

Python bindings for CHAI (Conditions High-level Application Interface), the ATLAS library for reading and writing conditions data. One API covers several backends, each a plugin selected by the connection string's scheme:

| Scheme | Backend |
|---|---|
| `crest:` | A CREST server, e.g. `crest:https://crest.cern.ch/api-v6.0` |
| `crest_fs:` | CREST's on-disk format in a local directory |
| `coolr:` | Legacy COOL data through the COOLR REST service (read-only) |

## Install

```bash
python3.12 -m venv ~/chai-env
~/chai-env/bin/pip install atlas-chai
```

| Platform | Status |
|---|---|
| Linux x86_64 (glibc 2.28+, e.g. EL8/EL9, Ubuntu 20.04+), CPython 3.12 and newer | One `cp312-abi3` wheel per release |
| macOS | Not on PyPI yet; [build a wheel locally](https://gitlab.cern.ch/crest-db/chai/-/blob/master/python/WHEEL_BUILDING.md#macos) |
| Free-threaded CPython (`3.13t`, `3.14t`) | Not supported |

The import name is `chai`. Releases up to 2.6.0 were published only to the GitLab Package Registry, as `chai-db`; uninstall that first if you have it.

## Example

Write one payload to a local `crest_fs` directory and read it back:

```python
import chai

db = chai.Database("crest_fs:/tmp/chai-demo")
spec = chai.PayloadSpec(chai.FieldSpec([chai.Field("hv", chai.Type.Float)]),
                        chai.ChannelSpec([chai.Channel(0, "barrel")]))
tag = db.create_tag("DemoTag", "Example tag", spec)
payload = tag.build_container()
payload[0]["hv"] = 1500.0
tag.add_payload(payload, since=0)
print(tag.get_payload_at(42).payload.get(0, "hv"))   # 1500.0
```

## Documentation

- [Python API reference](https://gitlab.cern.ch/crest-db/chai/-/blob/master/python/README.md)
- [CHAI overview and C++ API](https://gitlab.cern.ch/crest-db/chai/-/blob/master/README.md)
- [Install options and building wheels](https://gitlab.cern.ch/crest-db/chai/-/blob/master/python/WHEEL_BUILDING.md)
- [Changelog](https://gitlab.cern.ch/crest-db/chai/-/blob/master/CHANGELOG.md)
- [Source and issues](https://gitlab.cern.ch/crest-db/chai)
