errbotio / errbot

Errbot is a chatbot, a daemon that connects to your favorite chat service and bring your tools and some fun into the conversation.
http://errbot.io
GNU General Public License v3.0
3.12k stars 614 forks source link

Use collections.abc.Mapping #1537

Closed jml closed 2 years ago

jml commented 2 years ago

Untested change to improve Python 3.10 support.

Latest release gives the following errors when run with Python 3.10:

2021-10-07 15:35:58,530 ERROR    errbot.backends.base      Exception occurred in serve_once:
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/errbot/backends/base.py", line 861, in serve_forever
    if self.serve_once():
  File "/usr/local/lib/python3.10/site-packages/errbot/backends/slack.py", line 421, in serve_once
    self.auth = self.api_call("auth.test", raise_errors=False)
  File "/usr/local/lib/python3.10/site-packages/errbot/backends/slack.py", line 378, in api_call
    if not isinstance(response, collections.Mapping):
AttributeError: module 'collections' has no attribute 'Mapping'

This change fixes the error, per the notice on https://docs.python.org/3.9/library/collections.html

nzlosh commented 2 years ago

Thank you for the time and effort to propose this patch, it is appreciated.

My initial thoughts on this are: Errbot isn't officially supported on Python 3.10 (automated testing is currently for 3.6-3.9). I doubt we'll be able to accept untested python 3.10 code piecemeal as it doesn't make sense to accept minor patches to address a much larger issue.

Python 3.10 was released as stable 4 days ago so officially supporting it should be prioritised.

@sijis what are your thoughts here?

jml commented 2 years ago

Thanks for the kind response. That totally makes sense to me. Submitting a PR was mostly my lazy way of filing an issue :)

nzlosh commented 2 years ago

I've created an official issue to support Python 3.10 https://github.com/errbotio/errbot/issues/1538

sijis commented 2 years ago

I've created an official issue to support Python 3.10 #1538

This made me look up when 3.6 is EOL, which is pretty soon. In response, i created https://github.com/errbotio/errbot/pull/1540.

Python 3.10 was released as stable 4 days ago so officially supporting it should be prioritised.

I think we should definitely start running tests in 3.10 and see what's needing to be done.

jml commented 2 years ago

Since the issue is open, I'm going to close this PR. Feel free to use the code as you see fit. Good luck!