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
[Work in progress] Marshmallow 3 port #188
Conversation
Thanks so much for working on this! I'll take a closer look at this when I'm back from my vacation (I'm out of my home country until Saturday). |
Not sure about tox, but here's what we do for marshmallow-sqlalchemy on travis: https://github.com/marshmallow-code/marshmallow-sqlalchemy/blob/dev/.travis.yml |
webargs/core.py
Outdated
@@ -477,6 +484,9 @@ def location_handler(self, name): | |||
|
|||
@parser.location_handler('name') | |||
def parse_data(request, name, field): | |||
# Marshmallow 3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Drive-by comment: request
here is a hypothetical Request object, not a MarshalResult
, so no need to change the docs here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, right. Fixed. (I'll squash all commits when done.)
From #184:
I believe it is much better if we can support both MA versions in a single webargs branch. Maintaining two webargs branches would be a heavier burden IMHO. This is what this PR shows. The double-MA support is only a few lines of code in the lib. Most of the overhead is in the tests, and it is quite redundant but not that complex. Also it is all easy to spot and remove when MA2 is dropped. This is my favourite option. I'm pretty sure we can do just the same with apispec. If we agree on that single-branch principle, then I let you decide whether we keep a A dedicated branch could be the cleanest way, but we'll have to merge in there all the changes from |
I agree--supporting both marshmallow 2 and 3 would be preferable, and it looks like doing so won't add too much complexity to the codebase. Once you have this is in a working state, I can create a |
OK, great. The failing test is linked to #187. I'm not sure what to do about it. Apart from this, if you think this implementation is fine, then I shall
|
@lafrech Implementation looks good to me. I've removed that pesky test. Will you take care of updating |
Erm, nvm; we already test against marshmallow 3 pre-releases. I've added
...so that marshmallow releases won't break webargs builds in the meantime. I suppose you can remove that in this PR. |
Great. One more detail. I just noticed this in the tests: MARSHMALLOW_VERSION_INFO = tuple(
[int(part) for part in marshmallow.__version__.split('.') if part.isdigit()]
) Do you think I should use something like this in the code rather than MARSHMALLOW_2 = ma.__version__.startswith('2') ? I've been searching for good ways of determining if the version is 2 or 3 from a semver string but I didn't find anything obvious and I thought it would be a shame to add a dedicated lib just to do that. So I settled with that simple I could move MARSHMALLOW_VERSION_INFO = tuple(
[int(part) for part in marshmallow.__version__.split('.') if part.isdigit()]
) to the lib code (rather than the tests) and use |
Yeah, I think it makes sense to move |
Alright. I just pushed |
Went ahead and merged |
OK. Should we reallow failures for MA3 until v3 stable ships? |
@lafrech I think we can keep dev up to date with the latest MA3 release, in which case we shouldn't allow failures. |
Yeah, right. It's not like MA3 is moving that fast. |
I've initiated a Marshmallow 3 port. Feedback welcome.
I'm not sure how to let tox/Travis test on both Marshmallow versions.
Regarding
test_error_handler_is_called_regardless_of_schema_strict_setting
, see #187.