extended python types for the web and json
Project description
A extended trait and type system for python using jsonschema
.
wtypes
is an extended type and trait system for python.
pip install wtypes
from wtypes import *
wtypes
provide:
-
Extended type system python validation that feature a
jsonschema
and symbollic type composition.Integer, Float, Dict, List, Email, Uri, Color, Datetime, Regex
-
Configurable
dataclasses
.class Thing(DataClass): name: String location: Uri|Jsonpointer class Thing(DataClass): name: String location: Uri|Jsonpointer Thing(name='wtypes', location='https://github.com/deathbeds/wtypes')
-
Typed evented objects.
class Thing(evented.DataClass): name: String location: Uri|Jsonpointer Thing(name='wtypes', location='https://github.com/deathbeds/wtypes')
-
Generate examples of types with
hypothesis_jsonschema
andgenson
Uri.example(), Datetime.example(), Dict[{'a': Email}].example()
-
Mixed python and
jsonschema
typest = Instance[range] | Integer t(10), t(range(10))
-
future work will expand on semantic RDF type information.
Background
wtypes
is inspired by traitlets
- the core trait library used by IPython
and jupyter
- and
pydantic
- a jsonschema
type system for python. Both pydantic and traitlets
build type systems that can be validated. pydantic
lacks interactive validate, a feature of traitlets
. traitlets
also provides an observable pattern for evented objects. Both pydantic and traitlets
types are represented as python object
s. wtypes
includes features from these libraries in a composable type
system.
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 wtypes-0.0.2-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2ced8b42a9e916a92ab551d8adbebbdf7c6f08f6270c85eaea5a4433ca473e15 |
|
MD5 | e559d01ba4bb980a323df5afbdbc55f4 |
|
BLAKE2b-256 | 8841cd720db5882fe94282726ef4ba1cdd90862255b92690535b8874b99f890a |