typedparser 0.12.4__tar.gz → 0.13.1__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.12.4
3
+ Version: 0.13.1
4
4
  Summary: Extension for python argparse with typehints and typechecks.
5
5
  Author: simon-ging
6
6
  License: Apache-2.0
@@ -23,7 +23,10 @@ Requires-Python: >=3.7
23
23
  Description-Content-Type: text/markdown
24
24
  License-File: LICENSE
25
25
  Requires-Dist: attrs
26
- Requires-Dist: numpy
26
+ Requires-Dist: importlib_metadata; python_version < "3.8"
27
+ Requires-Dist: typing_extensions; python_version < "3.8"
28
+ Provides-Extra: full
29
+ Requires-Dist: numpy; extra == "full"
27
30
 
28
31
  # typedparser
29
32
 
@@ -26,6 +26,9 @@ classifiers = [
26
26
  ]
27
27
  dynamic = ["version", "dependencies"]
28
28
 
29
+ [project.optional-dependencies]
30
+ full = ["numpy"]
31
+
29
32
  [project.urls]
30
33
  Project-URL = "https://github.com/simon-ging/typedparser"
31
34
 
@@ -0,0 +1,4 @@
1
+ attrs
2
+ importlib_metadata;python_version<'3.8'
3
+ typing_extensions;python_version<'3.8'
4
+
@@ -14,4 +14,4 @@ __all__ = [
14
14
  "get_attr_names",
15
15
  ]
16
16
 
17
- __version__ = "0.12.4"
17
+ __version__ = "0.13.1"
@@ -4,17 +4,20 @@ Generic utilities for python objects
4
4
  from __future__ import annotations
5
5
 
6
6
  from abc import ABCMeta, abstractmethod
7
+ from attr import has, AttrsInstance
8
+ from attrs import fields
7
9
  from collections.abc import Mapping, Iterable
8
10
  from copy import deepcopy
9
11
  from functools import partial
10
12
  from typing import Any, Callable, Type, List
11
13
 
12
- import numpy as np
13
- from attr import has, AttrsInstance
14
- from attrs import fields
15
-
16
14
  AttrsClass = Type[AttrsInstance]
17
15
 
16
+ try:
17
+ import numpy as np
18
+ except ImportError:
19
+ np = None
20
+
18
21
 
19
22
  def get_attr_names(cls: AttrsClass) -> List[str]:
20
23
  """Get all attribute names of an attrs class."""
@@ -270,7 +273,7 @@ def _compare_leaf(
270
273
  d1: Any, d2: Any, _depth: int, rtol=1.0e-5, atol=1.0e-8, equal_nan=False, prefix=""
271
274
  ) -> List[str]:
272
275
  # at this point the 2 leaves are guaranteed to be the same type
273
- if isinstance(d1, np.ndarray):
276
+ if np is not None and isinstance(d1, np.ndarray):
274
277
  comp = np.allclose(d1, d2, rtol=rtol, atol=atol, equal_nan=equal_nan)
275
278
  else:
276
279
  comp = d1 == d2
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: typedparser
3
- Version: 0.12.4
3
+ Version: 0.13.1
4
4
  Summary: Extension for python argparse with typehints and typechecks.
5
5
  Author: simon-ging
6
6
  License: Apache-2.0
@@ -23,7 +23,10 @@ Requires-Python: >=3.7
23
23
  Description-Content-Type: text/markdown
24
24
  License-File: LICENSE
25
25
  Requires-Dist: attrs
26
- Requires-Dist: numpy
26
+ Requires-Dist: importlib_metadata; python_version < "3.8"
27
+ Requires-Dist: typing_extensions; python_version < "3.8"
28
+ Provides-Extra: full
29
+ Requires-Dist: numpy; extra == "full"
27
30
 
28
31
  # typedparser
29
32
 
@@ -0,0 +1,8 @@
1
+ attrs
2
+
3
+ [:python_version < "3.8"]
4
+ importlib_metadata
5
+ typing_extensions
6
+
7
+ [full]
8
+ numpy
@@ -1,2 +0,0 @@
1
- attrs
2
- numpy
@@ -1,2 +0,0 @@
1
- attrs
2
- numpy
File without changes
File without changes
File without changes