sigparse


Namesigparse JSON
Version 3.0.0 PyPI version JSON
download
home_pagehttps://github.com/Lunarmagpie/sigparse
SummaryBackports python3.10 typing features into python 3.7 and newer.
upload_time2023-01-30 20:08:51
maintainer
docs_urlNone
authorLunarmagpie
requires_python>=3.7
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # sigparse

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

## Example

```python
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.

```python
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](https://github.com/Endercheif).

To enable globally:
```python
import sigparse
sigparse.global_PEP604()
```

## Notes
### Inspect

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

- All annotations are `inspect._empty` when there is no annotation.
- `sigparse.Parameter.default` is `inspect._empty` when there is no default value.
- `sigparse.Parameter.kind` is `inspect._ParameterKind`.
- `sigparse.ClassVar.default` is `inspect._empty` when there is no default value to maintain consistency.


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

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/Lunarmagpie/sigparse",
    "name": "sigparse",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "",
    "author": "Lunarmagpie",
    "author_email": "bambolambo0@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/1d/66/33bb71611ce82c5464ec4d741ac5ac8416a2b96e87f88934e06db2525fb4/sigparse-3.0.0.tar.gz",
    "platform": null,
    "description": "# sigparse\n\nBackports python3.10 typing features into python 3.7, 3.8, and 3.9.\n\n## Example\n\n```python\nimport sigparse\n\ndef func(param_a: list[str], param_b: str | int, param_c: tuple[int | None]):\n    ...\n\n# This returns the same result in python 3.7, 3.8, 3.9, and 3.10!\nsigparse.sigparse(func)\n```\n\nSigparse also supports classes.\n\n```python\nimport sigparse\n\nclass MyClass:\n    a: list[str]\n    b: str | int\n    c: tuple[int | None]\n\nsigparse.classparse(MyClass)\n```\n\n\n### PEP 604\nBy default PEP 604 (| for unions) is only enabled for `sigparse.sigparse` and `sigparse.classparse`.\nThe code for PEP 604 was written by [@Endercheif](https://github.com/Endercheif).\n\nTo enable globally:\n```python\nimport sigparse\nsigparse.global_PEP604()\n```\n\n## Notes\n### Inspect\n\nThis module uses inspect behind the scenes. For that reason:\n\n- All annotations are `inspect._empty` when there is no annotation.\n- `sigparse.Parameter.default` is `inspect._empty` when there is no default value.\n- `sigparse.Parameter.kind` is `inspect._ParameterKind`.\n- `sigparse.ClassVar.default` is `inspect._empty` when there is no default value to maintain consistency.\n\n\n### Annotated\n`typing.Annotated` will always be evaluated with `include_extras=True` in python3.9.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Backports python3.10 typing features into python 3.7 and newer.",
    "version": "3.0.0",
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c16b96a46ebb118f19bb5f94e2e5553a3552ed97bd8501f592ff005ce0f3185d",
                "md5": "1cf676c5ddacce6a031e8be13df9026b",
                "sha256": "51926c7914e5386d43d9503036c93e698e5a32cb88fc8336d89187739f04ddee"
            },
            "downloads": -1,
            "filename": "sigparse-3.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "1cf676c5ddacce6a031e8be13df9026b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 9460,
            "upload_time": "2023-01-30T20:08:49",
            "upload_time_iso_8601": "2023-01-30T20:08:49.403944Z",
            "url": "https://files.pythonhosted.org/packages/c1/6b/96a46ebb118f19bb5f94e2e5553a3552ed97bd8501f592ff005ce0f3185d/sigparse-3.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1d6633bb71611ce82c5464ec4d741ac5ac8416a2b96e87f88934e06db2525fb4",
                "md5": "19c4c62c96e7a981dcc33eec49ae4330",
                "sha256": "608d14fd5ead44d84482f2a1139803a0416157a0bac2fffa12382caac9566680"
            },
            "downloads": -1,
            "filename": "sigparse-3.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "19c4c62c96e7a981dcc33eec49ae4330",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 5053,
            "upload_time": "2023-01-30T20:08:51",
            "upload_time_iso_8601": "2023-01-30T20:08:51.111296Z",
            "url": "https://files.pythonhosted.org/packages/1d/66/33bb71611ce82c5464ec4d741ac5ac8416a2b96e87f88934e06db2525fb4/sigparse-3.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-01-30 20:08:51",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "Lunarmagpie",
    "github_project": "sigparse",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "sigparse"
}
        
Elapsed time: 0.20121s