Closed cculianu closed 2 years ago
Thanks Calin. I'm disappointed Python moved away from symantic versioning but c'est la vie. If someone would care to provide a patch I'd be happy to merge it.
Indeed. Such breakage should be at a major version, not a minor one....
Sure I will submit a PR later today when I get home. It’s a 1-line change in control.py :)
It’s a 1-line change in control.py
That depends. Did the whole collections module move to collections.abc? If so there's twelve files involved...
% grep -R 'import collections' stem
stem/client/datatype.py:import collections
stem/descriptor/__init__.py:import collections
stem/descriptor/bandwidth_file.py:import collections
stem/descriptor/hidden_service.py:import collections
stem/descriptor/networkstatus.py:import collections
stem/directory.py:import collections
stem/util/test_tools.py:import collections
stem/util/conf.py:import collections
stem/util/system.py:import collections
stem/util/connection.py:import collections
stem/control.py:import collections
stem/manual.py:import collections
Yea good point ; I’ll review the code carefully in that case.
I think just the abstract base classes moved to abc, and not all of it.
But yes I will review the code. Thanks for tip.
The list of names that were moved to abc
:
AsyncGenerator
AsyncIterable
AsyncIterator
Awaitable
ByteString
Callable
Collection
Container
Coroutine
Generator
Hashable
ItemsView
Iterable
Iterator
KeysView
Mapping
MappingView
MutableMapping
MutableSequence
MutableSet
Reversible
Sequence
Set
Sized
ValuesView
The list of names from above that are being referred to as collections.<name>
:
$ grep -Er '(collections.AsyncGenerator)|(collections.AsyncIterable)|(collections.AsyncIterator)|(collections.Awaitable)|(collections.ByteString)|(collections.Callable)|(collections.Collection)|(collections.Container)|(collections.Coroutine)|(collections.Generator)|(collections.Hashable)|(collections.ItemsView)|(collections.Iterable)|(collections.Iterator)|(collections.KeysView)|(collections.Mapping)|(collections.MappingView)|(collections.MutableMapping)|(collections.MutableSequence)|(collections.MutableSet)|(collections.Reversible)|(collections.Sequence)|(collections.Set)|(collections.Sized)|(collections.ValuesView)' stem
stem/control.py: elif isinstance(value, collections.Iterable):
So yes.. I think it very well is a 1-line change. Will submit PR now. :)
Question: The new names appear in abc
since 3.3. stem doesn't happen to support python before 3.3... does it?
So yes.. I think it very well is a 1-line change. Will submit PR now. :)
Great! Thanks. :)
Question: The new names appear in abc since 3.3. stem doesn't happen to support python before 3.3... does it?
Nope, Stem's master branch supports 3.6+.
Ok, PR opened: #110.
Nope, Stem's master branch supports 3.6+.
Oh. LOL. I thought you supported older pythons.. your tox.ini
needs updating then. :)
Wait -- if it's 3.6+ only then I can simplify my PR.. hmm.
Wait -- if it's 3.6+ only then I can simplify my PR.. hmm.
Yup. Rather than doing a version check lets simply swap over to collections.abc. Please use the full name (rather than a 'from x' import).
Wait -- if it's 3.6+ only then I can simplify my PR.. hmm.
Yup. Rather than doing a version check lets simply swap over to collections.abc. Please use the full name (rather than a 'from x' import).
Agreed. Already done.
Thanks! Merged.
Python 3.10 took out
collections.Iterable
(now lives incollections.abc.Iterable
), yetcontrol.py
in this package refers to that name.So
control.py
fails to import, and thus the whole package fails on Python 3.10.See: https://docs.python.org/3.9/library/collections.html