Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

python_immutable-1.2.2.tar.gz (7.7 kB view details)

Uploaded Source

Built Distribution

python_immutable-1.2.2-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

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

Hashes for python_immutable-1.2.2.tar.gz
Algorithm Hash digest
SHA256 52e701a4c2feb3b9013bcb412a731236fd6e402279de01b4df43ec6cba01815a
MD5 df1216b3e872f358a276ba1150ab441d
BLAKE2b-256 1ebc2964193443e82cf0579ecf50e5dcc014d777b60347ffafebc1f958d834a1

See more details on using hashes here.

Provenance

The following attestation bundles were made for python_immutable-1.2.2.tar.gz:

Publisher: integration_delivery.yml on sassanh/python-immutable

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file python_immutable-1.2.2-py3-none-any.whl.

File metadata

File hashes

Hashes for python_immutable-1.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 33236c8082ee103f43ac3a95842742ae406c5faf3cb0c29ed98b2f34d922318c
MD5 ff317b8f5d887bf0f330f2b2545e66e8
BLAKE2b-256 e8c91aaa7d9d8fc4b5a62648b756c3356ff86690e02ee1c20939a9f592e498f5

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page