Skip to content
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

Deprecation warning, affects compatibility with Python 3.8 #487

Closed
jasonrhaas opened this issue Nov 8, 2018 · 10 comments
Closed

Deprecation warning, affects compatibility with Python 3.8 #487

jasonrhaas opened this issue Nov 8, 2018 · 10 comments

Comments

@jasonrhaas
Copy link

When running tests with pytest, I noticed some deprecation warnings popping up. It appears that starting in Python 3.8 we will start to see some issues.

/python3.7/site-packages/jsonschema/compat.py:6:
DeprecationWarning: Using or importing the ABCs from 'collections' instead of 
from 'collections.abc' is deprecated, and in 3.8 it will stop working
    from collections import MutableMapping, Sequence  # noqa
@jasonrhaas jasonrhaas changed the title Deprecation warning Deprecation warning, affects compatibility with Python 3.8 Nov 8, 2018
@Julian
Copy link
Member

Julian commented Nov 8, 2018

Hey. Pretty sure someone sent a patch to fix this on HEAD, what version are you on?

@Julian
Copy link
Member

Julian commented Nov 8, 2018

Of jsonschema I mean.

@jasonrhaas
Copy link
Author

I'm running:

jsonschema==2.6.0

So the fix is in the alpha release?

@Julian
Copy link
Member

Julian commented Nov 8, 2018 via email

@Julian
Copy link
Member

Julian commented Nov 12, 2018

Closing, but let me know if that's not the case.

@Julian Julian closed this as completed Nov 12, 2018
@kazz-s
Copy link

kazz-s commented Nov 17, 2018

your problem is that you got 2 import mixed up

import operator
import sys


try:
    from collections import MutableMapping, Sequence  # noqa
except ImportError:
    from collections.abc import MutableMapping, Sequence  # noqa

you should use from collections.abc ... by default and then on error fall back to from collections ....

While from collections import MutableMapping works we will keep getting this warning.

@lifeeric
Copy link

lifeeric commented Jul 13, 2022

Hey all,
I still have this problem while testing with pytest. don't know what's causing it.

JsonSchema:

jsonschema==2.6.0
    # via flasgger
env/lib/python3.9/site-packages/jsonschema/compat.py:6
env/lib/python3.9/site-packages/jsonschema/compat.py:6
  /env/lib/python3.9/site-packages/jsonschema/compat.py:6: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3, and in 3.10 it will stop working
    from collections import MutableMapping, Sequence  # noqa

thank you all!

@Julian
Copy link
Member

Julian commented Jul 13, 2022

Hi there, sounds like that belongs filed on flasgger, that's a very old version of this library that's being depended on.

@lifeeric
Copy link

lifeeric commented Jul 13, 2022

@Julian when I only import from from collections.abc on compay.py then the warning disappears:

from collections.abc import MutableMapping, Sequence  # noqa

instead of :

try:
    from collections import MutableMapping, Sequence  # noqa
except ImportError:
    from collections.abc import MutableMapping, Sequence  # noqa

@Julian
Copy link
Member

Julian commented Jul 13, 2022

That code isn't present on any recent version of this library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants