Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Update Python Versions #124

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
language: python
matrix:
include:
- python: 2.7
- python: 3.5
- python: 3.6
- python: 3.7
- python: 3.8
- python: 3.9
- python: 3.10
- python: 3.11
dist: xenial
sudo: true
- python: 3.9-dev
- python: 3.12-dev
env: FAILOK=y
dist: xenial
sudo: true
Expand Down
4 changes: 2 additions & 2 deletions HACKING.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ This is a developer's guide to modifying and maintaining `intervaltree`.

* On Linux, you will need `apt-get`.

On all systems, Python 2.6, 2.7, 3.2, 3.3, 3.4 and 3.5 are needed to run the complete test suite.
On all systems, Python 3.7 thru 3.12 are needed to run the complete test suite.

### Single version of Python

Expand Down Expand Up @@ -87,7 +87,7 @@ The two commands above run all the available tests on all versions of Python sup

The first time you run `make`, you may be asked for your password. This is in order to install `pandoc`, a tool used for processing the README file.

Running all tests requires that you have all the supported versions of Python installed. These are 2.6, 2.7, 3.2, 3.3, 3.4 and 3.5. Try to use your package manager to install them if possible. Otherwise, go to [python.org/downloads][] and install them manually.
Running all tests requires that you have all the supported versions of Python installed. These are 3.7 thru 3.12. Try to use your package manager to install them if possible. Otherwise, go to [python.org/downloads][] and install them manually.
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some of the wording here is out of date because now we use pyenv in the Makefile. But I wanted to keep the scope of the PR minimal and just change references to the Python versions.


#### Single version of Python

Expand Down
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ TEMPS=$(shell \
-o \( -type d -name '__pycache__' \) \
)

PYTHONS:=2.7.18 3.5.9 3.6.11 3.7.8 3.8.5
# See https://devguide.python.org/versions
# Use every version that is not end-of-life.
PYTHONS:=3.7.16 3.8.16 3.9.16 3.10.9 3.11.1 3.12.0a4
PYTHON_MAJORS:=$(shell \
echo "$(PYTHONS)" | \
tr ' ' '\n' | cut -d. -f1 | \
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
intervaltree
============

A mutable, self-balancing interval tree for Python 2 and 3. Queries may be by point, by range overlap, or by range envelopment.
A mutable, self-balancing interval tree for Python. Queries may be by point, by range overlap, or by range envelopment.

This library was designed to allow tagging text and time intervals, where the intervals include the lower bound but not the upper bound.

Expand All @@ -26,7 +26,7 @@ pip install intervaltree
Features
--------

* Supports Python 2.7 and Python 3.5+ (Tested under 2.7, and 3.5 thru 3.8)
* Supports Python 3.7+ (Tested under 3.7 thru 3.12)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The wording here isn't exactly symmetrical to the old version where 3.9 was in development, but we are testing 3.12 so I thought this was Ok to say.

* Initializing
* blank `tree = IntervalTree()`
* from an iterable of `Interval` objects (`tree = IntervalTree(intervals)`)
Expand Down
2 changes: 1 addition & 1 deletion intervaltree/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-

"""
intervaltree: A mutable, self-balancing interval tree for Python 2 and 3.
intervaltree: A mutable, self-balancing interval tree for Python.
Queries may be by point, by range overlap, or by range envelopment.

Root package.
Expand Down
2 changes: 1 addition & 1 deletion intervaltree/interval.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-

"""
intervaltree: A mutable, self-balancing interval tree for Python 2 and 3.
intervaltree: A mutable, self-balancing interval tree for Python.
Queries may be by point, by range overlap, or by range envelopment.

Interval class
Expand Down
17 changes: 4 additions & 13 deletions intervaltree/intervaltree.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-

"""
intervaltree: A mutable, self-balancing interval tree for Python 2 and 3.
intervaltree: A mutable, self-balancing interval tree for Python.
Queries may be by point, by range overlap, or by range envelopment.

Core logic.
Expand All @@ -26,19 +26,10 @@
from .node import Node
from numbers import Number
from sortedcontainers import SortedDict
from collections.abc import MutableSet
from copy import copy
from warnings import warn

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

try:
xrange # Python 2?
except NameError: # pragma: no cover
xrange = range


# noinspection PyBroadException
class IntervalTree(MutableSet):
Expand Down Expand Up @@ -900,7 +891,7 @@ def envelop(self, begin, end=None):
bound_end = boundary_table.bisect_left(end) # up to, but not including end
result.update(root.search_overlap(
# slice notation is slightly slower
boundary_table.keys()[index] for index in xrange(bound_begin, bound_end)
boundary_table.keys()[index] for index in range(bound_begin, bound_end)
))

# TODO: improve envelop() to use node info instead of less-efficient filtering
Expand Down Expand Up @@ -934,7 +925,7 @@ def overlap(self, begin, end=None):
bound_end = boundary_table.bisect_left(end) # up to, but not including end
result.update(root.search_overlap(
# slice notation is slightly slower
boundary_table.keys()[index] for index in xrange(bound_begin, bound_end)
boundary_table.keys()[index] for index in range(bound_begin, bound_end)
))
return result

Expand Down
2 changes: 1 addition & 1 deletion intervaltree/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-

"""
intervaltree: A mutable, self-balancing interval tree for Python 2 and 3.
intervaltree: A mutable, self-balancing interval tree for Python.
Queries may be by point, by range overlap, or by range envelopment.

Core logic: internal tree nodes.
Expand Down
12 changes: 5 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-

"""
intervaltree: A mutable, self-balancing interval tree for Python 2 and 3.
intervaltree: A mutable, self-balancing interval tree for Python.
Queries may be by point, by range overlap, or by range envelopment.

Distribution logic
Expand All @@ -24,7 +24,6 @@
See the License for the specific language governing permissions and
limitations under the License.
"""
from __future__ import absolute_import
import io
import os
from sys import exit
Expand Down Expand Up @@ -82,7 +81,7 @@ def run_tests(self):
name='intervaltree',
version=vinfo['version'],
install_requires=['sortedcontainers >= 2.0, < 3.0'],
description='Editable interval tree data structure for Python 2 and 3',
description='Editable interval tree data structure for Python',
long_description=long_description,
long_description_content_type='text/markdown',
classifiers=[ # Get strings from http://pypi.python.org/pypi?%3Aaction=list_classifiers
Expand All @@ -92,13 +91,12 @@ def run_tests(self):
'Intended Audience :: Information Technology',
'Intended Audience :: Science/Research',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'License :: OSI Approved :: Apache Software License',
'Topic :: Scientific/Engineering :: Artificial Intelligence',
'Topic :: Scientific/Engineering :: Bio-Informatics',
Expand Down
2 changes: 1 addition & 1 deletion test/interval_methods/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
intervaltree: A mutable, self-balancing interval tree for Python 2 and 3.
intervaltree: A mutable, self-balancing interval tree for Python.
Queries may be by point, by range overlap, or by range envelopment.

Test module: Interval methods
Expand Down
2 changes: 1 addition & 1 deletion test/interval_methods/binary_test.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
intervaltree: A mutable, self-balancing interval tree for Python 2 and 3.
intervaltree: A mutable, self-balancing interval tree for Python.
Queries may be by point, by range overlap, or by range envelopment.

Test module: Intervals, methods on two intervals
Expand Down
2 changes: 1 addition & 1 deletion test/interval_methods/sorting_test.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
intervaltree: A mutable, self-balancing interval tree for Python 2 and 3.
intervaltree: A mutable, self-balancing interval tree for Python.
Queries may be by point, by range overlap, or by range envelopment.

Test module: Intervals, sorting methods
Expand Down
2 changes: 1 addition & 1 deletion test/interval_methods/unary_test.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
intervaltree: A mutable, self-balancing interval tree for Python 2 and 3.
intervaltree: A mutable, self-balancing interval tree for Python.
Queries may be by point, by range overlap, or by range envelopment.

Test module: Intervals, methods on self only
Expand Down
17 changes: 4 additions & 13 deletions test/intervals.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
intervaltree: A mutable, self-balancing interval tree for Python 2 and 3.
intervaltree: A mutable, self-balancing interval tree for Python.
Queries may be by point, by range overlap, or by range envelopment.

Test module: utilities to generate intervals
Expand All @@ -18,21 +18,12 @@
See the License for the specific language governing permissions and
limitations under the License.
"""
from __future__ import absolute_import
from intervaltree import Interval
from pprint import pprint
from random import randint, choice
from test.progress_bar import ProgressBar
import os
try:
xrange
except NameError:
xrange = range

try:
unicode
except NameError:
unicode = str

def make_iv(begin, end, label=False):
if label:
Expand All @@ -49,7 +40,7 @@ def nogaps_rand(size=100, labels=False):
"""
cur = -50
result = []
for i in xrange(size):
for i in range(size):
length = randint(1, 10)
result.append(make_iv(cur, cur + length, labels))
cur += length
Expand All @@ -65,7 +56,7 @@ def gaps_rand(size=100, labels=False):
"""
cur = -50
result = []
for i in xrange(size):
for i in range(size):
length = randint(1, 10)
if choice([True, False]):
cur += length
Expand Down Expand Up @@ -114,7 +105,7 @@ def trepr(s):
if docstring:
f.write(trepr(docstring))
f.write('\n')
if isinstance(imports, (str, unicode)):
if isinstance(imports, str):
f.write(imports)
f.write('\n\n')
elif isinstance(imports, (list, tuple, set)):
Expand Down
2 changes: 1 addition & 1 deletion test/intervaltree_methods/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
intervaltree: A mutable, self-balancing interval tree for Python 2 and 3.
intervaltree: A mutable, self-balancing interval tree for Python.
Queries may be by point, by range overlap, or by range envelopment.

Test module: IntervalTree methods
Expand Down
8 changes: 2 additions & 6 deletions test/intervaltree_methods/copy_test.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
intervaltree: A mutable, self-balancing interval tree for Python 2 and 3.
intervaltree: A mutable, self-balancing interval tree for Python.
Queries may be by point, by range overlap, or by range envelopment.

Test module: IntervalTree, Copying
Expand All @@ -18,13 +18,9 @@
See the License for the specific language governing permissions and
limitations under the License.
"""
from __future__ import absolute_import
from intervaltree import Interval, IntervalTree
from test import data
try:
import cPickle as pickle
except ImportError:
import pickle
import pickle


def test_copy():
Expand Down
8 changes: 2 additions & 6 deletions test/intervaltree_methods/debug_test.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
intervaltree: A mutable, self-balancing interval tree for Python 2 and 3.
intervaltree: A mutable, self-balancing interval tree for Python.
Queries may be by point, by range overlap, or by range envelopment.

Test module: IntervalTree, Basic query methods (read-only)
Expand All @@ -18,15 +18,11 @@
See the License for the specific language governing permissions and
limitations under the License.
"""
from __future__ import absolute_import
from intervaltree import Interval, IntervalTree
import pytest
from test import data
from pprint import pprint, pformat
try:
import cPickle as pickle
except ImportError:
import pickle
import pickle


def test_print_empty():
Expand Down
8 changes: 2 additions & 6 deletions test/intervaltree_methods/delete_test.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
intervaltree: A mutable, self-balancing interval tree for Python 2 and 3.
intervaltree: A mutable, self-balancing interval tree for Python.
Queries may be by point, by range overlap, or by range envelopment.

Test module: IntervalTree, Basic deletion methods
Expand All @@ -18,14 +18,10 @@
See the License for the specific language governing permissions and
limitations under the License.
"""
from __future__ import absolute_import
from intervaltree import Interval, IntervalTree
import pytest
from test import data, match
try:
import cPickle as pickle
except ImportError:
import pickle
import pickle


def test_delete():
Expand Down
9 changes: 2 additions & 7 deletions test/intervaltree_methods/init_test.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
intervaltree: A mutable, self-balancing interval tree for Python 2 and 3.
intervaltree: A mutable, self-balancing interval tree for Python.
Queries may be by point, by range overlap, or by range envelopment.

Test module: IntervalTree, initialization methods
Expand All @@ -18,14 +18,9 @@
See the License for the specific language governing permissions and
limitations under the License.
"""
from __future__ import absolute_import
from intervaltree import Interval, IntervalTree
import pytest

try:
import cPickle as pickle
except ImportError:
import pickle
import pickle


def test_empty_init():
Expand Down
8 changes: 2 additions & 6 deletions test/intervaltree_methods/insert_test.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
intervaltree: A mutable, self-balancing interval tree for Python 2 and 3.
intervaltree: A mutable, self-balancing interval tree for Python.
Queries may be by point, by range overlap, or by range envelopment.

Test module: IntervalTree, Basic insertion methods
Expand All @@ -18,14 +18,10 @@
See the License for the specific language governing permissions and
limitations under the License.
"""
from __future__ import absolute_import
from intervaltree import Interval, IntervalTree
import pytest
from test import data, match
try:
import cPickle as pickle
except ImportError:
import pickle
import pickle


def test_insert():
Expand Down
Loading