Skip to main content

Data-Modeling for User Interfaces

Project description

https://img.shields.io/pypi/dm/uiclasses https://img.shields.io/codecov/c/github/NewStore-oss/uiclasses https://img.shields.io/github/workflow/status/NewStore-oss/uiclasses/python-3.6?label=python%203.6 https://img.shields.io/github/workflow/status/NewStore-oss/uiclasses/python-3.7?label=python%203.7 https://img.shields.io/readthedocs/uiclasses https://img.shields.io/github/license/NewStore-oss/uiclasses?label=Github%20License https://img.shields.io/pypi/v/uiclasses https://img.shields.io/pypi/l/uiclasses?label=PyPi%20License https://img.shields.io/pypi/format/uiclasses https://img.shields.io/pypi/status/uiclasses https://img.shields.io/pypi/pyversions/uiclasses https://img.shields.io/pypi/implementation/uiclasses https://img.shields.io/snyk/vulnerabilities/github/NewStore-oss/uiclasses https://img.shields.io/github/v/tag/NewStore-oss/uiclasses
  • 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())
https://github.com/NewStore-oss/uiclasses/raw/master/docs/source/_static/screenshot-blog-list-pretty-table.png
print(published.format_robust_table())
https://github.com/NewStore-oss/uiclasses/raw/master/docs/source/_static/screenshot-blog-list-robust-table.png

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.

Files for uiclasses, version 2.1.0
Filename, size File type Python version Upload date Hashes
Filename, size uiclasses-2.1.0.tar.gz (15.8 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page