Metadata-Version: 2.4
Name: dough
Version: 0.4.0
Summary: Roll your own typed wrapper
Author: Marnik Bercx
License: MIT License
        
        Copyright (c) 2025 Marnik Bercx
        
        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.
License-File: LICENSE
Classifier: Development Status :: 4 - Beta
Classifier: Programming Language :: Python
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: Programming Language :: Python :: 3.14
Requires-Python: >=3.10
Requires-Dist: glom
Provides-Extra: docs
Requires-Dist: mkdocs; extra == 'docs'
Requires-Dist: mkdocs-material; extra == 'docs'
Provides-Extra: pint
Requires-Dist: pint<0.25,>0.24; extra == 'pint'
Provides-Extra: pre-commit
Requires-Dist: mypy; extra == 'pre-commit'
Requires-Dist: pre-commit; extra == 'pre-commit'
Provides-Extra: tests
Requires-Dist: numpy; extra == 'tests'
Requires-Dist: pint<0.25,>0.24; extra == 'tests'
Requires-Dist: pytest; extra == 'tests'
Requires-Dist: pytest-cov; extra == 'tests'
Requires-Dist: pytest-regressions; extra == 'tests'
Requires-Dist: pyyaml; extra == 'tests'
Description-Content-Type: text/markdown

[![Templated from python-copier](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/mbercx/python-copier/refs/heads/main/docs/img/badge.json)](https://github.com/mbercx/python-copier)

# `dough`

*Roll your own typed wrapper.*

>[!WARNING]
> `dough` is still pre-1.0. The API is still evolving and can break in minor releases.

`dough` is a small framework for building typed Python wrappers around the output files of simulation codes.
It ships the generic machinery — file parsers, declarative output mappings, optional library converters — and stays out of the way of the code-specific details.
Code-specific wrappers live in their own packages (see [Packages built on `dough`](#packages-built-on-dough) below).

## 🌯 The current layers

- **Parsers** — turn one output file into a plain dict. One parser per file format; stateless, with a single `parse(content)` method.
- **Output mappings** — frozen dataclasses whose fields are `Annotated[T, Spec(...)]`. Each field declares the output's name, type, unit (in its docstring), and how to extract it from the parsed dicts via a [`glom`](https://glom.readthedocs.io/) `Spec`. One source of truth per quantity.
- **Converters** — optional adapters that turn base Python outputs into `ase`, `pymatgen`, or `aiida-core` objects. Heavy third-party imports stay lazy so wrapper packages don't pay for them at import time.

See the [outputs design page](https://mbercx.github.io/dough/design/outputs/) for the full picture.

## 🧪 Testing

`dough.testing` ships shared pytest fixtures (`json_serializer`, `robust_data_regression_check`) used by downstream wrapper packages for regression tests.
It's an opt-in plugin — activate it in your top-level `conftest.py` with `pytest_plugins = ["dough.testing.plugin"]`.
See the [testing design page](https://mbercx.github.io/dough/design/testing/).

## 📦 Packages built on `dough`

| Package | Code | Status |
| --- | --- | --- |
| [`qe-tools`](https://github.com/aiidateam/qe-tools) | [Quantum ESPRESSO](https://www.quantum-espresso.org/) | alpha — `pw.x`, `dos.x` outputs |
| [`strudel`](https://github.com/mbercx/strudel) | [VASP](https://www.vasp.at/) | alpha — basic outputs + magnetization |

## 📚 Docs

Full documentation at [mbercx.github.io/dough](https://mbercx.github.io/dough/).

## 🤝 Contributing

It's still early days, and too soon to accept external contributions.
Feedback is most welcome though, feel free to open issue!
