Product
Introducing License Enforcement in Socket
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
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.
FAQs
Pythonic type metadata; declarative JSON and YAML transcoding.
We found that pytyp demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Product
We're launching a new set of license analysis and compliance features for analyzing, managing, and complying with licenses across a range of supported languages and ecosystems.
Product
We're excited to introduce Socket Optimize, a powerful CLI command to secure open source dependencies with tested, optimized package overrides.