Metadata-Version: 2.4
Name: wau
Version: 0.1.3
Summary: Web API Utils for Werkzeug
License-Expression: LGPL-3.0-or-later
Project-URL: Repository, https://codeberg.org/smlz/wau
Keywords: api,json,werkzeug,education
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Education
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.14
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: dataset>=2.0.0
Requires-Dist: pyjwt>=2.13.0
Requires-Dist: watchdog>=6.0.0
Requires-Dist: werkzeug>=3.1.8
Dynamic: license-file

# wau - Web API Utils

Web API Utils, or short `wau`, is a thin layer on top of Werkzeug to provide a simple and consistent interface for writing APIs in Python. `wau` is built for educational purposes and is not intended for production use. It is opinionated, as it only supports JSON as data format. It uses simple type annotations to define the expected input and output of the API endpoints. Common tasks as authentication, CORS and server-sent events are supported out of the box.

## Installation

Install from PyPI:

```sh
pip install wau
```

or with uv:

```sh
uv add wau
```

## Serving static files

`run()` can serve a static front-end next to your API. Pass `static=True` to
serve files from the directory of the calling script, or `static="some/dir"`
to serve a specific directory:

```python
from wau import run

run(api, static=True)
```

Only an allow-listed set of file types is served by default (HTML, CSS,
JavaScript, images, fonts, ...), so source code and dotfiles such as `.env`
are never exposed. Adjust the allowed file-name globs with `static_include`
and `static_exclude` (`static_exclude` takes precedence):

```python
run(api, static=True, static_include=("*.html", "*.css", "*.js"))
```

While static serving is enabled, the served pages reload automatically in the
browser whenever a file changes. This uses the optional
[`watchdog`](https://pypi.org/project/watchdog/) package when it is installed
and falls back to polling otherwise. Both this browser reload and Werkzeug's
Python source reloader are controlled by `use_reloader` (on by default); set
`use_reloader=False` to disable them.

## Testing

Test dependencies are separated from runtime dependencies in `pyproject.toml`
using the `test` dependency group.

Run the test suite:

```sh
uv run --group test python -m pytest -q
```

Run doctests:

```sh
uv run --group test python -m doctest .\wau.py
```

## Publishing

Build package artifacts:

```sh
uv build
```

Validate metadata and README rendering:

```sh
uvx twine check dist/*
```

Upload to TestPyPI first:

```sh
uv publish --publish-url https://test.pypi.org/legacy/
```

Then publish to PyPI:

```sh
uv publish
```

## License

This project is licensed under GNU LGPL v3 or later (`LGPL-3.0-or-later`).

If you distribute modified versions of this library, those library
modifications must be published under the same license terms.
