Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Python 3.10 support #584

Closed
arieroos opened this issue Sep 15, 2022 · 3 comments · Fixed by #585
Closed

Python 3.10 support #584

arieroos opened this issue Sep 15, 2022 · 3 comments · Fixed by #585

Comments

@arieroos
Copy link
Contributor

Hi all

I am running Python 3.10. I installed mqttwarn using pip install.

$ python --version
Python 3.10.4

However, when I try to generate the example config, I get:

$ mqttwarn make-config > mqttwarn.ini
Traceback (most recent call last):
  File "/opt/dotsys/dos/venv/bin/mqttwarn", line 5, in <module>
    from mqttwarn.commands import run
  File "/opt/dotsys/dos/venv/lib/python3.10/site-packages/mqttwarn/commands.py", line 15, in <module>
    from mqttwarn.core import bootstrap, connect, cleanup, run_plugin
  File "/opt/dotsys/dos/venv/lib/python3.10/site-packages/mqttwarn/core.py", line 5, in <module>
    from past.builtins import cmp
  File "/opt/dotsys/dos/venv/lib/python3.10/site-packages/past/builtins/__init__.py", line 43, in <module>
    from past.builtins.noniterators import (filter, map, range, reduce, zip)
  File "/opt/dotsys/dos/venv/lib/python3.10/site-packages/past/builtins/noniterators.py", line 24, in <module>
    from past.types import basestring
  File "/opt/dotsys/dos/venv/lib/python3.10/site-packages/past/types/__init__.py", line 25, in <module>
    from .oldstr import oldstr
  File "/opt/dotsys/dos/venv/lib/python3.10/site-packages/past/types/oldstr.py", line 5, in <module>
    from collections import Iterable
ImportError: cannot import name 'Iterable' from 'collections' (/usr/lib/python3.10/collections/__init__.py)

Stackoverflow answer are saying this because of Iterable being removed from collections in Python 3.10

Will you please consider supporting Python 3.10?

@amotl
Copy link
Member

amotl commented Sep 15, 2022

Dear Arie,

thank you for writing in. In general, mqttwarn should be compatible with Python up to version 3.11, as approved by CI.

  1. There may be a hiccup on your system, what about upgrading the future package with pip install future --upgrade? It is always recommended to run such operations, also installing mqttwarn, within a Python virtualenv.
  2. @jpmens and @sumnerboy12: In the long run, I think it would be a good idea to get rid of any need for the future package completely 1, as mqttwarn now supports Python 3 only.

With kind regards,
Andreas.


P.S.: Within a newly created virtualenv, from past.builtins import cmp does not croak on my machine, even when using Python 3.10.

python3 -m venv .venv310
source .venv310/bin/activate
pip install future
python
>>> from past.builtins import cmp

Footnotes

  1. https://github.com/jpmens/mqttwarn/blob/871a381f0793b3e086609ea55fb248c6be10743b/mqttwarn/core.py#L5

@arieroos
Copy link
Contributor Author

arieroos commented Sep 15, 2022

Ah yes, it must be the future pacakge.

I had 0.17.1. This was fixed in 0.18.0: https://python-future.org/whatsnew.html#what-s-new-in-version-0-18-0-2019-10-09

https://github.com/jpmens/mqttwarn/blob/871a381f0793b3e086609ea55fb248c6be10743b/setup.py#L18
Could maybe change to 'future>=0.18.0,<1',
This change feels too small for a PR, but I'll make on if you think it's helpful.

@amotl
Copy link
Member

amotl commented Sep 15, 2022

Sweet that you have been able to fix the issue so quickly.

This change feels too small for a PR, but I'll make on if you think it's helpful.

Please do! ;]

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

Successfully merging a pull request may close this issue.

2 participants