Skip to main content

Backports python3.10 typing features into python 3.7 and newer.

Project description

sigparse

Backports python3.10 typing features into python 3.7, 3.8, and 3.9.

Example

import sigparse

def func(param_a: list[str], param_b: str | int, param_c: tuple[int | None]):
    ...

# This returns the same result in python 3.7, 3.8, 3.9, and 3.10!
sigparse.sigparse(func)

Sigparse also supports classes.

import sigparse

class MyClass:
    a: list[str]
    b: str | int
    c: tuple[int | None]

sigparse.classparse(MyClass)

PEP604

By default PEP 604 (| for unions) is only enabled for sigparse.sigparse. To enable globally:

import sigparse
sigparse.global_PEP604()

Notes

Inspect

This module uses inspect behind the scenes. For that reason:

  • sigparse.Parameter.default is inspect._empty when there is no default value.
  • sigparse.Parameter.kind is inspect._ParameterKind.

Annotated

typing.Annotated will always be evaluated with include_extras=True in python3.9.

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

sigparse-1.4.0.tar.gz (4.1 kB view details)

Uploaded Source

Built Distribution

sigparse-1.4.0-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

Details for the file sigparse-1.4.0.tar.gz.

File metadata

  • Download URL: sigparse-1.4.0.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.1 CPython/3.8.14 Linux/5.15.0-1020-azure

File hashes

Hashes for sigparse-1.4.0.tar.gz
Algorithm Hash digest
SHA256 688644288056e94edb7aadfed3fee10ec2088b88c6203fc10457d91b030b01c8
MD5 67e62b907937d5e336ef431092c6da68
BLAKE2b-256 25ce21e28816118a29388b31f52b676dda5721cbe6a9f03e82bbba426ef91ff9

See more details on using hashes here.

File details

Details for the file sigparse-1.4.0-py3-none-any.whl.

File metadata

  • Download URL: sigparse-1.4.0-py3-none-any.whl
  • Upload date:
  • Size: 8.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.1 CPython/3.8.14 Linux/5.15.0-1020-azure

File hashes

Hashes for sigparse-1.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 68c1976db6832f70f6b24e18bc2da6c7ae44e69c34981b82e1393b020765b98b
MD5 ae7a653a370ccfa786fc4f843d1017e8
BLAKE2b-256 a82b3a132ec0a15a22994af01a4c3d29572e46a12426f9410d275249e47a0286

See more details on using hashes here.

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