Skip to main content

Parse type strings into typing instances

Project description

PyPI Python Version License

Tests Codecov

pre-commit Black

Installation

You can install typestring-parser via pip from PyPI:

$ pip install typestring-parser

Usage

Use the parse function to convert type strings into typing instances:

>>> from typestring_parser import parse
>>>
>>> parse('int')
<class 'int'>
>>> parse('int or str')
typing.Union[int, str]
>>> parse('list of str or str')
typing.Union[typing.List[str], str]
>>> parse('list of (int, str)')
typing.List[typing.Tuple[int, str]]

Project details


Release history Release notifications | RSS feed

This version

0.1

Download files

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

Source Distribution

typestring-parser-0.1.tar.gz (4.2 kB view hashes)

Uploaded Source

Built Distribution

typestring_parser-0.1-py3-none-any.whl (4.2 kB view hashes)

Uploaded 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