use import statements instead of modifying globals() in webargs.fields
See original GitHub issueInside webargs.fields
, globals()
were modified in order to import all fields except Nested
from marshmallow, I see two shortcomings in this:
jedi
won’t be able to collect marshmallow fields from webargs- hurts readability
can I send a PR to change this into import
statements? It’d solve the above problems, but it’ll require webargs to change its code when marshmallow adds fields
Issue Analytics
- State:
- Created 7 years ago
- Reactions:3
- Comments:7 (6 by maintainers)
Top Results From Across the Web
use import statements instead of modifying globals() in webargs ...
Inside webargs.fields , globals() were modified in order to import all fields except Nested from marshmallow, I see two shortcomings in this:.
Read more >Advanced Usage - webargs 8.2.0 documentation
If your schema has a post_load method that returns a non-dictionary, you should use use_args instead. from marshmallow import Schema, fields, post_load ...
Read more >Changelog - webargs 8.2.0 documentation
Instead of using a single field or schema with multiple locations , users are recommended to make ... Don't mutate globals() in webargs.fields...
Read more >Release 8.2.0 unknown - Webargs
When using the use_args decorator, the arguments dictionary will be before any URL variable parameters. from webargs import fields from webargs.
Read more >Release 5.5.3 unknown - Webargs
Str())}. If you expect repeated query parameters, e.g. /?repo=webargs&repo=marshmallow, use fields.List instead. from webargs import fields.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Since marshmallow’s
fields
module is relatively stable, I would be open to this change. It does add maintenance burden to keep webargs.fields up to date–perhaps we could add a test that ensures thatwebargs.fields
contains all the Field classes inmarshmallow.fields
.I’m going to close this for now. Implementing this adds more maintenance burden than I’m willing to take on right now. If you want to address the static analysis issue, I suggest importing from
marshmallow.fields
directly.