Skip to main content
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)))
True

* 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
<http://www.acooke.org/pytyp.pdf>`_.

Note that you must also install `PyYAML
<https://pypi.python.org/pypi/PyYAML>`_ if you want to encode/decode YAML.

Warning: This package is unused and largely unmaintained. Python went
in a `different direction<https://www.python.org/dev/peps/pep-0484/>`_
with types.

Metadata

Release files for pytyp 2.2.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distributions (sdists)

Source distribution for pytyp 2.2.4
File Size Uploaded
pytyp-2.2.4.zip 32.1 kB Details
pytyp-2.2.4.tar.gz 21.2 kB Details

Release files / pytyp-2.2.4.zip

Download URL pytyp-2.2.4.zip
Size 32.1 kB
Tags Source
SHA-256 checksum
How to use checksums
0077c7054f4c7617779fa3cc2e754e10f7156b1f22d4bb55944e069548f83e09
BLAKE2b-256 checksum
How to use checksums
c22881f0833433a2cc4125bf5679daa03b4a0010182109e45c0037429ed6fad6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / pytyp-2.2.4.tar.gz

Download URL pytyp-2.2.4.tar.gz
Size 21.2 kB
Tags Source
SHA-256 checksum
How to use checksums
a2e26de07b3335bf8d8dfd4ff6e109ce082e3dcdad84910270c3acfcff12f27d
BLAKE2b-256 checksum
How to use checksums
7b5785f74560d5fbe299bbe6cdec40d311c8fd8245a3b9bf1483be6f36a1f478
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

2.2.4 This release

2 release files

2.2.3

2 release files

2.2.2

2 release files

2.2.1

2 release files

2.2

2 release files

2.0.1

2 release files

2.0

2 release files

1.1

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page