This library provides decorators and base classes to create immutable data classes in Python. By enforcing immutability and keyword-only arguments, it enhances the robustness and clarity of your data structures.
- Python 3.9 or later.
- No external dependencies are required.
pip install python-immutable
poetry add python-immutable
Apply immutable
to a class to make it immutable and enforce keyword-only arguments.
from immutable import immutable
@immutable
class MyClass:
# Fields here
Inherit from Immutable
for similar functionality.
from immutable import Immutable
class MyClass(Immutable):
# Fields here
Contributions are welcome. Please submit pull requests or issues on the GitHub repository.
Ensure compatibility with Python 3.9 or newer when contributing.
This project is released under the Apache-2.0 License. See the LICENSE file for more details.