Skip to content

Commit

Permalink
Merge branch '4.0' into context
Browse files Browse the repository at this point in the history
  • Loading branch information
sloria committed Jan 5, 2025
2 parents e638af3 + 7d4f3ee commit 5e485cb
Show file tree
Hide file tree
Showing 26 changed files with 508 additions and 437 deletions.
19 changes: 17 additions & 2 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ Deprecations/Removals:
- *Backwards-incompatible*: Remove implicit field creation, i.e. using the ``fields`` or ``additional`` class Meta options with undeclared fields (:issue:`1356`).
- The `ordered` class Meta option is removed (:issue:`2146`). Field order is already preserved by default.
Set `Schema.dict_class` to `OrderedDict` to maintain the previous behavior.
- The `marshmallow.base` module is removed (:pr:`2722`).

Previously-deprecated API have been removed, including:

Expand All @@ -86,6 +87,20 @@ Previously-deprecated API have been removed, including:
- Passing `"self"` to `fields.Nested` (deprecated in 3.3.0). Use a callable instead.
- `json_module` class Meta option (deprecated in 3.0.0b3). Use `render_module` instead.
- `marshmallow.utils.pprint` (deprecated in 3.7.0). Use `pprint.pprint` instead.
- Remove ``__version__``, ``__parsed_version__``, and ``__version_info__`` attributes which were deprecated in 3.21.0.

3.24.0 (unreleased)
*******************

Features:

- Typing: Improve typings in `marshmallow.fields` (:pr:`2723`).
- Typing: Replace type comments with inline typings (:pr:`2718`).

Bug fixes:

- Typing: Fix type hint for ``nested`` parameter of `Nested <marshmallow.fields.Nested>` (:pr:`2721`).


3.23.3 (2025-01-03)
*******************
Expand Down Expand Up @@ -1139,7 +1154,7 @@ Features:
The ``strict`` parameter is removed.
- *Backwards-incompatible*: ``Schema().load`` and ``Schema().dump`` return ``data`` instead of a
``(data, errors)`` tuple (:issue:`598`).
- *Backwards-incomaptible*: ``Schema().load(None)`` raises a
- *Backwards-incompatible*: ``Schema().load(None)`` raises a
``ValidationError`` (:issue:`511`).

See :ref:`upgrading_3_0` for a guide on updating your code.
Expand Down Expand Up @@ -1342,7 +1357,7 @@ Bug fixes:
This is a backport of the fix in :pr:`857`. Thanks :user:`cristi23` for the
thorough bug report and the PR.

Deprecation/Removal:
Deprecation/Removals:

- Python 2.6 is no longer officially supported (:issue:`1274`).

Expand Down
22 changes: 11 additions & 11 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Contributing Guidelines
Contributing guidelines
=======================

So you're interested in contributing to marshmallow or `one of our associated
Expand All @@ -7,21 +7,21 @@ welcome contributions from anyone willing to work in good faith with
other contributors and the community (see also our
:doc:`code_of_conduct`).

Security Contact Information
Security contact information
----------------------------

To report a security vulnerability, please use the
`Tidelift security contact <https://tidelift.com/security>`_.
Tidelift will coordinate the fix and disclosure.

Questions, Feature Requests, Bug Reports, and Feedback
Questions, feature requests, bug reports, and feedback
-------------------------------------------------------

…should all be reported on the `Github Issue Tracker`_ .

.. _`Github Issue Tracker`: https://github.com/marshmallow-code/marshmallow/issues?state=open

Ways to Contribute
Ways to contribute
------------------

- Comment on some of marshmallow's `open issues <https://github.com/marshmallow-code/marshmallow/issues>`_ (especially those `labeled "feedback welcome" <https://github.com/marshmallow-code/marshmallow/issues?q=is%3Aopen+is%3Aissue+label%3A%22feedback+welcome%22>`_). Share a solution or workaround. Make a suggestion for how a feature can be made better. Opinions are welcome!
Expand All @@ -34,10 +34,10 @@ Ways to Contribute
- Send a PR for an open issue (especially one `labeled "help wanted" <https://github.com/marshmallow-code/marshmallow/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22>`_). The next section details how to contribute code.


Contributing Code
Contributing code
-----------------

Setting Up for Local Development
Setting up for local development
++++++++++++++++++++++++++++++++

1. Fork marshmallow_ on Github.
Expand All @@ -63,20 +63,20 @@ Setting Up for Local Development
# The pre-commit CLI was installed above
$ pre-commit install --allow-missing-config

Git Branch Structure
Git branch structure
++++++++++++++++++++

Marshmallow abides by the following branching model:
marshmallow abides by the following branching model:

``dev``
Current development branch. **New features should branch off here**.

``X.Y-line``
Maintenance branch for release ``X.Y``. **Bug fixes should be sent to the most recent release branch.** The maintainer will forward-port the fix to ``dev``. Note: exceptions may be made for bug fixes that introduce large code changes.
Maintenance branch for release ``X.Y``. **Bug fixes should be sent to the most recent release branch.** A maintainer will forward-port the fix to ``dev``. Note: exceptions may be made for bug fixes that introduce large code changes.

**Always make a new branch for your work**, no matter how small. Also, **do not put unrelated changes in the same branch or pull request**. This makes it more difficult to merge your changes.

Pull Requests
Pull requests
++++++++++++++

1. Create a new local branch.
Expand Down Expand Up @@ -134,7 +134,7 @@ Changes in the `docs/` directory will automatically trigger a rebuild.

.. _contributing_examples:

Contributing Examples
Contributing examples
+++++++++++++++++++++

Have a usage example you'd like to share? A custom `Field` that others might find useful? Feel free to add it to the `examples <https://github.com/marshmallow-code/marshmallow/tree/dev/examples>`_ directory and send a pull request.
Expand Down
24 changes: 12 additions & 12 deletions docs/code_of_conduct.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ organization.

.. _coc-when-something-happens:

When Something Happens
When something happens
----------------------

If you see a Code of Conduct violation, follow these steps:
Expand All @@ -32,7 +32,7 @@ resolve the situation.
recipients of the violation over the comfort of the violator.** See
:ref:`some examples below <coc-enforcement-examples>`.

Our Pledge
Our pledge
----------

In the interest of fostering an open and welcoming environment, we as
Expand All @@ -43,7 +43,7 @@ identity and expression, level of experience, technical preferences,
nationality, personal appearance, race, religion, or sexual identity and
orientation.

Our Standards
Our standards
-------------

Examples of behavior that contributes to creating a positive environment
Expand Down Expand Up @@ -112,7 +112,7 @@ to maintain the comfort and safety of its members.

.. _coc-other-community-standards:

Other Community Standards
Other community standards
~~~~~~~~~~~~~~~~~~~~~~~~~

As a project on GitHub, this project is additionally covered by the
Expand All @@ -123,7 +123,7 @@ Enforcement of those guidelines after violations overlapping with the
above are the responsibility of the entities, and enforcement may happen
in any or all of the services/communities.

Maintainer Enforcement Process
Maintainer enforcement process
------------------------------

Once the maintainers get involved, they will follow a documented series
Expand All @@ -133,7 +133,7 @@ members. This section covers actual concrete steps.

.. _coc-contacting-maintainers:

Contacting Maintainers
Contacting maintainers
~~~~~~~~~~~~~~~~~~~~~~

As a small and young project, we don't yet have a Code of Conduct
Expand All @@ -147,7 +147,7 @@ message is noticed quickly.

.. _coc-further-enforcement:

Further Enforcement
Further enforcement
~~~~~~~~~~~~~~~~~~~

If you've already followed the :ref:`initial enforcement steps
Expand Down Expand Up @@ -177,7 +177,7 @@ in any social setting that puts our members at risk.
Members expelled from events or venues with any sort of paid attendance
will not be refunded.

Who Watches the Watchers?
Who watches the watchers?
~~~~~~~~~~~~~~~~~~~~~~~~~

Maintainers and other leaders who do not follow or enforce the Code of
Expand All @@ -194,10 +194,10 @@ procedures.

.. _coc-enforcement-examples:

Enforcement Examples
Enforcement examples
--------------------

The Best Case
The best case
~~~~~~~~~~~~~

The vast majority of situations work out like this. This interaction is
Expand All @@ -211,7 +211,7 @@ common, and generally positive.
Alex: "oh sorry, sure." -> edits old comment to say "it was really
confusing!"

The Maintainer Case
The maintainer case
~~~~~~~~~~~~~~~~~~~

Sometimes, though, you need to get maintainers involved. Maintainers
Expand Down Expand Up @@ -248,7 +248,7 @@ something **will take priority**.
KeeperOfCommitBits: "@patt Thanks for that. I hear you on the
stress. Burnout sucks :/. Have a good one!"

The Nope Case
The nope case
~~~~~~~~~~~~~

PepeTheFrog🐸: "Hi, I am a literal actual nazi and I think white
Expand Down
15 changes: 7 additions & 8 deletions docs/custom_fields.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@

Custom Fields
Custom fields
=============

There are three ways to create a custom-formatted field for a `Schema`:
Expand All @@ -10,7 +9,7 @@ There are three ways to create a custom-formatted field for a `Schema`:

The method you choose will depend on the manner in which you intend to reuse the field.

Creating A Field Class
Creating a field class
----------------------

To create a custom field class, create a subclass of :class:`marshmallow.fields.Field` and implement its :meth:`_serialize <marshmallow.fields.Field._serialize>` and/or :meth:`_deserialize <marshmallow.fields.Field._deserialize>` methods.
Expand Down Expand Up @@ -43,7 +42,7 @@ To create a custom field class, create a subclass of :class:`marshmallow.fields.
created_at = fields.DateTime()
pin_code = PinCode()
Method Fields
Method fields
-------------

A :class:`Method <marshmallow.fields.Method>` field will serialize to the value returned by a method of the Schema. The method must take an ``obj`` parameter which is the object to be serialized.
Expand All @@ -59,7 +58,7 @@ A :class:`Method <marshmallow.fields.Method>` field will serialize to the value
def get_days_since_created(self, obj):
return dt.datetime.now().day - obj.created_at.day
Function Fields
Function fields
---------------

A :class:`Function <marshmallow.fields.Function>` field will serialize the value of a function that is passed directly to it. Like a :class:`Method <marshmallow.fields.Method>` field, the function must take a single argument ``obj``.
Expand Down Expand Up @@ -95,7 +94,7 @@ Both :class:`Function <marshmallow.fields.Function>` and :class:`Method <marshma
result = schema.load({"balance": "100.00"})
result["balance"] # => 100.0
Customizing Error Messages
Customizing error messages
--------------------------

Validation error messages for fields can be configured at the class or instance level.
Expand Down Expand Up @@ -126,8 +125,8 @@ Error messages can also be passed to a `Field's` constructor.
)
Next Steps
Next steps
----------

- Need to add schema-level validation, post-processing, or error handling behavior? See the :doc:`Extending Schemas <extending>` page.
- Need to add schema-level validation, post-processing, or error handling behavior? See the :doc:`Extending schemas <extending>` page.
- For example applications using marshmallow, check out the :doc:`Examples <examples>` page.
38 changes: 19 additions & 19 deletions docs/dashing.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
{
"name": "Marshmallow",
"package": "marshmallow",
"index": "_build/index.html",
"selectors": {
"dl.class dt": {
"type": "Class",
"attr": "id"
},
"dl.exception dt": {
"type": "Exception",
"attr": "id"
},
"dl.function dt": {
"type": "Function",
"attr": "id"
}
"name": "marshmallow",
"package": "marshmallow",
"index": "_build/index.html",
"selectors": {
"dl.class dt": {
"type": "Class",
"attr": "id"
},
"icon32x32": "",
"allowJS": false,
"ExternalURL": ""
"dl.exception dt": {
"type": "Exception",
"attr": "id"
},
"dl.function dt": {
"type": "Function",
"attr": "id"
}
},
"icon32x32": "",
"allowJS": false,
"ExternalURL": ""
}
4 changes: 2 additions & 2 deletions docs/examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -291,8 +291,8 @@ After registering a user and creating some todo items in the database, here is a
}
Inflection (Camel-casing Keys)
==============================
Inflection (camel-cased keys)
=============================

HTTP APIs will often use camel-cased keys for their input and output representations. This example shows how you can use the
`Schema.on_bind_field <marshmallow.Schema.on_bind_field>` hook to automatically inflect keys.
Expand Down
Loading

0 comments on commit 5e485cb

Please sign in to comment.