fuhrysteve / marshmallow-jsonschema

JSON Schema Draft v7 (http://json-schema.org/) formatting with marshmallow
MIT License
209 stars 72 forks source link

ModuleNotFoundError: No module named 'marshmallow.compat' with marshmallow 3.0.0rc6 installed #69

Closed kato-m closed 5 years ago

kato-m commented 5 years ago

Executing the JSONSchema example

from marshmallow import Schema, fields
from marshmallow_jsonschema import JSONSchema
class UserSchema(Schema):
    username = fields.String()
    age = fields.Integer()
    birthday = fields.Date()
user_schema = UserSchema()
json_schema = JSONSchema()
json_schema.dump(user_schema).data

with marshmallow 3.0.0rc6 installed yields

ModuleNotFoundError: No module named 'marshmallow.compat'

AFAIS the module marshmallow.compat is gone with version 3.0.0. (cf. file finder)

fuhrysteve commented 5 years ago

Looks legit! I'll take a look soon unless someone beats me to it!

This library will need to be forward / backward compatible with 2 & 3 for a little bit I think, since the amount of breaking changes in marshmallow 3 are starting to stack up pretty high.

kato-m commented 5 years ago

Any idea how I could work around?

fuhrysteve commented 5 years ago

Fixed by #70

@kato-m if you install from the latest master, you should be all set for marshmallow 3!

kato-m commented 5 years ago

Thanks a lot 👍

smalekzadeh commented 5 years ago

We are trying to upgrade from 2.19.2 to 3.1.1 and get the same error . Could you please advice how to get around it.

from flask_apispec import ResourceMeta

venv/lib/python3.6/site-packages/flask_apispec/init.py:2: in from flask_apispec.views import ResourceMeta, MethodResource venv/lib/python3.6/site-packages/flask_apispec/views.py:6: in from flask_apispec.annotations import activate venv/lib/python3.6/site-packages/flask_apispec/annotations.py:6: in from flask_apispec.wrapper import Wrapper venv/lib/python3.6/site-packages/flask_apispec/wrapper.py:8: in from webargs import flaskparser venv/lib/python3.6/site-packages/webargs/init.py:8: in from webargs.core import dict2schema, ValidationError venv/lib/python3.6/site-packages/webargs/core.py:23: in from marshmallow.compat import iteritems E ModuleNotFoundError: No module named 'marshmallow.compat'

rohitsingh093 commented 5 years ago

@fuhrysteve This is still not compatible with marshmallow version 3

  File "<stdin>", line 1, in <module>
  File "{{path}}/run.py", line 5, in <module>
    from marshmallow_mongoengine import ModelSchema
  File "{{path}}/venv/lib/python3.7/site-packages/marshmallow_mongoengine/__init__.py", line 11, in <module>
    from marshmallow_mongoengine.schema import (
  File "/{{path}}/venv/lib/python3.7/site-packages/marshmallow_mongoengine/schema.py", line 6, in <module>
    from marshmallow.compat import with_metaclass
ModuleNotFoundError: No module named 'marshmallow.compat'

Still facing the issue.

fuhrysteve commented 5 years ago

@roronoa007 I'm not going to get around to fixing it for awhile unfortunately! But I can review & merge pull requests