plangrid/flask-rebar

Support for Python 3.10

CafeLungo opened this issue · 4 comments

I seem to get an error when trying to import Rebar on python 3.10, but not on 3.9:

Python 3.10:

Python 3.10.0 (default, Oct 14 2021, 11:44:54) [Clang 12.0.0 (clang-1200.0.32.29)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from flask_rebar import Rebar
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "[..]/.venv/lib/python3.10/site-packages/flask_rebar/__init__.py", line 3, in <module>
    from flask_rebar.utils.request_utils import marshal, response
  File "[..]/.venv/lib/python3.10/site-packages/flask_rebar/utils/request_utils.py", line 22, in <module>
    from flask_rebar import compat
  File "[..]/.venv/lib/python3.10/site-packages/flask_rebar/compat.py", line 1, in <module>
    from collections import Mapping
ImportError: cannot import name 'Mapping' from 'collections' ([..]/.pyenv/versions/3.10.0/lib/python3.10/collections/__init__.py)

Python 3.9:

Python 3.9.7 (default, Oct 13 2021, 06:44:56)
[Clang 12.0.0 (clang-1200.0.32.29)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from flask_rebar import Rebar
>>>

Yeah, this should be collections.abc.Mapping starting in 3.10

@RookieRick will try and get a patch release out this week, thanks for reporting!

Thanks for the report @CafeLungo and the quick fix @gtmanfred !
I went ahead and released 2.1.0 a few minutes ago

Thank you!