typedparser 0.11.4__tar.gz → 0.11.6__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: typedparser
3
- Version: 0.11.4
3
+ Version: 0.11.6
4
4
  Summary: Extension for python argparse with typehints and typechecks.
5
5
  Author: simon-ging
6
6
  License: Apache-2.0
@@ -29,13 +29,22 @@ Requires-Dist: numpy
29
29
 
30
30
  <p align="center">
31
31
  <a href="https://github.com/simon-ging/typedparser/actions/workflows/build-py37.yml">
32
- <img alt="build 3.7 status" title="build 3.7 status" src="https://img.shields.io/github/actions/workflow/status/simon-ging/typedparser/build-py37.yml?branch=main&label=build%203.7" />
32
+ <img alt="build 3.7 status" title="build 3.7 status" src="https://img.shields.io/github/actions/workflow/status/simon-ging/typedparser/build-py37.yml?branch=main&label=python%203.7" />
33
+ </a>
34
+ <a href="https://github.com/simon-ging/typedparser/actions/workflows/build-py38.yml">
35
+ <img alt="build 3.8 status" title="build 3.8 status" src="https://img.shields.io/github/actions/workflow/status/simon-ging/typedparser/build-py38.yml?branch=main&label=python%203.8" />
36
+ </a>
37
+ <a href="https://github.com/simon-ging/typedparser/actions/workflows/build-py39.yml">
38
+ <img alt="build 3.9 status" title="build 3.9 status" src="https://img.shields.io/github/actions/workflow/status/simon-ging/typedparser/build-py39.yml?branch=main&label=python%203.9" />
33
39
  </a>
34
40
  <a href="https://github.com/simon-ging/typedparser/actions/workflows/build-py310.yml">
35
- <img alt="build 3.10 status" title="build 3.10 status" src="https://img.shields.io/github/actions/workflow/status/simon-ging/typedparser/build-py310.yml?branch=main&label=build%203.10" />
41
+ <img alt="build 3.10 status" title="build 3.10 status" src="https://img.shields.io/github/actions/workflow/status/simon-ging/typedparser/build-py310.yml?branch=main&label=python%203.10" />
42
+ </a>
43
+ <a href="https://github.com/simon-ging/typedparser/actions/workflows/build-py311.yml">
44
+ <img alt="build 3.11 status" title="build 3.11 status" src="https://img.shields.io/github/actions/workflow/status/simon-ging/typedparser/build-py311.yml?branch=main&label=python%203.11" />
36
45
  </a>
37
46
  <a href="https://github.com/simon-ging/typedparser/actions/workflows/build-py312.yml">
38
- <img alt="build 3.12 status" title="build 3.12 status" src="https://img.shields.io/github/actions/workflow/status/simon-ging/typedparser/build-py312.yml?branch=main&label=build%203.12" />
47
+ <img alt="build 3.12 status" title="build 3.12 status" src="https://img.shields.io/github/actions/workflow/status/simon-ging/typedparser/build-py312.yml?branch=main&label=python%203.12" />
39
48
  </a>
40
49
  <img alt="coverage" title="coverage" src="https://raw.githubusercontent.com/simon-ging/typedparser/main/docs/coverage.svg" />
41
50
  <a href="https://pypi.org/project/typedparser/">
@@ -2,13 +2,22 @@
2
2
 
3
3
  <p align="center">
4
4
  <a href="https://github.com/simon-ging/typedparser/actions/workflows/build-py37.yml">
5
- <img alt="build 3.7 status" title="build 3.7 status" src="https://img.shields.io/github/actions/workflow/status/simon-ging/typedparser/build-py37.yml?branch=main&label=build%203.7" />
5
+ <img alt="build 3.7 status" title="build 3.7 status" src="https://img.shields.io/github/actions/workflow/status/simon-ging/typedparser/build-py37.yml?branch=main&label=python%203.7" />
6
+ </a>
7
+ <a href="https://github.com/simon-ging/typedparser/actions/workflows/build-py38.yml">
8
+ <img alt="build 3.8 status" title="build 3.8 status" src="https://img.shields.io/github/actions/workflow/status/simon-ging/typedparser/build-py38.yml?branch=main&label=python%203.8" />
9
+ </a>
10
+ <a href="https://github.com/simon-ging/typedparser/actions/workflows/build-py39.yml">
11
+ <img alt="build 3.9 status" title="build 3.9 status" src="https://img.shields.io/github/actions/workflow/status/simon-ging/typedparser/build-py39.yml?branch=main&label=python%203.9" />
6
12
  </a>
7
13
  <a href="https://github.com/simon-ging/typedparser/actions/workflows/build-py310.yml">
8
- <img alt="build 3.10 status" title="build 3.10 status" src="https://img.shields.io/github/actions/workflow/status/simon-ging/typedparser/build-py310.yml?branch=main&label=build%203.10" />
14
+ <img alt="build 3.10 status" title="build 3.10 status" src="https://img.shields.io/github/actions/workflow/status/simon-ging/typedparser/build-py310.yml?branch=main&label=python%203.10" />
15
+ </a>
16
+ <a href="https://github.com/simon-ging/typedparser/actions/workflows/build-py311.yml">
17
+ <img alt="build 3.11 status" title="build 3.11 status" src="https://img.shields.io/github/actions/workflow/status/simon-ging/typedparser/build-py311.yml?branch=main&label=python%203.11" />
9
18
  </a>
10
19
  <a href="https://github.com/simon-ging/typedparser/actions/workflows/build-py312.yml">
11
- <img alt="build 3.12 status" title="build 3.12 status" src="https://img.shields.io/github/actions/workflow/status/simon-ging/typedparser/build-py312.yml?branch=main&label=build%203.12" />
20
+ <img alt="build 3.12 status" title="build 3.12 status" src="https://img.shields.io/github/actions/workflow/status/simon-ging/typedparser/build-py312.yml?branch=main&label=python%203.12" />
12
21
  </a>
13
22
  <img alt="coverage" title="coverage" src="https://raw.githubusercontent.com/simon-ging/typedparser/main/docs/coverage.svg" />
14
23
  <a href="https://pypi.org/project/typedparser/">
@@ -28,5 +28,5 @@ def define(*args, **kwargs):
28
28
  )
29
29
 
30
30
 
31
- __version__ = "0.11.4"
31
+ __version__ = "0.11.6"
32
32
 
@@ -1,3 +1,5 @@
1
+ from __future__ import annotations
2
+
1
3
  import collections
2
4
  from functools import partial
3
5
  from inspect import isclass
@@ -34,6 +36,7 @@ try:
34
36
  from typing import get_origin, get_args
35
37
  except ImportError:
36
38
  # python<3.8
39
+ # note that attrs automatically installs this and importlib-metadata for old python versions
37
40
  from typing_extensions import get_origin, get_args
38
41
 
39
42
  # default conversions allow to convert instead of raising errors in case of matching types
@@ -206,7 +209,17 @@ def _attrs_from_dict(
206
209
  ) from e
207
210
 
208
211
  # typecheck and unfold nested values in the attrs instance
209
- type_hints = get_type_hints(cls)
212
+ try:
213
+ type_hints = get_type_hints(cls)
214
+ except TypeError as e:
215
+ raise TypeError(
216
+ f"Failed getting type hints for {cls} with input '{input_dict}'. Error occurred at: "
217
+ f"{'.'.join(current_position)}. {e}\n\nError context: {more_error_info}."
218
+ "Potential reasons: You used an old python version <=3.8, used from __future__ "
219
+ "import annotations, and annotated something as dict[str, int]. "
220
+ "This does not work together with get_type_hints. Solution: "
221
+ "Annotate with typing.Dict[str, int] instead of dict[str, int], or upgrade python."
222
+ ) from e
210
223
  for att in all_atts:
211
224
  name = att.name
212
225
  value = getattr(attrs_inst, name)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: typedparser
3
- Version: 0.11.4
3
+ Version: 0.11.6
4
4
  Summary: Extension for python argparse with typehints and typechecks.
5
5
  Author: simon-ging
6
6
  License: Apache-2.0
@@ -29,13 +29,22 @@ Requires-Dist: numpy
29
29
 
30
30
  <p align="center">
31
31
  <a href="https://github.com/simon-ging/typedparser/actions/workflows/build-py37.yml">
32
- <img alt="build 3.7 status" title="build 3.7 status" src="https://img.shields.io/github/actions/workflow/status/simon-ging/typedparser/build-py37.yml?branch=main&label=build%203.7" />
32
+ <img alt="build 3.7 status" title="build 3.7 status" src="https://img.shields.io/github/actions/workflow/status/simon-ging/typedparser/build-py37.yml?branch=main&label=python%203.7" />
33
+ </a>
34
+ <a href="https://github.com/simon-ging/typedparser/actions/workflows/build-py38.yml">
35
+ <img alt="build 3.8 status" title="build 3.8 status" src="https://img.shields.io/github/actions/workflow/status/simon-ging/typedparser/build-py38.yml?branch=main&label=python%203.8" />
36
+ </a>
37
+ <a href="https://github.com/simon-ging/typedparser/actions/workflows/build-py39.yml">
38
+ <img alt="build 3.9 status" title="build 3.9 status" src="https://img.shields.io/github/actions/workflow/status/simon-ging/typedparser/build-py39.yml?branch=main&label=python%203.9" />
33
39
  </a>
34
40
  <a href="https://github.com/simon-ging/typedparser/actions/workflows/build-py310.yml">
35
- <img alt="build 3.10 status" title="build 3.10 status" src="https://img.shields.io/github/actions/workflow/status/simon-ging/typedparser/build-py310.yml?branch=main&label=build%203.10" />
41
+ <img alt="build 3.10 status" title="build 3.10 status" src="https://img.shields.io/github/actions/workflow/status/simon-ging/typedparser/build-py310.yml?branch=main&label=python%203.10" />
42
+ </a>
43
+ <a href="https://github.com/simon-ging/typedparser/actions/workflows/build-py311.yml">
44
+ <img alt="build 3.11 status" title="build 3.11 status" src="https://img.shields.io/github/actions/workflow/status/simon-ging/typedparser/build-py311.yml?branch=main&label=python%203.11" />
36
45
  </a>
37
46
  <a href="https://github.com/simon-ging/typedparser/actions/workflows/build-py312.yml">
38
- <img alt="build 3.12 status" title="build 3.12 status" src="https://img.shields.io/github/actions/workflow/status/simon-ging/typedparser/build-py312.yml?branch=main&label=build%203.12" />
47
+ <img alt="build 3.12 status" title="build 3.12 status" src="https://img.shields.io/github/actions/workflow/status/simon-ging/typedparser/build-py312.yml?branch=main&label=python%203.12" />
39
48
  </a>
40
49
  <img alt="coverage" title="coverage" src="https://raw.githubusercontent.com/simon-ging/typedparser/main/docs/coverage.svg" />
41
50
  <a href="https://pypi.org/project/typedparser/">
File without changes
File without changes