Metadata-Version: 2.5
Name: acid-cat-catalog
Version: 0.1.0
Summary: Write an AcidCat catalog in Python and render it in canonical form.
Project-URL: Homepage, https://github.com/Hebilicious/acidcat/tree/main/packages/catalog/python#readme
Project-URL: Repository, https://github.com/Hebilicious/acidcat
Project-URL: Issues, https://github.com/Hebilicious/acidcat/issues
Author: Hebilicious
License-Expression: MIT
License-File: LICENSE
Keywords: acidcat,catalog
Classifier: Development Status :: 3 - Alpha
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.11
Description-Content-Type: text/markdown

# acid-cat-catalog

The AcidCat catalog library for Python. PyPI package: `acid-cat-catalog`.

Write a catalog in Python, and write it in canonical form. The library uses only the standard library. Use it at build time to write `acidcat.catalog.json`.

```sh
pip install acid-cat-catalog
```

```python
from pathlib import Path
from acid_cat_catalog import Catalog

catalog = Catalog(title="Living-room air conditioner")
catalog.target("cli", bindings=["cli"])
offline = catalog.type("Offline", {"type": "object"})
catalog.capability(
    "aircon.power.set",
    description="Turn the unit on or off.",
    audience=["cli"],
    input={"type": "object", "required": ["on"], "properties": {"on": {"type": "boolean"}}},
    failures={"Offline": offline},
)

Path("acidcat.catalog.json").write_text(catalog.render())
```

`validate()` lists the rules a catalog breaks, and `render()` raises `CatalogError` for one that breaks any. The full example is [`examples/aircon.py`](examples/aircon.py). Test with `moon run catalog-python:test`.
