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

Automatically import `fields` module. #557

Merged
merged 1 commit into from Dec 1, 2016

Conversation

Projects
None yet
2 participants
@mindojo-victor
Contributor

mindojo-victor commented Nov 30, 2016

marshmallow/__init__.py should do from . import fields. This would save some lines for the users. Any schema needs fields, there is no reason to not import the module automatically.

This would help in such case:

import marshmallow as mm

class UpgradeNowSchema(mm.Schema):
    plan = mm.fields.String(required=True)

Otherwise I need to:

import marshmallow as mm
import marshmallow.fields

which looks strange and ugly.

I would be even better to have fields in the main namespace:

plan = marshmallow.String(required=True)

then I would avoid shortening marshmallow -> mm or ma.

@sloria sloria merged commit c0afff5 into marshmallow-code:dev Dec 1, 2016

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@sloria

This comment has been minimized.

Member

sloria commented Dec 1, 2016

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment