Powered by Python 3 Data Classes.
Objects optimized for user interfaces.
Methods to traverse nested dicts, convert to and from json
ModelList and ModelSet collections for robust manipulation of collections of models.
No I/O happens in models.
Collections can be easily cached to leverage responsive user interfaces.
Installation
pip install uiclasses
Basic Usage
from uiclasses import Model
class BlogPost(Model):
id: int
title: str
body: str
post1 = BlogPost({"id": 1, "title": "title 1", "body": "body 1", "wimsical_extra_field": "lala land"})
post2 = BlogPost(id=2, title="title 2", body="body 2", extradata='stored but invisible')
published = BlogPost.List([post1, post2])
print(published.format_pretty_table())
print(published.format_robust_table())
Notes:
This is not designed to be fast, when adding data to models their types might cast and validated, which is costly. - filtering collections by string values cause glob match
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
uiclasses-3.0.0.tar.gz
(17.2 kB
view details)
File details
Details for the file uiclasses-3.0.0.tar.gz.
File metadata
- Download URL: uiclasses-3.0.0.tar.gz
- Upload date:
- Size: 17.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/4.0.2 CPython/3.9.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
78567a63e491c8d18c60310a8e47404a966be6c723c03f48e1b9b48814a8a0d6
|
|
| MD5 |
ed86d4a21dc68fd5354c5eeb835c3a60
|
|
| BLAKE2b-256 |
b793c1400221f33224f8d5081a5a58ad523a5c8688fedba689297eaa9c2bf352
|