Skip to content

Commit 563b0f4

Browse files
author
Sylvain MARIE
committed
0.8.0 changelog + updated api doc
1 parent 3747967 commit 563b0f4

3 files changed

Lines changed: 8 additions & 1 deletion

File tree

docs/api_reference.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ Type hints for fields can be provided using the standard python typing mechanism
3535

3636
By default `check_type` is `False`. This means that the abovementioned `type_hint` is just a hint. If you set `check_type=True` the type declared in the type hint will be validated, and a `TypeError` will be raised if provided values are invalid. Important: if you are running python < 3.6 you have to set the type hint explicitly using `type_hint` if you wish to set `check_type=True`, otherwise you will get an exception. Indeed type comments can not be collected by the code.
3737

38+
Now type hints relying on the `typing` module (PEP484) are correctly checked using whatever 3d party type checking library is available (`typeguard` is first looked for, then `pytypes` as a fallback). If none of these providers are available, a fallback implementation is provided, basically flattening `Union`s and replacing `TypeVar`s before doing `is_instance`. It is not guaranteed to support all `typing` subtelties.
39+
3840
**Documentation**
3941

4042
A docstring can be provided in `doc`for code readability.

docs/changelog.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
**PEP484 type hints support**
66

7-
- Now type hints relying on PEP484 are correctly checked using whatever is available (`typeguard`, `pytypes`). If nothing is available a fallback implementation is provided, basically flattening `Union`s and replacing `TypeVar`s before doing `is_instance`. Fixes [#7](https://github.com/smarie/python-pyfields/issues/7)
7+
- Now type hints relying on the `typing` module (PEP484) are correctly checked using whatever 3d party type checking library is available (`typeguard` is first looked for, then `pytypes` as a fallback). If none of these providers are available, a fallback implementation is provided, basically flattening `Union`s and replacing `TypeVar`s before doing `is_instance`. It is not guaranteed to support all `typing` subtelties. Fixes [#7](https://github.com/smarie/python-pyfields/issues/7)
88

99

1010
### 0.7.0 - more ways to define validators

pyfields/core.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,11 @@ def field(type_hint=None, # type: Type[T]
424424
using `type_hint` if you wish to set `check_type=True`, otherwise you will get an exception. Indeed type comments
425425
can not be collected by the code.
426426
427+
Type hints relying on the `typing` module (PEP484) are correctly checked using whatever 3d party type checking
428+
library is available (`typeguard` is first looked for, then `pytypes` as a fallback). If none of these providers
429+
are available, a fallback implementation is provided, basically flattening `Union`s and replacing `TypeVar`s before
430+
doing `is_instance`. It is not guaranteed to support all `typing` subtelties.
431+
427432
Documentation
428433
-------------
429434
A docstring can be provided for code readability.

0 commit comments

Comments
 (0)