question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

use import statements instead of modifying globals() in webargs.fields

See original GitHub issue

Inside 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:closed
  • Created 7 years ago
  • Reactions:3
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
sloriacommented, Nov 6, 2016

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 that webargs.fields contains all the Field classes in marshmallow.fields.

0reactions
sloriacommented, Mar 15, 2017

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found