Skip to main content

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 and genson

      Uri.example(), Datetime.example(), Dict[{'a': Email}].example()
    
  • Mixed python and jsonschema types

      t = 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 objects. wtypes includes features from these libraries in a composable type system.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wtypes-0.0.2.tar.gz (19.5 kB view hashes)

Uploaded Source

Built Distribution

wtypes-0.0.2-py2.py3-none-any.whl (23.3 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page