Immutable implementation for Python using dataclasses
Project description
README.md for Immutable Library
Overview
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.
📋 Requirements
- Python 3.9 or later.
- No external dependencies are required.
📦 Installation
Pip
pip install python-immutable
Poetry
poetry add python-immutable
🛠 Usage
Using immutable
Decorator
Apply immutable
to a class to make it immutable and enforce keyword-only arguments.
from immutable import immutable
@immutable
class MyClass:
# Fields here
Extending Immutable
Base Class
Inherit from Immutable
for similar functionality.
from immutable import Immutable
class MyClass(Immutable):
# Fields here
🤝 Contributing
Contributions are welcome. Please submit pull requests or issues on the GitHub repository.
⚠️ Important Note
Ensure compatibility with Python 3.9 or newer when contributing.
🔒 License
This project is released under the Apache-2.0 License. See the LICENSE file for more details.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file python_immutable-1.1.1.tar.gz
.
File metadata
- Download URL: python_immutable-1.1.1.tar.gz
- Upload date:
- Size: 6.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c7aa209f69c02793b8cdb8b645d186beb159ba37f3a30ffdbc66474d06db96a0 |
|
MD5 | ce6f1d7f5c083611f35da27ea066b102 |
|
BLAKE2b-256 | f1ccee90e8e3d3be888f22ed9fa425c5a69cd6387bea7013a3466b069cabd7f1 |
File details
Details for the file python_immutable-1.1.1-py3-none-any.whl
.
File metadata
- Download URL: python_immutable-1.1.1-py3-none-any.whl
- Upload date:
- Size: 7.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 56feffc7c628c404b6a49c08e35b53690aa36ec6284ff105233a1b34c4a04048 |
|
MD5 | a98770a392f4fb2ebf6e027f32515f22 |
|
BLAKE2b-256 | ad29c66c6ac9c7acdeb493c895ed5b8094c8f94e2b335a7f8e5390ea0f22e315 |