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)
PEP 604
By default PEP 604 (| for unions) is only enabled for sigparse.sigparse and sigparse.classparse.
The code for PEP 604 was written by @Endercheif.
To enable globally:
import sigparse
sigparse.global_PEP604()
Notes
Inspect
This module uses inspect behind the scenes. For that reason:
- All annotations are
inspect._emptywhen there is no annotation. sigparse.Parameter.defaultisinspect._emptywhen there is no default value.sigparse.Parameter.kindisinspect._ParameterKind.sigparse.ClassVar.defaultisinspect._emptywhen there is no default value to maintain consistency.
Annotated
typing.Annotated will always be evaluated with include_extras=True in python3.9.
Metadata
Release files for sigparse 3.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| sigparse-3.0.0.tar.gz | 5.1 kB | Without provenance | Details for sigparse-3.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sigparse-3.0.0-py3-none-any.whl | Python 3 | none | any | Details for sigparse-3.0.0-py3-none-any.whl |
Total release size: 14.5 kB
Release files / sigparse-3.0.0.tar.gz
| Download URL | sigparse-3.0.0.tar.gz |
|---|---|
| Size | 5.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
608d14fd5ead44d84482f2a1139803a0416157a0bac2fffa12382caac9566680
|
|
BLAKE2b-256 checksum How to use checksums |
1d6633bb71611ce82c5464ec4d741ac5ac8416a2b96e87f88934e06db2525fb4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.3.2 CPython/3.8.16 Linux/5.15.0-1031-azure
|
Release files / sigparse-3.0.0-py3-none-any.whl
| Download URL | sigparse-3.0.0-py3-none-any.whl |
|---|---|
| Size | 9.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
51926c7914e5386d43d9503036c93e698e5a32cb88fc8336d89187739f04ddee
|
|
BLAKE2b-256 checksum How to use checksums |
c16b96a46ebb118f19bb5f94e2e5553a3552ed97bd8501f592ff005ce0f3185d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.3.2 CPython/3.8.16 Linux/5.15.0-1031-azure
|
Security for sigparse 3.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.