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

PR: Fix "from collections import Mapping, MutableMapping" with Python 3.8. #489

Closed
wants to merge 1 commit into from

Conversation

vidakDK
Copy link

@vidakDK vidakDK commented Jul 27, 2019

In Python 3.8 from collections import Mutable no longer works, instead
from collections.abc import Mutable must be used

In Python 3.8 from collections import Mutable no longer works, instead
from collections.abc import Mutable must be used
@vidakDK
Copy link
Author

vidakDK commented Jul 27, 2019

Ah this needs to work in Python 2 as well? Not sure if worth to fix if Python 2 will be gone in a couple months :)

@KelSolaar
Copy link
Member

Hi @vidakDK,

I'm not sure yet how long after Python 2 death we will maintain Colour compatibility with it but it will not go instantly.

What about using something like that instead:

import sys

if sys.version_info[:2] >= (3, 8):
    from collections.abc import Mapping, MutableMapping
else:
    from collections import Mapping, MutableMapping

@KelSolaar KelSolaar changed the title Fix from collections import PR: Fix "from collections import Mapping, MutableMapping" with Python 3.8. Sep 15, 2019
@KelSolaar
Copy link
Member

Looking at this one and seems like there are a few more imports to correct:

/colour-science/colour/colour/algebra
    interpolation.py
        from collections import OrderedDict, Mapping
/colour-science/colour/colour/continuous
    multi_signals.py
        from collections import Iterator, Mapping, OrderedDict, Sequence
    signal.py
        from collections import Iterator, Mapping, OrderedDict, Sequence
/colour-science/colour/colour/plotting
    models.py
        from collections import Mapping
/colour-science/colour/colour/utilities
    array.py
        from collections import Mapping
    data_structures.py
        from collections import Mapping, MutableMapping

Are you happy to do that @vidakDK, I can do it otherwise?

@KelSolaar
Copy link
Member

I was hoping that six would help here but seeing that this PR does not move, I don't think it will: benjaminp/six#241

@KelSolaar
Copy link
Member

Closing this one for Hacktoberfest purposes, thanks @vidakDK!

@KelSolaar KelSolaar closed this Oct 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants