Auto type cast dataclasses to suggested types.
Project description
strictdataclass
Sections:
Purpose
This package contains the necessary base class structure for strict, auto-casting dataclasses for use in an inheritence architecture. The inheritable base class has custom double-underscore (dunder), convenience, and property methods.
Contents
This package contains two modules written in pure Python (3.7 or newer) with the following code blocks accessible from the root module:
StrictDataclass
: Inheritable base class for automatic type casting on instantiationObjectTypeNotCastableError
: Error raised when type casting fails
Installation
This package is distributed to PyPi, and can be installed with either of the following commands:
pip install strictdataclass
pip3 install strictdataclass
Usage
Inherit the base class StrictDataclass
in a dataclass-decorated
class definition to inherit the type casting properties.
Declaration
@dataclass
class Foo(StrictDataclass):
bar: bool
foo: int = 5
Issues/Limitations
Although there are currently no known cast failing cases or performance issues, this package is in its infancy and has been marked as:
Beta
Author
Braden Toone is the sole author and maintainer of this code, and can be contacted via email at braden@toonetown.com
License
This package is licensed under the OSI Approved MIT License for free commercial and personal use as stated in the LICENSE file.
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
Hashes for strictdataclass-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | adda4e328ba9c42487993b94e79f31f04d5d674cb3ca1fa7b7d19de31a994b41 |
|
MD5 | 0502010682b3ba87e2c075d56783e207 |
|
BLAKE2b-256 | 790ff66a13f050ddc233322a3ef28b1a844a9f9dd52e69f2c46c0b914b3e37de |