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
File details
Details for the file wtypes-0.0.2.tar.gz
.
File metadata
- Download URL: wtypes-0.0.2.tar.gz
- Upload date:
- Size: 19.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 23fe6d2fb6b5fedfdec9c90a073f910cf651b21c6cbd2294bd76b2b2b9108c13 |
|
MD5 | 21d743f863a9ab9a1f6e78c7d4a71add |
|
BLAKE2b-256 | a09b69993a012ede817d936377ee7556bd50326a5d7116d12a1bc35743351e96 |
File details
Details for the file wtypes-0.0.2-py2.py3-none-any.whl
.
File metadata
- Download URL: wtypes-0.0.2-py2.py3-none-any.whl
- Upload date:
- Size: 23.3 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2ced8b42a9e916a92ab551d8adbebbdf7c6f08f6270c85eaea5a4433ca473e15 |
|
MD5 | e559d01ba4bb980a323df5afbdbc55f4 |
|
BLAKE2b-256 | 8841cd720db5882fe94282726ef4ba1cdd90862255b92690535b8874b99f890a |