Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warning: The 'missing' attribute of fields is deprecated #382

Open
tiltowait opened this issue Nov 6, 2022 · 1 comment
Open

Warning: The 'missing' attribute of fields is deprecated #382

tiltowait opened this issue Nov 6, 2022 · 1 comment

Comments

@tiltowait
Copy link

When I run unit tests involving umongo, I get the following warning message (actually, if I run the tests via pytest instead of unittest, I get hundreds of the same warning):

/Users/tiltowait/Library/Caches/pypoetry/virtualenvs/inconnu-qKm_l4La-py3.10/lib/python3.10/site-packages/umongo/data_proxy.py:160: RemovedInMarshmallow4Warning: The 'missing' attribute of fields is deprecated. Use 'load_default' instead.
   if callable(field.missing):
 /Users/tiltowait/Library/Caches/pypoetry/virtualenvs/inconnu-qKm_l4La-py3.10/lib/python3.10/site-packages/umongo/data_proxy.py:163: RemovedInMarshmallow4Warning: The 'missing' attribute of fields is deprecated. Use 'load_default' instead.
   self._data[mongo_name] = field.missing
 /Users/tiltowait/Library/Caches/pypoetry/virtualenvs/inconnu-qKm_l4La-py3.10/lib/python3.10/site-packages/umongo/data_proxy.py:161: RemovedInMarshmallow4Warning: The 'missing' attribute of fields is deprecated. Use 'load_default' instead.
   self._data[mongo_name] = field.missing()

Is there any plan to address this? It looks like a simple fix, but I'm not familiar with umongo's code to be confident in that assessment.

@lafrech
Copy link
Collaborator

lafrech commented Nov 6, 2022

The change shouldn't be difficult. Just replace missing with load_default in the right place(s).

The trick is that load_default was introduced in marshmallow 3.13 and umongo supports marshmallow 3.10. If we use missing in a few places, we can make it conditional (use the right attribute name depending on marshmallow version). Otherwise, we may be tempted to drop marshmallow < 3.13.

Would you like to try and send a PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants