Metadata-Version: 2.1
Name: contextmanaged-assign
Version: 0.1.0
Summary: 
Author: Jacob Valdez
Author-email: jacobfv123@gmail.com
Requires-Python: >=3.10,<4.0
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Requires-Dist: glom (>=23.3.0,<24.0.0)
Requires-Dist: simple-dotdict (>=1.0.0,<2.0.0)
Description-Content-Type: text/markdown

# ContextManaged Assign

This Python project provides a context manager for temporarily assigning a value to a variable or attribute. The original value is restored when the context is exited.

## Usage

```python
from contextmanaged_assign import assign

l = [1, 2, 3]

assert l[0] == 1
with assign("l[0]", 2):
    assert l[0] == 2
assert l[0] == 1
```

Please note that `assign` cannot modify local variables themselves. For example, the following code will not work:

```python
x = 1
with assign("x", 2):
    assert x == 2  # AssertionError: 1 != 2
assert x == 1
```

## Installation

Simply install the package using `pip`:

```bash
pip install contextmanaged-assign
```

Then import the `assign` function from the `contextmanaged-assign` module.

## License

[MIT](LICENSE)
