flask-marshmallow 0.11.0__tar.gz → 1.1.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 (50) hide show
  1. {flask-marshmallow-0.11.0 → flask_marshmallow-1.1.0}/CHANGELOG.rst +152 -0
  2. {flask-marshmallow-0.11.0 → flask_marshmallow-1.1.0}/CONTRIBUTING.rst +3 -3
  3. {flask-marshmallow-0.11.0 → flask_marshmallow-1.1.0}/LICENSE +1 -1
  4. flask_marshmallow-1.1.0/PKG-INFO +170 -0
  5. {flask-marshmallow-0.11.0 → flask_marshmallow-1.1.0}/README.rst +12 -9
  6. {flask-marshmallow-0.11.0 → flask_marshmallow-1.1.0}/docs/_templates/side-primary.html +1 -1
  7. {flask-marshmallow-0.11.0 → flask_marshmallow-1.1.0}/docs/_templates/side-secondary.html +1 -1
  8. {flask-marshmallow-0.11.0 → flask_marshmallow-1.1.0}/docs/conf.py +5 -8
  9. {flask-marshmallow-0.11.0 → flask_marshmallow-1.1.0}/docs/index.rst +10 -3
  10. flask_marshmallow-1.1.0/pyproject.toml +66 -0
  11. {flask-marshmallow-0.11.0 → flask_marshmallow-1.1.0}/src/flask_marshmallow/__init__.py +29 -20
  12. {flask-marshmallow-0.11.0 → flask_marshmallow-1.1.0}/src/flask_marshmallow/fields.py +109 -25
  13. flask_marshmallow-1.1.0/src/flask_marshmallow/py.typed +0 -0
  14. {flask-marshmallow-0.11.0 → flask_marshmallow-1.1.0}/src/flask_marshmallow/schema.py +10 -11
  15. {flask-marshmallow-0.11.0 → flask_marshmallow-1.1.0}/src/flask_marshmallow/sqla.py +20 -64
  16. flask_marshmallow-1.1.0/src/flask_marshmallow/validate.py +183 -0
  17. flask_marshmallow-1.1.0/tests/__init__.py +0 -0
  18. flask_marshmallow-1.1.0/tests/conftest.py +112 -0
  19. flask_marshmallow-1.1.0/tests/test_core.py +61 -0
  20. flask_marshmallow-1.1.0/tests/test_fields.py +169 -0
  21. flask_marshmallow-1.1.0/tests/test_io.py +0 -0
  22. flask_marshmallow-1.1.0/tests/test_sqla.py +288 -0
  23. flask_marshmallow-1.1.0/tests/test_validate.py +107 -0
  24. flask_marshmallow-1.1.0/tox.ini +42 -0
  25. flask-marshmallow-0.11.0/MANIFEST.in +0 -5
  26. flask-marshmallow-0.11.0/PKG-INFO +0 -160
  27. flask-marshmallow-0.11.0/setup.cfg +0 -13
  28. flask-marshmallow-0.11.0/setup.py +0 -84
  29. flask-marshmallow-0.11.0/src/flask_marshmallow/compat.py +0 -9
  30. flask-marshmallow-0.11.0/src/flask_marshmallow.egg-info/PKG-INFO +0 -160
  31. flask-marshmallow-0.11.0/src/flask_marshmallow.egg-info/SOURCES.txt +0 -37
  32. flask-marshmallow-0.11.0/src/flask_marshmallow.egg-info/dependency_links.txt +0 -1
  33. flask-marshmallow-0.11.0/src/flask_marshmallow.egg-info/not-zip-safe +0 -1
  34. flask-marshmallow-0.11.0/src/flask_marshmallow.egg-info/requires.txt +0 -52
  35. flask-marshmallow-0.11.0/src/flask_marshmallow.egg-info/top_level.txt +0 -1
  36. {flask-marshmallow-0.11.0 → flask_marshmallow-1.1.0}/docs/Makefile +0 -0
  37. {flask-marshmallow-0.11.0 → flask_marshmallow-1.1.0}/docs/_static/logo.png +0 -0
  38. {flask-marshmallow-0.11.0 → flask_marshmallow-1.1.0}/docs/_themes/LICENSE +0 -0
  39. {flask-marshmallow-0.11.0 → flask_marshmallow-1.1.0}/docs/_themes/README +0 -0
  40. {flask-marshmallow-0.11.0 → flask_marshmallow-1.1.0}/docs/_themes/flask/layout.html +0 -0
  41. {flask-marshmallow-0.11.0 → flask_marshmallow-1.1.0}/docs/_themes/flask/relations.html +0 -0
  42. {flask-marshmallow-0.11.0 → flask_marshmallow-1.1.0}/docs/_themes/flask/static/flasky.css_t +0 -0
  43. {flask-marshmallow-0.11.0 → flask_marshmallow-1.1.0}/docs/_themes/flask/theme.conf +0 -0
  44. {flask-marshmallow-0.11.0 → flask_marshmallow-1.1.0}/docs/_themes/flask_small/layout.html +0 -0
  45. {flask-marshmallow-0.11.0 → flask_marshmallow-1.1.0}/docs/_themes/flask_small/static/flasky.css_t +0 -0
  46. {flask-marshmallow-0.11.0 → flask_marshmallow-1.1.0}/docs/_themes/flask_small/theme.conf +0 -0
  47. {flask-marshmallow-0.11.0 → flask_marshmallow-1.1.0}/docs/_themes/flask_theme_support.py +7 -7
  48. {flask-marshmallow-0.11.0 → flask_marshmallow-1.1.0}/docs/changelog.rst +0 -0
  49. {flask-marshmallow-0.11.0 → flask_marshmallow-1.1.0}/docs/license.rst +0 -0
  50. {flask-marshmallow-0.11.0 → flask_marshmallow-1.1.0}/docs/make.bat +0 -0
@@ -1,6 +1,158 @@
1
1
  Changelog
2
2
  =========
3
3
 
4
+ 1.1.0 (2024-01-16)
5
+ ******************
6
+
7
+ Features:
8
+
9
+ * Add type coverage (:pr:`290`).
10
+
11
+ 1.0.0 (2024-01-16)
12
+ ******************
13
+
14
+ Features:
15
+
16
+ * Add field ``fields.File``, ``validate.FileType``, and ``validate.FileSize``
17
+ for deserializing uploaded files (:issue:`280`, :pr:`282`).
18
+ Thanks :user:`uncle-lv` for the PR
19
+ * Add field ``Config`` for serializing Flask configuration values (:issue:`280`, :pr:`281`).
20
+ Thanks :user:`greyli` for the PR.
21
+
22
+ Support:
23
+
24
+ * Support marshmallow-sqlalchemy>=0.29.0.
25
+ * Test against Python 3.12.
26
+ * Drop support for Python 3.7.
27
+
28
+ Other changes:
29
+
30
+ * *Backwards-incompatible*: Remove ```flask_marshmallow.__version__``
31
+ and ``flask_marshmallow.__version_info__`` attributes (:pr:`284`).
32
+ Use feature detection or ``importlib.metadata.version("flask-marshmallow")`` instead.
33
+
34
+ 0.15.0 (2023-04-05)
35
+ *******************
36
+
37
+ * Changes to supported software versions.
38
+
39
+ * python3.6 or later and marshmallow>=3.0.0 are now required
40
+ * Add support for python3.11
41
+ * For ``sqlalchemy`` integration, marshmallow-sqlalchemy>=0.28.2 and
42
+ flask-sqlalchemy>=3.0.0 are now required
43
+
44
+ * *Backwards-incompatible*: ``URLFor`` and ``AbsoluteURLFor`` now do not accept
45
+ parameters for ``flask.url_for`` as top-level parameters. They must always be
46
+ passed in the ``values`` dictionary, as explained in the v0.14.0 changelog.
47
+
48
+ Bug fixes:
49
+
50
+ * Address distutils deprecation warning in Python 3.10 (:pr:`242`).
51
+ Thanks :user:`GabrielLins64` for the PR.
52
+
53
+ 0.14.0 (2020-09-27)
54
+ *******************
55
+
56
+ * Add ``values`` argument to ``URLFor`` and ``AbsoluteURLFor`` for passing values to ``flask.url_for``.
57
+ This prevents unrelated parameters from getting passed (:issue:`52`, :issue:`67`).
58
+ Thanks :user:`AlrasheedA` for the PR.
59
+
60
+ Deprecation:
61
+
62
+ * Passing params to ``flask.url_for`` via ``URLFor``'s and ``AbsoluteURLFor``'s constructor
63
+ params is deprecated. Pass ``values`` instead.
64
+
65
+ .. code-block:: python
66
+
67
+ # flask-marshmallow<0.14.0
68
+
69
+
70
+ class UserSchema(ma.Schema):
71
+ _links = ma.Hyperlinks(
72
+ {
73
+ "self": ma.URLFor("user_detail", id="<id>"),
74
+ }
75
+ )
76
+
77
+
78
+ # flask-marshmallow>=0.14.0
79
+
80
+
81
+ class UserSchema(ma.Schema):
82
+ _links = ma.Hyperlinks(
83
+ {
84
+ "self": ma.URLFor("user_detail", values=dict(id="<id>")),
85
+ }
86
+ )
87
+
88
+ 0.13.0 (2020-06-07)
89
+ *******************
90
+
91
+ Bug fixes:
92
+
93
+ * Fix compatibility with marshmallow-sqlalchemy<0.22.0 (:issue:`189`).
94
+ Thanks :user:`PatrickRic` for reporting.
95
+
96
+ Other changes:
97
+
98
+ * Remove unused ``flask_marshmallow.sqla.SchemaOpts``.
99
+
100
+ 0.12.0 (2020-04-26)
101
+ *******************
102
+
103
+ * *Breaking change*: ``ma.ModelSchema`` and ``ma.TableSchema`` are removed, since these are deprecated upstream.
104
+
105
+ .. warning::
106
+ It is highly recommended that you use the newer ``ma.SQLAlchemySchema`` and ``ma.SQLAlchemyAutoSchema`` classes
107
+ instead of ``ModelSchema`` and ``TableSchema``. See the release notes for `marshmallow-sqlalchemy 0.22.0 <https://marshmallow-sqlalchemy.readthedocs.io/en/latest/changelog.html>`_
108
+ for instructions on how to migrate.
109
+
110
+ If you need to use ``ModelSchema`` and ``TableSchema`` for the time being, you'll need to import these directly from ``marshmallow_sqlalchemy``.
111
+
112
+ .. code-block:: python
113
+
114
+ from flask import Flask
115
+ from flask_sqlalchemy import SQLAlchemy
116
+ from flask_marshmallow import Marshmallow
117
+
118
+ app = Flask(__name__)
119
+ app.config["SQLALCHEMY_DATABASE_URI"] = "sqlite:////tmp/test.db"
120
+
121
+ db = SQLAlchemy(app)
122
+ ma = Marshmallow(app)
123
+
124
+ # flask-marshmallow<0.12.0
125
+
126
+
127
+ class AuthorSchema(ma.ModelSchema):
128
+ class Meta:
129
+ model = Author
130
+
131
+
132
+ # flask-marshmallow>=0.12.0 (recommended)
133
+
134
+
135
+ class AuthorSchema(ma.SQLAlchemyAutoSchema):
136
+ class Meta:
137
+ model = Author
138
+ load_instance = True
139
+
140
+
141
+ # flask-marshmallow>=0.12.0 (not recommended)
142
+
143
+ from marshmallow_sqlalchemy import ModelSchema
144
+
145
+
146
+ class AuthorSchema(ModelSchema):
147
+ class Meta:
148
+ model = Author
149
+ sql_session = db.session
150
+
151
+ Bug fixes:
152
+
153
+ * Fix binding Flask-SQLAlchemy's scoped session to ``ma.SQLAlchemySchema`` and ``ma.SQLAlchemyAutoSchema``.
154
+ (:issue:`180`). Thanks :user:`fnalonso` for reporting.
155
+
4
156
  0.11.0 (2020-02-09)
5
157
  *******************
6
158
 
@@ -108,14 +108,14 @@ To run syntax checks: ::
108
108
 
109
109
  $ tox -e lint
110
110
 
111
- (Optional) To run tests on Python 2.7, 3.5, 3.6, and 3.7 virtual environments (must have each interpreter installed): ::
111
+ (Optional) To run tests in all supported Python versions in their own virtual environments (must have each interpreter installed): ::
112
112
 
113
113
  $ tox
114
114
 
115
115
  Documentation
116
116
  *************
117
117
 
118
- Contributions to the documentation are welcome. Documentation is written in `reStructured Text`_ (rST). A quick rST reference can be found `here <http://docutils.sourceforge.net/docs/user/rst/quickref.html>`_. Builds are powered by Sphinx_.
118
+ Contributions to the documentation are welcome. Documentation is written in `reStructuredText`_ (rST). A quick rST reference can be found `here <https://docutils.sourceforge.io/docs/user/rst/quickref.html>`_. Builds are powered by Sphinx_.
119
119
 
120
120
  To build the docs in "watch" mode: ::
121
121
 
@@ -130,5 +130,5 @@ Have a usage example you'd like to share? Feel free to add it to the `examples <
130
130
 
131
131
 
132
132
  .. _Sphinx: http://sphinx.pocoo.org/
133
- .. _`reStructured Text`: http://docutils.sourceforge.net/rst.html
133
+ .. _`reStructuredText`: https://docutils.sourceforge.io/rst.html
134
134
  .. _flask-marshmallow: https://github.com/marshmallow-code/flask-marshmallow
@@ -1,4 +1,4 @@
1
- Copyright 2014-2020 Steven Loria and contributors
1
+ Copyright 2014-2024 Steven Loria and contributors
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining a copy
4
4
  of this software and associated documentation files (the "Software"), to deal
@@ -0,0 +1,170 @@
1
+ Metadata-Version: 2.1
2
+ Name: flask-marshmallow
3
+ Version: 1.1.0
4
+ Summary: Flask + marshmallow for beautiful APIs
5
+ Maintainer-email: Steven Loria <sloria1@gmail.com>
6
+ Requires-Python: >=3.8
7
+ Description-Content-Type: text/x-rst
8
+ Classifier: Environment :: Web Environment
9
+ Classifier: Intended Audience :: Developers
10
+ Classifier: License :: OSI Approved :: MIT License
11
+ Classifier: Natural Language :: English
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.8
14
+ Classifier: Programming Language :: Python :: 3.9
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
19
+ Requires-Dist: Flask>=2.2
20
+ Requires-Dist: marshmallow>=3.0.0
21
+ Requires-Dist: flask-marshmallow[tests] ; extra == "dev"
22
+ Requires-Dist: tox ; extra == "dev"
23
+ Requires-Dist: pre-commit~=3.5 ; extra == "dev"
24
+ Requires-Dist: marshmallow-sqlalchemy>=0.19.0 ; extra == "docs"
25
+ Requires-Dist: Sphinx==7.2.6 ; extra == "docs"
26
+ Requires-Dist: sphinx-issues==3.0.1 ; extra == "docs"
27
+ Requires-Dist: flask-sqlalchemy>=3.0.0 ; extra == "sqlalchemy"
28
+ Requires-Dist: marshmallow-sqlalchemy>=0.29.0 ; extra == "sqlalchemy"
29
+ Requires-Dist: flask-marshmallow[sqlalchemy] ; extra == "tests"
30
+ Requires-Dist: pytest ; extra == "tests"
31
+ Project-URL: Funding, https://opencollective.com/marshmallow
32
+ Project-URL: Issues, https://github.com/marshmallow-code/flask-marshmallow/issues
33
+ Provides-Extra: dev
34
+ Provides-Extra: docs
35
+ Provides-Extra: sqlalchemy
36
+ Provides-Extra: tests
37
+
38
+ *****************
39
+ Flask-Marshmallow
40
+ *****************
41
+
42
+ |pypi-package| |build-status| |docs| |marshmallow3|
43
+
44
+ Flask + marshmallow for beautiful APIs
45
+ ======================================
46
+
47
+ Flask-Marshmallow is a thin integration layer for `Flask`_ (a Python web framework) and `marshmallow`_ (an object serialization/deserialization library) that adds additional features to marshmallow, including URL and Hyperlinks fields for HATEOAS-ready APIs. It also (optionally) integrates with `Flask-SQLAlchemy <http://flask-sqlalchemy.pocoo.org/>`_.
48
+
49
+ Get it now
50
+ ----------
51
+ ::
52
+
53
+ pip install flask-marshmallow
54
+
55
+
56
+ Create your app.
57
+
58
+ .. code-block:: python
59
+
60
+ from flask import Flask
61
+ from flask_marshmallow import Marshmallow
62
+
63
+ app = Flask(__name__)
64
+ ma = Marshmallow(app)
65
+
66
+ Write your models.
67
+
68
+ .. code-block:: python
69
+
70
+ from your_orm import Model, Column, Integer, String, DateTime
71
+
72
+
73
+ class User(Model):
74
+ email = Column(String)
75
+ password = Column(String)
76
+ date_created = Column(DateTime, auto_now_add=True)
77
+
78
+
79
+ Define your output format with marshmallow.
80
+
81
+ .. code-block:: python
82
+
83
+
84
+ class UserSchema(ma.Schema):
85
+ class Meta:
86
+ # Fields to expose
87
+ fields = ("email", "date_created", "_links")
88
+
89
+ # Smart hyperlinking
90
+ _links = ma.Hyperlinks(
91
+ {
92
+ "self": ma.URLFor("user_detail", values=dict(id="<id>")),
93
+ "collection": ma.URLFor("users"),
94
+ }
95
+ )
96
+
97
+
98
+ user_schema = UserSchema()
99
+ users_schema = UserSchema(many=True)
100
+
101
+
102
+ Output the data in your views.
103
+
104
+ .. code-block:: python
105
+
106
+ @app.route("/api/users/")
107
+ def users():
108
+ all_users = User.all()
109
+ return users_schema.dump(all_users)
110
+
111
+
112
+ @app.route("/api/users/<id>")
113
+ def user_detail(id):
114
+ user = User.get(id)
115
+ return user_schema.dump(user)
116
+
117
+
118
+ # {
119
+ # "email": "fred@queen.com",
120
+ # "date_created": "Fri, 25 Apr 2014 06:02:56 -0000",
121
+ # "_links": {
122
+ # "self": "/api/users/42",
123
+ # "collection": "/api/users/"
124
+ # }
125
+ # }
126
+
127
+
128
+ http://flask-marshmallow.readthedocs.io/
129
+ ========================================
130
+
131
+ Learn More
132
+ ==========
133
+
134
+ To learn more about marshmallow, check out its `docs <http://marshmallow.readthedocs.io/en/latest/>`_.
135
+
136
+
137
+
138
+ Project Links
139
+ =============
140
+
141
+ - Docs: https://flask-marshmallow.readthedocs.io/
142
+ - Changelog: http://flask-marshmallow.readthedocs.io/en/latest/changelog.html
143
+ - PyPI: https://pypi.org/project/flask-marshmallow/
144
+ - Issues: https://github.com/marshmallow-code/flask-marshmallow/issues
145
+
146
+ License
147
+ =======
148
+
149
+ MIT licensed. See the bundled `LICENSE <https://github.com/marshmallow-code/flask-marshmallow/blob/master/LICENSE>`_ file for more details.
150
+
151
+
152
+ .. _Flask: http://flask.pocoo.org
153
+ .. _marshmallow: http://marshmallow.readthedocs.io
154
+
155
+ .. |pypi-package| image:: https://badgen.net/pypi/v/flask-marshmallow
156
+ :target: https://pypi.org/project/flask-marshmallow/
157
+ :alt: Latest version
158
+
159
+ .. |build-status| image:: https://github.com/marshmallow-code/flask-marshmallow/actions/workflows/build-release.yml/badge.svg
160
+ :target: https://github.com/marshmallow-code/flask-marshmallow/actions/workflows/build-release.yml
161
+ :alt: Build status
162
+
163
+ .. |docs| image:: https://readthedocs.org/projects/flask-marshmallow/badge/
164
+ :target: https://flask-marshmallow.readthedocs.io/
165
+ :alt: Documentation
166
+
167
+ .. |marshmallow3| image:: https://badgen.net/badge/marshmallow/3
168
+ :target: https://marshmallow.readthedocs.io/en/latest/upgrading.html
169
+ :alt: marshmallow 3 compatible
170
+
@@ -2,7 +2,7 @@
2
2
  Flask-Marshmallow
3
3
  *****************
4
4
 
5
- |pypi-package| |build-status| |docs| |marshmallow23| |black|
5
+ |pypi-package| |build-status| |docs| |marshmallow3|
6
6
 
7
7
  Flask + marshmallow for beautiful APIs
8
8
  ======================================
@@ -51,7 +51,10 @@ Define your output format with marshmallow.
51
51
 
52
52
  # Smart hyperlinking
53
53
  _links = ma.Hyperlinks(
54
- {"self": ma.URLFor("user_detail", id="<id>"), "collection": ma.URLFor("users")}
54
+ {
55
+ "self": ma.URLFor("user_detail", values=dict(id="<id>")),
56
+ "collection": ma.URLFor("users"),
57
+ }
55
58
  )
56
59
 
57
60
 
@@ -100,7 +103,7 @@ Project Links
100
103
 
101
104
  - Docs: https://flask-marshmallow.readthedocs.io/
102
105
  - Changelog: http://flask-marshmallow.readthedocs.io/en/latest/changelog.html
103
- - PyPI: https://pypi.python.org/pypi/flask-marshmallow
106
+ - PyPI: https://pypi.org/project/flask-marshmallow/
104
107
  - Issues: https://github.com/marshmallow-code/flask-marshmallow/issues
105
108
 
106
109
  License
@@ -115,15 +118,15 @@ MIT licensed. See the bundled `LICENSE <https://github.com/marshmallow-code/flas
115
118
  .. |pypi-package| image:: https://badgen.net/pypi/v/flask-marshmallow
116
119
  :target: https://pypi.org/project/flask-marshmallow/
117
120
  :alt: Latest version
118
- .. |build-status| image:: https://dev.azure.com/sloria/sloria/_apis/build/status/marshmallow-code.flask-marshmallow?branchName=dev
119
- :target: https://dev.azure.com/sloria/sloria/_build/latest?definitionId=14&branchName=dev
121
+
122
+ .. |build-status| image:: https://github.com/marshmallow-code/flask-marshmallow/actions/workflows/build-release.yml/badge.svg
123
+ :target: https://github.com/marshmallow-code/flask-marshmallow/actions/workflows/build-release.yml
120
124
  :alt: Build status
125
+
121
126
  .. |docs| image:: https://readthedocs.org/projects/flask-marshmallow/badge/
122
127
  :target: https://flask-marshmallow.readthedocs.io/
123
128
  :alt: Documentation
124
- .. |marshmallow23| image:: https://badgen.net/badge/marshmallow/2,3?list=1
129
+
130
+ .. |marshmallow3| image:: https://badgen.net/badge/marshmallow/3
125
131
  :target: https://marshmallow.readthedocs.io/en/latest/upgrading.html
126
132
  :alt: marshmallow 3 compatible
127
- .. |black| image:: https://badgen.net/badge/code%20style/black/000
128
- :target: https://github.com/ambv/black
129
- :alt: code style: black
@@ -14,7 +14,7 @@ Flask + marshmallow for beautiful APIs
14
14
 
15
15
  <h3>Useful Links</h3>
16
16
  <ul>
17
- <li><a href="http://pypi.python.org/pypi/flask-marshmallow">Flask-Marshmallow @ PyPI</a></li>
17
+ <li><a href="https://pypi.org/project/flask-marshmallow/">Flask-Marshmallow @ PyPI</a></li>
18
18
  <li><a href="http://github.com/marshmallow-code/flask-marshmallow">Flask-Marshmallow @ GitHub</a></li>
19
19
  <li><a href="http://github.com/marshmallow-code/flask-marshmallow/issues">Issue Tracker</a></li>
20
20
  </ul>
@@ -18,7 +18,7 @@ Flask + marshmallow for beautiful APIs
18
18
 
19
19
  <h3>Useful Links</h3>
20
20
  <ul>
21
- <li><a href="http://pypi.python.org/pypi/flask-marshmallow">Flask-Marshmallow @ PyPI</a></li>
21
+ <li><a href="https://pypi.org/project/flask-marshmallow/">Flask-Marshmallow @ PyPI</a></li>
22
22
  <li><a href="http://github.com/marshmallow-code/flask-marshmallow">Flask-Marshmallow @ GitHub</a></li>
23
23
  <li><a href="http://github.com/marshmallow-code/flask-marshmallow/issues">Issue Tracker</a></li>
24
24
  </ul>
@@ -1,10 +1,7 @@
1
- # -*- coding: utf-8 -*-
2
1
  import datetime as dt
3
- import sys
2
+ import importlib.metadata
4
3
  import os
5
-
6
- sys.path.insert(0, os.path.abspath(os.path.join("..", "src")))
7
- import flask_marshmallow # noqa: E402
4
+ import sys
8
5
 
9
6
  sys.path.append(os.path.abspath("_themes"))
10
7
  extensions = ["sphinx.ext.autodoc", "sphinx.ext.intersphinx", "sphinx_issues"]
@@ -34,13 +31,13 @@ source_suffix = ".rst"
34
31
  master_doc = "index"
35
32
 
36
33
  # General information about the project.
37
- project = u"Flask-Marshmallow"
38
- copyright = u"2014-{:%Y}".format(
34
+ project = "Flask-Marshmallow"
35
+ copyright = "2014-{:%Y}".format(
39
36
  dt.datetime.utcfromtimestamp(os.path.getmtime("../CHANGELOG.rst"))
40
37
  )
41
38
 
42
39
 
43
- version = release = flask_marshmallow.__version__
40
+ version = release = importlib.metadata.version("flask-marshmallow")
44
41
  exclude_patterns = ["_build"]
45
42
  # The name of the Pygments (syntax highlighting) style to use.
46
43
  pygments_style = "flask_theme_support.FlaskyStyle"
@@ -4,7 +4,7 @@ Flask-Marshmallow: Flask + marshmallow for beautiful APIs
4
4
 
5
5
  :ref:`changelog <changelog>` //
6
6
  `github <http://github.com/marshmallow-code/flask-marshmallow>`_ //
7
- `pypi <http://pypi.python.org/pypi/flask-marshmallow>`_ //
7
+ `pypi <https://pypi.org/project/flask-marshmallow/>`_ //
8
8
  `issues <http://github.com/marshmallow-code/flask-marshmallow/issues>`_
9
9
 
10
10
 
@@ -55,7 +55,10 @@ Define your output format with marshmallow.
55
55
 
56
56
  # Smart hyperlinking
57
57
  _links = ma.Hyperlinks(
58
- {"self": ma.URLFor("user_detail", id="<id>"), "collection": ma.URLFor("users")}
58
+ {
59
+ "self": ma.URLFor("user_detail", values=dict(id="<id>")),
60
+ "collection": ma.URLFor("users"),
61
+ }
59
62
  )
60
63
 
61
64
 
@@ -175,8 +178,9 @@ You can now use your schema to dump and load your ORM objects.
175
178
 
176
179
  - By default, `~flask_marshmallow.sqla.SQLAlchemySchema` uses the scoped session created by Flask-SQLAlchemy.
177
180
  - `~flask_marshmallow.sqla.SQLAlchemySchema` subclasses `flask_marshmallow.Schema`, so it includes the `~flask_marshmallow.Schema.jsonify` method.
181
+
178
182
  Note: By default, Flask's `jsonify` method sorts the list of keys and returns consistent results to ensure that external HTTP caches aren't trashed. As a side effect, this will override `ordered=True <https://marshmallow.readthedocs.io/en/latest/quickstart.html#ordering-output>`_
179
- in the SQLAlchemySchema's `class Meta` (if you set it). To disable this, set `JSON_SORT_KEYS=False` in your Flask app config. In production it's recommended to let `jsonify` sort the keys and not set `ordered=True` in your `~flask_marshmallow.sqla.SQLAlchemySchema` in order to minimize generation time and maximize cachability of the results.
183
+ in the SQLAlchemySchema's `class Meta` (if you set it). To disable this, set `JSON_SORT_KEYS=False` in your Flask app config. In production it's recommended to let `jsonify` sort the keys and not set `ordered=True` in your `~flask_marshmallow.sqla.SQLAlchemySchema` in order to minimize generation time and maximize cacheability of the results.
180
184
 
181
185
  You can also use `ma.HyperlinkRelated <flask_marshmallow.sqla.HyperlinkRelated>` fields if you want relationships to be represented by hyperlinks rather than primary keys.
182
186
 
@@ -225,6 +229,9 @@ API
225
229
  .. automodule:: flask_marshmallow.fields
226
230
  :members:
227
231
 
232
+ .. automodule:: flask_marshmallow.validate
233
+ :members:
234
+
228
235
  .. automodule:: flask_marshmallow.sqla
229
236
  :members:
230
237
 
@@ -0,0 +1,66 @@
1
+ [project]
2
+ name = "flask-marshmallow"
3
+ version = "1.1.0"
4
+ description = "Flask + marshmallow for beautiful APIs"
5
+ readme = "README.rst"
6
+ license = { file = "LICENSE" }
7
+ maintainers = [{ name = "Steven Loria", email = "sloria1@gmail.com" }]
8
+ classifiers = [
9
+ "Environment :: Web Environment",
10
+ "Intended Audience :: Developers",
11
+ "License :: OSI Approved :: MIT License",
12
+ "Natural Language :: English",
13
+ "Programming Language :: Python :: 3",
14
+ "Programming Language :: Python :: 3.8",
15
+ "Programming Language :: Python :: 3.9",
16
+ "Programming Language :: Python :: 3.10",
17
+ "Programming Language :: Python :: 3.11",
18
+ "Programming Language :: Python :: 3.12",
19
+ "Topic :: Internet :: WWW/HTTP :: Dynamic Content",
20
+ ]
21
+ requires-python = ">=3.8"
22
+ dependencies = ["Flask>=2.2", "marshmallow>=3.0.0"]
23
+
24
+ [project.urls]
25
+ Issues = "https://github.com/marshmallow-code/flask-marshmallow/issues"
26
+ Funding = "https://opencollective.com/marshmallow"
27
+
28
+ [project.optional-dependencies]
29
+ docs = [
30
+ "marshmallow-sqlalchemy>=0.19.0",
31
+ "Sphinx==7.2.6",
32
+ "sphinx-issues==3.0.1",
33
+ ]
34
+ tests = ["flask-marshmallow[sqlalchemy]", "pytest"]
35
+ dev = ["flask-marshmallow[tests]", "tox", "pre-commit~=3.5"]
36
+ sqlalchemy = ["flask-sqlalchemy>=3.0.0", "marshmallow-sqlalchemy>=0.29.0"]
37
+
38
+ [build-system]
39
+ requires = ["flit_core<4"]
40
+ build-backend = "flit_core.buildapi"
41
+
42
+ [tool.flit.sdist]
43
+ include = ["docs/", "tests/", "CHANGELOG.rst", "CONTRIBUTING.rst", "tox.ini"]
44
+ exclude = ["docs/_build/"]
45
+
46
+ [tool.ruff]
47
+ src = ["src"]
48
+ fix = true
49
+ show-fixes = true
50
+ show-source = true
51
+
52
+ [tool.ruff.lint]
53
+ select = [
54
+ "B", # flake8-bugbear
55
+ "E", # pycodestyle error
56
+ "F", # pyflakes
57
+ "I", # isort
58
+ "UP", # pyupgrade
59
+ "W", # pycodestyle warning
60
+ ]
61
+
62
+ [tool.pytest.ini_options]
63
+ filterwarnings = [
64
+ "error",
65
+ "ignore:distutils Version classes are deprecated\\. Use packaging.version instead\\.:DeprecationWarning:marshmallow",
66
+ ]