Metadata-Version: 2.4
Name: nullwise
Version: 0.3.2
Summary: Precise, actionable explanations for NoneType attribute errors
Author: ZUHAYR
Project-URL: Homepage, https://github.com/ZUHAYR-A/nullwise
Keywords: debugging,error-handling,exceptions
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Development Status :: 3 - Alpha
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE.txt
Dynamic: license-file

# nullwise

Turns Python's most common and least helpful error: `AttributeError:
'NoneType' object has no attribute 'X'` into a clear explanation of what
was None, where it came from, and a suggested fix.

## Install

    pip install nullwise

## Usage: decorator (recommended)

Wrap any function that touches data which might be missing, unset, or
returned as None. Works on any attribute, any object type, not tied to
any specific use case.

    from nullwise import traced

    @traced
    def process(data):
        return data.value  # crashes if data is None

The decorator always re-raises the original exception after explaining it.
it never hides or swallows errors, it only adds context.

## Usage: global hook

Catches any fully unhandled crash anywhere in your program, with no
decorators needed. Note: this only helps for errors that aren't already
caught by a try/except somewhere in your code. Use the decorator above for
those cases.

    import nullwise
    nullwise.enable()

## What it looks like

Instead of:

    AttributeError: 'NoneType' object has no attribute 'X'

You get the variable that was None, where it was assigned, and a suggested
fix based on the common cause.

## What it catches

Validated against real-world patterns, including:
- Functions that return None implicitly (no explicit return statement)
- dict.get() returning None for a missing key
- Regex functions (re.search, re.match) returning no match
- Failed file or API loads that return None on error
- In-place list methods (sort, append, etc.) that return None

Each of these gives a tailored fix suggestion. Anything else falls back to
a general explanation of where the None value came from.

## What it doesn't catch

nullwise is scoped specifically to AttributeError. A related but different
error TypeError: 'NoneType' object is not subscriptable (e.g. None["key"])
is not currently covered.

## License

MIT
