Skip to content

Commit ed25438

Browse files
committed
upgrade requirements and drop 3.9 compatibility
1 parent 5e5384d commit ed25438

7 files changed

Lines changed: 35 additions & 62 deletions

File tree

.github/workflows/mypy-and-pylint.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
- uses: actions/checkout@v4
1212
- uses: actions/setup-python@v5
1313
with:
14-
python-version: '3.10'
14+
python-version: '3.12'
1515
- run: pip install --upgrade pip
1616
- run: pip install .[dev]
1717
- run: mypy $(git ls-files 'countess/*.py')
@@ -22,7 +22,7 @@ jobs:
2222
- uses: actions/checkout@v4
2323
- uses: actions/setup-python@v5
2424
with:
25-
python-version: '3.10'
25+
python-version: '3.12'
2626
- run: pip install --upgrade pip
2727
- run: pip install .[dev]
2828
- run: pylint $(git ls-files 'countess/*.py')

.github/workflows/run-tests-push.yml

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,6 @@ on:
33
push:
44

55
jobs:
6-
run-tests-ubuntu-22_04-python-3_9:
7-
runs-on: ubuntu-22.04
8-
name: Ubuntu 22.04, Python 3.9
9-
steps:
10-
- uses: actions/checkout@v4
11-
- uses: actions/setup-python@v5
12-
with:
13-
python-version: "3.9"
14-
cache: 'pip'
15-
- run: sudo apt install xvfb
16-
- run: pip install --upgrade pip
17-
- run: pip install .[dev]
18-
- run: xvfb-run pytest -v -rP --doctest-modules countess/ tests/
19-
206
run-tests-ubuntu-22_04-python-3_10:
217
runs-on: ubuntu-22.04
228
name: Ubuntu 22.04, Python 3.10

countess/core/parameters.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1010,11 +1010,7 @@ def __getattr__(self, name):
10101010
try:
10111011
return self.params[name]
10121012
except KeyError as exc:
1013-
try:
1014-
raise AttributeError(name=name, obj=self) from exc
1015-
except TypeError: # pragma: no cover
1016-
# 3.9 doesn't have name and obj attributes
1017-
raise AttributeError() from exc
1013+
raise AttributeError(name=name, obj=self) from exc
10181014

10191015
def __setattr__(self, name, value):
10201016
"""Intercepts attempts to set parameters to a value and turns them into parameter.set_value.

countess/core/plugins.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,7 @@
4747

4848
def get_plugin_classes() -> Iterable[Type["BasePlugin"]]:
4949
plugin_classes = set()
50-
try:
51-
# Python >= 3.10
52-
entry_points = importlib.metadata.entry_points().select(group="countess_plugins")
53-
except AttributeError:
54-
# Python < 3.10
55-
entry_points = importlib.metadata.entry_points()["countess_plugins"]
50+
entry_points = importlib.metadata.entry_points().select(group="countess_plugins")
5651

5752
for ep in entry_points:
5853
try:

countess/plugins/python.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import logging
33
import math
44
import re
5-
from types import BuiltinFunctionType, FunctionType, ModuleType
5+
from types import BuiltinFunctionType, FunctionType, ModuleType, NoneType
66
from typing import Any, Optional
77

88
import numpy as np
@@ -13,9 +13,6 @@
1313

1414
logger = logging.getLogger(__name__)
1515

16-
# For 3.9 compatibility
17-
NoneType = type(None)
18-
1916
# XXX pretty sure this is a job for ast.parse rather than just
2017
# running compile() and exec() but that can wait.
2118
# Builtins are restricted but there's still plenty of things which

pyproject.toml

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ maintainers = [
1010
{ name = "Nick Moore", email="nick@zoic.org" },
1111
]
1212
description = "CountESS"
13-
requires-python = ">=3.9"
13+
requires-python = ">=3.10"
1414
classifiers = [
1515
'Development Status :: 3 - Alpha',
1616
'Intended Audience :: Science/Research',
@@ -19,37 +19,37 @@ classifiers = [
1919
]
2020
dependencies = [
2121
'dnaio~=1.2.3',
22-
'duckdb>=1.3.1',
22+
'duckdb~=1.3.1',
2323
'fqfa~=1.3.1',
24-
'more_itertools~=9.1.0',
25-
'numpy~=1.26',
26-
'pandas~=2.2.3',
27-
'psutil~=5.9.5',
24+
'more_itertools~=10.7.0',
25+
'numpy~=2.3.1',
26+
'pandas~=2.3.0',
27+
'psutil~=7.0.0',
2828
'pyarrow~=20.0.0',
29-
'rapidfuzz~=3.13',
30-
'scipy~=1.15.3',
31-
'tkinterweb~=3.23.5',
29+
'rapidfuzz~=3.13.0',
30+
'scipy~=1.16.0',
31+
'tkinterweb~=4.3.1',
3232
'ttkthemes~=3.2.2',
33-
'typing_extensions~=4.8.0',
33+
'typing_extensions~=4.14.0',
3434
]
3535

3636
[project.optional-dependencies]
3737
dev = [
3838
'black<24',
39-
'build==1.2.2',
40-
'coverage==7.3.2',
41-
'mypy~=1.0.1',
42-
'pylint~=3.2.3',
39+
'build~=1.2.2',
40+
'coverage~=7.9.1',
41+
'mypy~=1.16.1',
42+
'pylint~=3.3.7',
4343
'semver~=3.0.2',
44-
'types-psutil~=5.9.5',
45-
'types-ttkthemes~=3.2',
44+
'types-psutil~=7.0.0',
45+
'types-ttkthemes~=3.2.4',
4646
'twine~=6.1.0',
4747
'packaging~=25.0',
48-
'pandas-stubs~=2.1.0',
48+
'pandas-stubs~=2.2.3',
4949
'pyarrow-stubs~=20.0.0',
50-
'pytest~=7.2',
51-
'pytest-socket~=0.6.0',
52-
'requests-mock~=1.11.0',
50+
'pytest~=8.4.1',
51+
'pytest-socket~=0.7.0',
52+
'requests-mock~=1.12.1',
5353
]
5454

5555
[project.entry-points.countess_plugins]
@@ -133,6 +133,6 @@ markers = [ "slow", "gui" ]
133133

134134
[tool.mypy]
135135
plugins = [
136-
"numpy.typing.mypy_plugin",
136+
# "numpy.typing.mypy_plugin",
137137
]
138138
mypy_path = "mypy_stubs"

tests/test_plugins.py

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,30 +3,29 @@
33

44
from countess.core.plugins import get_plugin_classes
55

6-
empty_entry_points_dict = {"countess_plugins": []}
7-
8-
invalid_entry_points_dict = {
9-
"countess_plugins": [importlib.metadata.EntryPoint(name="test", value="mockplugin", group="countess_plugins")]
10-
}
6+
empty_entry_points = importlib.metadata.EntryPoints()
117

8+
invalid_entry_points = importlib.metadata.EntryPoints((
9+
importlib.metadata.EntryPoint(name="test", value="mockplugin", group="countess_plugins"),
10+
))
1211

1312
class NoParentPlugin:
1413
pass
1514

1615

17-
noparent_entry_points_dict = {
18-
"countess_plugins": [importlib.metadata.EntryPoint(name="test", value="NoParentPlugin", group="countess_plugins")]
19-
}
16+
noparent_entry_points = importlib.metadata.EntryPoints((
17+
importlib.metadata.EntryPoint(name="test", value="NoParentPlugin", group="countess_plugins"),
18+
))
2019

2120

2221
def test_get_plugin_classes_invalid(caplog):
23-
with patch("importlib.metadata.entry_points", lambda: invalid_entry_points_dict):
22+
with patch("importlib.metadata.entry_points", lambda: invalid_entry_points):
2423
get_plugin_classes()
2524
assert "could not be loaded" in caplog.text
2625

2726

2827
def test_get_plugin_classes_wrongparent(caplog):
29-
with patch("importlib.metadata.entry_points", lambda: noparent_entry_points_dict):
28+
with patch("importlib.metadata.entry_points", lambda: noparent_entry_points):
3029
with patch("importlib.metadata.EntryPoint.load", lambda x: NoParentPlugin):
3130
get_plugin_classes()
3231
assert "not a valid CountESS plugin" in caplog.text

0 commit comments

Comments
 (0)