You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Add Annotated support and therefore set minimum python version as 3.9
* Add support back for Python3.8
* Fix Python 3.8 and add tox config for cross version testing
* Fix style issues. Rebase did not trigger pre-commit.
* Remove enum from pre-commit
* re-add but deprecate the newtype documentation
* Move Annotated and Union handling to their own functions
* Remove tox from requirements
* Add coverage report and remove virtualenv-pyenv
* Add warning when multiple Field annotations have bene detected
* Remove tox and document Annotated for python 3.8
* fix: line-endings
Copy file name to clipboardExpand all lines: README.md
+41-7Lines changed: 41 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -242,7 +242,47 @@ class Sample:
242
242
243
243
See [marshmallow's documentation about extending `Schema`](https://marshmallow.readthedocs.io/en/stable/extending.html).
244
244
245
-
### Custom NewType declarations
245
+
### Custom type aliases
246
+
247
+
This library allows you to specify [customized marshmallow fields](https://marshmallow.readthedocs.io/en/stable/custom_fields.html#creating-a-field-class) using python's Annoted type [PEP-593](https://peps.python.org/pep-0593/).
from marshmallow_dataclass.typing import Email, Url
271
+
```
272
+
273
+
When using Python 3.8, you must import `Annotated` from the typing_extensions package
274
+
275
+
```python
276
+
# Version agnostic import code:
277
+
if sys.version_info >= (3, 9):
278
+
from typing import Annotated
279
+
else:
280
+
from typing_extensions import Annotated
281
+
```
282
+
283
+
### Custom NewType declarations [__deprecated__]
284
+
285
+
> NewType is deprecated in favor or type aliases using Annotated, as described above.
246
286
247
287
This library exports a `NewType` function to create types that generate [customized marshmallow fields](https://marshmallow.readthedocs.io/en/stable/custom_fields.html#creating-a-field-class).
248
288
@@ -266,12 +306,6 @@ from marshmallow_dataclass import NewType
0 commit comments