Skip to content

Commit b9913eb

Browse files
authored
hightime: Add support for Python 3.10-3.13 and drop Python 3.7-3.8 (#44)
* hightime: Update Python versions in tox.ini * hightime: Update trove classifiers * hightime: More tox.ini updates * hightime: Use __index__ instead of __int__ `datetime` used to accept objects that implement `__int__` or `__index__`, but in Python 3.10 it was changed to accept only `__index__`. python/cpython#15636 * github: Update Python versions
1 parent c128783 commit b9913eb

File tree

6 files changed

+15
-11
lines changed

6 files changed

+15
-11
lines changed

.github/workflows/publish-to-pypi.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ jobs:
1616
steps:
1717
- uses: actions/checkout@master
1818

19-
- name: Set up Python 3.7
19+
- name: Set up Python 3.11
2020
uses: actions/setup-python@v1
2121
with:
22-
python-version: 3.7
22+
python-version: 3.11
2323

2424
- name: Install setuptools and other tools
2525
run: python3 -m pip install setuptools wheel twine

.github/workflows/test-python-package.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
strategy:
1010
max-parallel: 5
1111
matrix:
12-
python-version: [3.7, 3.8, 3.9]
12+
python-version: [3.9, '3.10', 3.11, 3.12, 3.13]
1313

1414
steps:
1515
- uses: actions/checkout@v1

hightime/_datetime.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ def _checkArg(name, value):
1414
if isinstance(value, float):
1515
raise TypeError("integer argument expected, got float")
1616
try:
17-
value = value.__int__()
17+
value = value.__index__()
1818
except AttributeError:
1919
raise TypeError(
2020
"an integer is required (got type %s)" % type(value).__name__
2121
) from None
2222
else:
2323
if not isinstance(value, int):
2424
raise TypeError(
25-
"__int__ returned non-int (type %s)" % type(value).__name__
25+
"__index__ returned non-int (type %s)" % type(value).__name__
2626
)
2727

2828
if not 0 <= value <= 999999999:

setup.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,11 @@ def get_version():
4343
"Operating System :: Microsoft :: Windows",
4444
"Operating System :: POSIX",
4545
"Programming Language :: Python :: 3",
46-
"Programming Language :: Python :: 3.7",
47-
"Programming Language :: Python :: 3.8",
4846
"Programming Language :: Python :: 3.9",
47+
"Programming Language :: Python :: 3.10",
48+
"Programming Language :: Python :: 3.11",
49+
"Programming Language :: Python :: 3.12",
50+
"Programming Language :: Python :: 3.13",
4951
"Programming Language :: Python :: Implementation :: CPython",
5052
"Programming Language :: Python :: Implementation :: PyPy",
5153
],

tests/test_datetime.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class IntLike(object):
3232
def __init__(self, value=1):
3333
self.value = value
3434

35-
def __int__(self):
35+
def __index__(self):
3636
return self.value
3737

3838

tox.ini

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# and then run "tox" from this directory.
55

66
[tox]
7-
envlist = py{37,38,39,py,py3}-test, flake8, black
7+
envlist = py{39,310,311,312,313,py,py3}-test, flake8, black
88
skip_missing_interpreters=True
99
skipsdist = true
1010
toxworkdir = .tox/{env:BITNESS:64}
@@ -15,9 +15,11 @@ description =
1515
flake8: Run static analysis
1616

1717
basepython =
18-
py37: python3.7
19-
py38: python3.8
2018
py39: python3.9
19+
py310: python3.10
20+
py311: python3.11
21+
py312: python3.12
22+
py313: python3.13
2123
pypy: pypy
2224
pypy3: pypy3
2325
flake8: python

0 commit comments

Comments
 (0)