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.dev225060610357995351.tar.gz.

File metadata

File hashes

Hashes for python_immutable-1.2.1.dev225060610357995351.tar.gz
Algorithm Hash digest
SHA256 157fe9189b6fe703614f30581283702bee8a92c3a9c657409df90ee3b4e1ada8
MD5 abccf61fa40c36b23918d4c84de251c8
BLAKE2b-256 cd338969e75398b9aaa504661ad12ee6afe130db51167b0955e9f7c5d8173a23

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for python_immutable-1.2.1.dev225060610357995351-py3-none-any.whl
Algorithm Hash digest
SHA256 638b386ee31eb240a882e098124f736fd4038389e67fcb7ec1cdc17ef9708ca4
MD5 421f51f6b4b7b40d6092e04ec851ae87
BLAKE2b-256 36be76c4e2a3872d8bb837eef2716b0f4da0935b0b996734e2ec383dacc63eb6

See more details on using hashes here.

Provenance

The following attestation bundles were made for python_immutable-1.2.1.dev225060610357995351-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