Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

Pythonic type metadata; declarative JSON and YAML transcoding.

Project Description

Pytyp uses ABCs and function annotations in a consistent, pythonic way that
supports declarative APIs - instead of saying how to do something, you have
the ability to say what you want.

It includes:

* A basic set of type specifications for describing collections of data,
closely integrated into the language::

>>> isinstance([1,2,None,4], Seq(Opt(int)))

* A decorator that type-checks functions::

>>> def str_only(x:str): return 'foo'
>>> str_only(42)
Exception raised:
TypeError: Type str inconsistent with 42.

* A decorator that allows dynamic dispatch by type. You can combine multiple
methods under one name, and then select which method is called by the type
of an argument (normal OO programming uses the type of ``self`` to select
the method; this is more like Lisp's multimethods).

* Routines for converting between Python classes and JSON or YAML. Instead of
having to work with ``dict`` and ``list`` you can read JSON directly into
Python classes. This is included as an example of the declarative API
possible - you describe the form of the output using type specifications.

The ideas behind the library are described in more detail in `Algebraic ABCs

Note that you must also install `PyYAML
<>`_ if you want to encode/decode YAML.

Warning: This package is unused and largely unmaintained. Python went
in a `different direction<>`_
with types.

Release History

This version
History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


Download Files

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

Filename, Size & Hash SHA256 Hash Help File Type Python Version Upload Date
(21.2 kB) Copy SHA256 Hash SHA256
Source None Apr 29, 2016
(32.1 kB) Copy SHA256 Hash SHA256
Source None Apr 29, 2016

Supported By

Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Google Google Cloud Servers DreamHost DreamHost Log Hosting