Metadata-Version: 2.4
Name: shrug-it
Version: 0.1.0
Summary: Shrug off exceptions with style. ¯\_(ツ)_/¯
Author: localghosting
License: MIT
Project-URL: Homepage, https://github.com/yourusername/shrug-it
Project-URL: Issues, https://github.com/yourusername/shrug-it/issues
Keywords: exceptions,error-handling,decorator,context-manager
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"
Dynamic: license-file

# shrug

¯\\_(ツ)_/¯

Sometimes an exception just isn't worth crashing over. `shrug` lets you shrug
it off — as a decorator or a context manager — and keeps a running tally of
how many times it's had to.

## Install

```bash
pip install shrug-it
```

## Usage

As a decorator:

```python
from shrug import shrug

@shrug()
def risky_division(a, b):
    return a / b

risky_division(1, 0)  # logs a warning, returns None instead of raising
```

As a context manager:

```python
from shrug import shrug

with shrug(default=[]):
    data = fetch_from_flaky_api()
```

Only shrug off specific exceptions:

```python
@shrug(KeyError, ValueError)
def parse(d):
    return d["value"]
```

Give up after N shrugs and let it actually raise:

```python
@shrug(reraise_after=3)
def flaky():
    ...
```

Check the damage:

```python
from shrug import stats
stats()  # {'count': 7}
```

## Why

Not every failure deserves a stack trace in a demo script, a notebook, or a
best-effort background job. `shrug` is a small, honest way to say "eh,
whatever" without silently eating errors you actually care about — you
choose exactly which exceptions get the shrug treatment.

## License

MIT
