intervaltree icon indicating copy to clipboard operation
intervaltree copied to clipboard

python 3.10 support

Open brainfo opened this issue 3 years ago • 1 comments

since collections in py 3.10 put MutableSet, MutableMapping, etc. in collections.abc insert these lines

import sys 
if sys.version_info.major == 3 and sys.version_info.minor >= 10:
    from collections.abc import MutableSet
    collections.MutableSet = collections.abc.MutableSet
else: 
    from collections import MutableSet

from https://stackoverflow.com/questions/74006130/attributeerror-module-collections-has-no-attribute-mutableset in interveltree.py would get over this version problem.

brainfo avatar Nov 11 '22 15:11 brainfo

@brainfo, I think you are using intervaltree 2.x. Since intervaltree 3.0.0 (released in 2018) the MutableSet has been imported like this:

https://github.com/chaimleib/intervaltree/blob/328d6db96596a0b7180dd3ad3fae4f6ff7301e01/intervaltree/intervaltree.py

try:
    from collections.abc import MutableSet  # Python 3?
except ImportError:
    from collections import MutableSet

We have been using intervaltree 3.1.0 on Python 3.10 and 3.11 and it has been working fine.

Jeremiah-England avatar Feb 12 '23 19:02 Jeremiah-England