Immutable implementation for Python using dataclasses
Project description
Immutable
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
uv
uv add 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
Release history Release notifications | RSS feed
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.2.2.tar.gz
.
File metadata
- Download URL: python_immutable-1.2.2.tar.gz
- Upload date:
- Size: 7.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
52e701a4c2feb3b9013bcb412a731236fd6e402279de01b4df43ec6cba01815a
|
|
MD5 |
df1216b3e872f358a276ba1150ab441d
|
|
BLAKE2b-256 |
1ebc2964193443e82cf0579ecf50e5dcc014d777b60347ffafebc1f958d834a1
|
Provenance
The following attestation bundles were made for python_immutable-1.2.2.tar.gz
:
Publisher:
integration_delivery.yml
on sassanh/python-immutable
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1
-
Predicate type:
https://docs.pypi.org/attestations/publish/v1
-
Subject name:
python_immutable-1.2.2.tar.gz
-
Subject digest:
52e701a4c2feb3b9013bcb412a731236fd6e402279de01b4df43ec6cba01815a
- Sigstore transparency entry: 231063364
- Sigstore integration time:
-
Permalink:
sassanh/python-immutable@e980b7ffae654b10f5cfd1d3ea284ba22afc2ab6
-
Branch / Tag:
refs/heads/main
- Owner: https://github.com/sassanh
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com
-
Runner Environment:
github-hosted
-
Publication workflow:
integration_delivery.yml@e980b7ffae654b10f5cfd1d3ea284ba22afc2ab6
-
Trigger Event:
push
-
Statement type:
File details
Details for the file python_immutable-1.2.2-py3-none-any.whl
.
File metadata
- Download URL: python_immutable-1.2.2-py3-none-any.whl
- Upload date:
- Size: 7.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
33236c8082ee103f43ac3a95842742ae406c5faf3cb0c29ed98b2f34d922318c
|
|
MD5 |
ff317b8f5d887bf0f330f2b2545e66e8
|
|
BLAKE2b-256 |
e8c91aaa7d9d8fc4b5a62648b756c3356ff86690e02ee1c20939a9f592e498f5
|
Provenance
The following attestation bundles were made for python_immutable-1.2.2-py3-none-any.whl
:
Publisher:
integration_delivery.yml
on sassanh/python-immutable
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1
-
Predicate type:
https://docs.pypi.org/attestations/publish/v1
-
Subject name:
python_immutable-1.2.2-py3-none-any.whl
-
Subject digest:
33236c8082ee103f43ac3a95842742ae406c5faf3cb0c29ed98b2f34d922318c
- Sigstore transparency entry: 231063369
- Sigstore integration time:
-
Permalink:
sassanh/python-immutable@e980b7ffae654b10f5cfd1d3ea284ba22afc2ab6
-
Branch / Tag:
refs/heads/main
- Owner: https://github.com/sassanh
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com
-
Runner Environment:
github-hosted
-
Publication workflow:
integration_delivery.yml@e980b7ffae654b10f5cfd1d3ea284ba22afc2ab6
-
Trigger Event:
push
-
Statement type: