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

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file python_immutable-1.2.1.dev125060610348549950.tar.gz.

File metadata

File hashes

Hashes for python_immutable-1.2.1.dev125060610348549950.tar.gz
Algorithm Hash digest
SHA256 215ae057aabf98d00e9c0a677f744304e30e5e39576d0c86bdc38d6b11c7b1e8
MD5 e424117f02c91d9b6ce0c58eb8483726
BLAKE2b-256 b3f58b57b66a68d61a62aa6b90687fc9cfd9aa7f93eb8b6c04d3764ca92855e0

See more details on using hashes here.

Provenance

The following attestation bundles were made for python_immutable-1.2.1.dev125060610348549950.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.1.dev125060610348549950-py3-none-any.whl.

File metadata

File hashes

Hashes for python_immutable-1.2.1.dev125060610348549950-py3-none-any.whl
Algorithm Hash digest
SHA256 127f0986b48cb338ba1db876b904f2387a7776229fcd7f14a36d05acfeb864d8
MD5 01bec7a5fd75a55faba68dbb87d4c4c2
BLAKE2b-256 e12628bc9ab6a99c96701e051cc368c9efa0a468fd596c1907c413d968b6e9fa

See more details on using hashes here.

Provenance

The following attestation bundles were made for python_immutable-1.2.1.dev125060610348549950-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 Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page