Metadata-Version: 2.4
Name: semimutable
Version: 0.1.0a0
Summary: Drop-in replacement for Python's built-in `dataclasses` module, allowing for certain fields to be mutable while others remain immutable.
Author: Glinte
License-Expression: MIT
License-File: LICENSE
Keywords: dataclasses
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Topic :: Software Development :: Libraries
Requires-Python: >=3.12
Description-Content-Type: text/markdown

# Semimutable

A dataclass drop-in that allows you to define individual fields as immutable.

## Usage

Simply replace all your `dataclasses` imports with `semimutable`, and use `frozen_field` to replace `field` for the fields you want to be immutable.

`frozen_field` takes in the same parameters as `dataclasses.field`, so you can specify default values, default factories, and other options just like you would with a regular dataclass field.

Here is one example from our tests.

```python
from semimutable import dataclass, frozen_field

@dataclass
class Simple:
    x: int = frozen_field()
    y: int = 0 # normal, mutable field

def test_frozen_field_is_immutable():
    obj = Simple(x=1, y=2)
    with pytest.raises(TypeError):
        obj.x = 99

def test_non_frozen_field_is_mutable():
    obj = Simple(x=1, y=2)
    obj.y = 42
    assert obj.y == 42
```