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

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.1.2.dev125051810399485410.tar.gz.

File metadata

File hashes

Hashes for python_immutable-1.1.2.dev125051810399485410.tar.gz
Algorithm Hash digest
SHA256 51c69af3929a5468fb8c6a23140339540732e06924989d56835d70539c90c0c4
MD5 3290719d823370c22811fa31fad01e6c
BLAKE2b-256 9e256a5357bc091861b79b75f1a2d88e831c694703e2e7fc0a1a242978046cf1

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for python_immutable-1.1.2.dev125051810399485410-py3-none-any.whl
Algorithm Hash digest
SHA256 77a8db0d31213d2d37d3d367e649a39ed43486f13b4d180d0ef637db22c05194
MD5 13d2dc2cf5678392c56cc2d98e734def
BLAKE2b-256 5816ec9405b2595f6750ddd18962c05c10b1a28bd978a7564409a93d65ffe969

See more details on using hashes here.

Provenance

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