marshmallow 3.24.2__tar.gz → 3.25.0__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.
Files changed (76) hide show
  1. {marshmallow-3.24.2 → marshmallow-3.25.0}/CHANGELOG.rst +18 -0
  2. {marshmallow-3.24.2 → marshmallow-3.25.0}/PKG-INFO +1 -1
  3. {marshmallow-3.24.2 → marshmallow-3.25.0}/pyproject.toml +1 -1
  4. marshmallow-3.25.0/src/marshmallow/base.py +61 -0
  5. {marshmallow-3.24.2 → marshmallow-3.25.0}/src/marshmallow/schema.py +6 -6
  6. marshmallow-3.24.2/src/marshmallow/base.py +0 -33
  7. {marshmallow-3.24.2 → marshmallow-3.25.0}/CONTRIBUTING.rst +0 -0
  8. {marshmallow-3.24.2 → marshmallow-3.25.0}/LICENSE +0 -0
  9. {marshmallow-3.24.2 → marshmallow-3.25.0}/NOTICE +0 -0
  10. {marshmallow-3.24.2 → marshmallow-3.25.0}/README.rst +0 -0
  11. {marshmallow-3.24.2 → marshmallow-3.25.0}/SECURITY.md +0 -0
  12. {marshmallow-3.24.2 → marshmallow-3.25.0}/docs/.gitignore +0 -0
  13. {marshmallow-3.24.2 → marshmallow-3.25.0}/docs/_static/marshmallow-logo.png +0 -0
  14. {marshmallow-3.24.2 → marshmallow-3.25.0}/docs/_templates/donate.html +0 -0
  15. {marshmallow-3.24.2 → marshmallow-3.25.0}/docs/_templates/useful-links.html +0 -0
  16. {marshmallow-3.24.2 → marshmallow-3.25.0}/docs/about.rst.inc +0 -0
  17. {marshmallow-3.24.2 → marshmallow-3.25.0}/docs/api_reference.rst +0 -0
  18. {marshmallow-3.24.2 → marshmallow-3.25.0}/docs/authors.rst +0 -0
  19. {marshmallow-3.24.2 → marshmallow-3.25.0}/docs/changelog.rst +0 -0
  20. {marshmallow-3.24.2 → marshmallow-3.25.0}/docs/code_of_conduct.rst +0 -0
  21. {marshmallow-3.24.2 → marshmallow-3.25.0}/docs/conf.py +0 -0
  22. {marshmallow-3.24.2 → marshmallow-3.25.0}/docs/contributing.rst +0 -0
  23. {marshmallow-3.24.2 → marshmallow-3.25.0}/docs/custom_fields.rst +0 -0
  24. {marshmallow-3.24.2 → marshmallow-3.25.0}/docs/dashing.json +0 -0
  25. {marshmallow-3.24.2 → marshmallow-3.25.0}/docs/ecosystem.rst +0 -0
  26. {marshmallow-3.24.2 → marshmallow-3.25.0}/docs/examples.rst +0 -0
  27. {marshmallow-3.24.2 → marshmallow-3.25.0}/docs/extending.rst +0 -0
  28. {marshmallow-3.24.2 → marshmallow-3.25.0}/docs/index.rst +0 -0
  29. {marshmallow-3.24.2 → marshmallow-3.25.0}/docs/install.rst +0 -0
  30. {marshmallow-3.24.2 → marshmallow-3.25.0}/docs/kudos.rst +0 -0
  31. {marshmallow-3.24.2 → marshmallow-3.25.0}/docs/license.rst +0 -0
  32. {marshmallow-3.24.2 → marshmallow-3.25.0}/docs/marshmallow.class_registry.rst +0 -0
  33. {marshmallow-3.24.2 → marshmallow-3.25.0}/docs/marshmallow.decorators.rst +0 -0
  34. {marshmallow-3.24.2 → marshmallow-3.25.0}/docs/marshmallow.error_store.rst +0 -0
  35. {marshmallow-3.24.2 → marshmallow-3.25.0}/docs/marshmallow.exceptions.rst +0 -0
  36. {marshmallow-3.24.2 → marshmallow-3.25.0}/docs/marshmallow.fields.rst +0 -0
  37. {marshmallow-3.24.2 → marshmallow-3.25.0}/docs/marshmallow.schema.rst +0 -0
  38. {marshmallow-3.24.2 → marshmallow-3.25.0}/docs/marshmallow.utils.rst +0 -0
  39. {marshmallow-3.24.2 → marshmallow-3.25.0}/docs/marshmallow.validate.rst +0 -0
  40. {marshmallow-3.24.2 → marshmallow-3.25.0}/docs/nesting.rst +0 -0
  41. {marshmallow-3.24.2 → marshmallow-3.25.0}/docs/quickstart.rst +0 -0
  42. {marshmallow-3.24.2 → marshmallow-3.25.0}/docs/top_level.rst +0 -0
  43. {marshmallow-3.24.2 → marshmallow-3.25.0}/docs/upgrading.rst +0 -0
  44. {marshmallow-3.24.2 → marshmallow-3.25.0}/docs/whos_using.rst +0 -0
  45. {marshmallow-3.24.2 → marshmallow-3.25.0}/docs/why.rst +0 -0
  46. {marshmallow-3.24.2 → marshmallow-3.25.0}/src/marshmallow/__init__.py +0 -0
  47. {marshmallow-3.24.2 → marshmallow-3.25.0}/src/marshmallow/class_registry.py +0 -0
  48. {marshmallow-3.24.2 → marshmallow-3.25.0}/src/marshmallow/decorators.py +0 -0
  49. {marshmallow-3.24.2 → marshmallow-3.25.0}/src/marshmallow/error_store.py +0 -0
  50. {marshmallow-3.24.2 → marshmallow-3.25.0}/src/marshmallow/exceptions.py +0 -0
  51. {marshmallow-3.24.2 → marshmallow-3.25.0}/src/marshmallow/fields.py +0 -0
  52. {marshmallow-3.24.2 → marshmallow-3.25.0}/src/marshmallow/orderedset.py +0 -0
  53. {marshmallow-3.24.2 → marshmallow-3.25.0}/src/marshmallow/py.typed +0 -0
  54. {marshmallow-3.24.2 → marshmallow-3.25.0}/src/marshmallow/types.py +0 -0
  55. {marshmallow-3.24.2 → marshmallow-3.25.0}/src/marshmallow/utils.py +0 -0
  56. {marshmallow-3.24.2 → marshmallow-3.25.0}/src/marshmallow/validate.py +0 -0
  57. {marshmallow-3.24.2 → marshmallow-3.25.0}/src/marshmallow/warnings.py +0 -0
  58. {marshmallow-3.24.2 → marshmallow-3.25.0}/tests/__init__.py +0 -0
  59. {marshmallow-3.24.2 → marshmallow-3.25.0}/tests/base.py +0 -0
  60. {marshmallow-3.24.2 → marshmallow-3.25.0}/tests/conftest.py +0 -0
  61. {marshmallow-3.24.2 → marshmallow-3.25.0}/tests/foo_serializer.py +0 -0
  62. {marshmallow-3.24.2 → marshmallow-3.25.0}/tests/mypy_test_cases/test_class_registry.py +0 -0
  63. {marshmallow-3.24.2 → marshmallow-3.25.0}/tests/mypy_test_cases/test_validation_error.py +0 -0
  64. {marshmallow-3.24.2 → marshmallow-3.25.0}/tests/test_decorators.py +0 -0
  65. {marshmallow-3.24.2 → marshmallow-3.25.0}/tests/test_deserialization.py +0 -0
  66. {marshmallow-3.24.2 → marshmallow-3.25.0}/tests/test_error_store.py +0 -0
  67. {marshmallow-3.24.2 → marshmallow-3.25.0}/tests/test_exceptions.py +0 -0
  68. {marshmallow-3.24.2 → marshmallow-3.25.0}/tests/test_fields.py +0 -0
  69. {marshmallow-3.24.2 → marshmallow-3.25.0}/tests/test_options.py +0 -0
  70. {marshmallow-3.24.2 → marshmallow-3.25.0}/tests/test_registry.py +0 -0
  71. {marshmallow-3.24.2 → marshmallow-3.25.0}/tests/test_schema.py +0 -0
  72. {marshmallow-3.24.2 → marshmallow-3.25.0}/tests/test_serialization.py +0 -0
  73. {marshmallow-3.24.2 → marshmallow-3.25.0}/tests/test_utils.py +0 -0
  74. {marshmallow-3.24.2 → marshmallow-3.25.0}/tests/test_validate.py +0 -0
  75. {marshmallow-3.24.2 → marshmallow-3.25.0}/tests/test_version_attributes.py +0 -0
  76. {marshmallow-3.24.2 → marshmallow-3.25.0}/tox.ini +0 -0
@@ -1,6 +1,24 @@
1
1
  Changelog
2
2
  ---------
3
3
 
4
+ 3.25.0 (2025-01-09)
5
+ *******************
6
+
7
+ Features:
8
+
9
+ - Typing: Improve type annotations for ``SchemaMeta.get_declared_fields`` (:pr:`2742`).
10
+
11
+ Bug fixes:
12
+
13
+ - Typing: Relax type annotation for ``Schema.opts`` to allow subclasses to define their own
14
+ options classes (:pr:`2744`).
15
+
16
+ Other changes:
17
+
18
+ - Restore ``marshmallow.base.SchemaABC`` for backwards-compatibility (:issue:`2743`).
19
+ Note that this class is deprecated and will be removed in marshmallow 4.
20
+ Use `marshmallow.schema.Schema` as a base class for type-checking instead.
21
+
4
22
  3.24.2 (2025-01-08)
5
23
  *******************
6
24
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: marshmallow
3
- Version: 3.24.2
3
+ Version: 3.25.0
4
4
  Summary: A lightweight library for converting complex datatypes to and from native Python datatypes.
5
5
  Author-email: Steven Loria <sloria1@gmail.com>
6
6
  Maintainer-email: Steven Loria <sloria1@gmail.com>, Jérôme Lafréchoux <jerome@jolimont.fr>, Jared Deckard <jared@shademaps.com>
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "marshmallow"
3
- version = "3.24.2"
3
+ version = "3.25.0"
4
4
  description = "A lightweight library for converting complex datatypes to and from native Python datatypes."
5
5
  readme = "README.rst"
6
6
  license = { file = "LICENSE" }
@@ -0,0 +1,61 @@
1
+ """Abstract base classes.
2
+
3
+ These are necessary to avoid circular imports between schema.py and fields.py.
4
+
5
+ .. warning::
6
+
7
+ This module is deprecated. Users should not import from this module.
8
+ Use `marshmallow.fields.Field` and `marshmallow.schema.Schema` as base classes instead.
9
+ """
10
+
11
+ from __future__ import annotations
12
+
13
+ from abc import ABC, abstractmethod
14
+
15
+
16
+ class FieldABC(ABC):
17
+ """Abstract base class from which all Field classes inherit."""
18
+
19
+ @abstractmethod
20
+ def serialize(self, attr, obj, accessor=None):
21
+ pass
22
+
23
+ @abstractmethod
24
+ def deserialize(self, value):
25
+ pass
26
+
27
+ @abstractmethod
28
+ def _serialize(self, value, attr, obj, **kwargs):
29
+ pass
30
+
31
+ @abstractmethod
32
+ def _deserialize(self, value, attr, data, **kwargs):
33
+ pass
34
+
35
+
36
+ class SchemaABC(ABC):
37
+ """Abstract base class from which all Schemas inherit."""
38
+
39
+ @abstractmethod
40
+ def dump(self, obj, *, many: bool | None = None):
41
+ pass
42
+
43
+ @abstractmethod
44
+ def dumps(self, obj, *, many: bool | None = None):
45
+ pass
46
+
47
+ @abstractmethod
48
+ def load(self, data, *, many: bool | None = None, partial=None, unknown=None):
49
+ pass
50
+
51
+ @abstractmethod
52
+ def loads(
53
+ self,
54
+ json_data,
55
+ *,
56
+ many: bool | None = None,
57
+ partial=None,
58
+ unknown=None,
59
+ **kwargs,
60
+ ):
61
+ pass
@@ -41,7 +41,7 @@ from marshmallow.utils import (
41
41
  from marshmallow.warnings import RemovedInMarshmallow4Warning
42
42
 
43
43
 
44
- def _get_fields(attrs):
44
+ def _get_fields(attrs) -> list[tuple[str, ma_fields.Field]]:
45
45
  """Get fields from a class
46
46
 
47
47
  :param attrs: Mapping of class attributes
@@ -124,10 +124,10 @@ class SchemaMeta(ABCMeta):
124
124
  def get_declared_fields(
125
125
  mcs,
126
126
  klass: SchemaMeta,
127
- cls_fields: list,
128
- inherited_fields: list,
127
+ cls_fields: list[tuple[str, ma_fields.Field]],
128
+ inherited_fields: list[tuple[str, ma_fields.Field]],
129
129
  dict_cls: type[dict] = dict,
130
- ):
130
+ ) -> dict[str, ma_fields.Field]:
131
131
  """Returns a dictionary of field_name => `Field` pairs declared on the class.
132
132
  This is exposed mainly so that plugins can add additional fields, e.g. fields
133
133
  computed from class Meta options.
@@ -231,7 +231,7 @@ class SchemaOpts:
231
231
  self.many = getattr(meta, "many", False)
232
232
 
233
233
 
234
- class Schema(metaclass=SchemaMeta):
234
+ class Schema(base.SchemaABC, metaclass=SchemaMeta):
235
235
  """Base schema class with which to define custom schemas.
236
236
 
237
237
  Example usage:
@@ -313,7 +313,7 @@ class Schema(metaclass=SchemaMeta):
313
313
  set_class = OrderedSet
314
314
 
315
315
  # These get set by SchemaMeta
316
- opts: SchemaOpts
316
+ opts: typing.Any
317
317
  _declared_fields: dict[str, ma_fields.Field] = {}
318
318
  _hooks: dict[str, list[tuple[str, bool, dict]]] = {}
319
319
 
@@ -1,33 +0,0 @@
1
- """Abstract base classes.
2
-
3
- These are necessary to avoid circular imports between schema.py and fields.py.
4
-
5
- .. warning::
6
-
7
- This module is treated as private API.
8
- Users should not need to use this module directly.
9
- """
10
-
11
- from __future__ import annotations
12
-
13
- from abc import ABC, abstractmethod
14
-
15
-
16
- class FieldABC(ABC):
17
- """Abstract base class from which all Field classes inherit."""
18
-
19
- @abstractmethod
20
- def serialize(self, attr, obj, accessor=None):
21
- pass
22
-
23
- @abstractmethod
24
- def deserialize(self, value):
25
- pass
26
-
27
- @abstractmethod
28
- def _serialize(self, value, attr, obj, **kwargs):
29
- pass
30
-
31
- @abstractmethod
32
- def _deserialize(self, value, attr, data, **kwargs):
33
- pass
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes