Metadata-Version: 2.4
Name: saferaise
Version: 0.0.1a12
Summary: Checked exceptions for Python. Declare what your functions raise, and let saferaise enforce it - using your existing try/except blocks.
Project-URL: Homepage, https://github.com/Paillat-dev/saferaise
Project-URL: Documentation, https://paillat.dev/saferaise/
Project-URL: Source code, https://github.com/Paillat-dev/saferaise/archive/7b5798d19f1720ce64a229fe37f95db27387c857.zip
Author-email: Paillat-dev <me@paillat.dev>
License-Expression: MIT
License-File: LICENSE
Keywords: checked exceptions,error handling,exceptions,type checking
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.13
Classifier: Typing :: Typed
Requires-Python: ==3.13.*
Description-Content-Type: text/markdown


[![Alpha](https://img.shields.io/badge/status-alpha-orange)](https://github.com/Paillat-dev/saferaise)
[![PyPI](https://img.shields.io/pypi/v/saferaise)](https://pypi.org/project/saferaise/)
[![py.typed](https://img.shields.io/badge/typing-py.typed-blue)](https://peps.python.org/pep-0561/)
[![CI](https://github.com/Paillat-dev/saferaise/actions/workflows/CI.yaml/badge.svg)](https://github.com/Paillat-dev/saferaise/actions)
[![License: MIT](https://img.shields.io/badge/license-MIT-green)](https://github.com/Paillat-dev/saferaise/tree/mainLICENSE)

**Checked exceptions for Python.** Declare what your functions raise, and let `saferaise` enforce it - using your existing `try/except` blocks.

> **CAUTION**:
> **Alpha:** The API may change between releases, and using this right now might very well break your code in weird ways, so don't use it in production.

## Quick Start

```python
# entrypoint.py
import saferaise

saferaise.register("app")   # instrument app's try/except blocks before importing it

import app
with saferaise.enable():    # activate checking for this scope
    app.main()
```

```python
# app.py
from saferaise import raises

@raises(ValueError)
def parse_input(raw: str) -> int:
    return int(raw)

def main():
    try:
        parse_input("abc")  # ValueError is caught here - @raises is satisfied
    except ValueError:
        print("bad input")
```

`register` must be called **before** importing the package it instruments, and in a **separate file** from the code being instrumented.

## Documentation

Full documentation is available at **[https://paillat.dev/saferaise](https://paillat.dev/saferaise)**

* [How It Works](https://paillat.dev/saferaise/how-it-works/)
* [Advanced Usage](https://paillat.dev/saferaise/advanced/)
* [API Reference](https://paillat.dev/saferaise/api/)

## License

MIT License. See [LICENSE](https://github.com/Paillat-dev/saferaise/tree/mainLICENSE) for details.
