Skip to content

Commit

Permalink
Bump supported Python version (#151)
Browse files Browse the repository at this point in the history
* bump versions for github actions

* fix pkg_resources deprecation warning (#150)

* bump requirement versions

* fix error message checking to work with Py 3.12

---------

Co-authored-by: Radik Islamov <vizid1337@gmail.com>
  • Loading branch information
mammothb and ViZiD authored Mar 21, 2024
1 parent 19f3a45 commit 8b45841
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 23 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
python-version: ["3.7", "3.8", "3.9", "3.10"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4.5.0
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/weekly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.7", "3.8", "3.9", "3.10"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v3
Expand Down
6 changes: 4 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
editdistpy>=0.1.3

# For testing
coverage==6.1.2
coverage==7.4.4
importlib-resources>=6.3.2
numpy>=1.19.5
pytest-cov==3.0.0
pytest==8.1.1
pytest-cov==4.1.0
5 changes: 3 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,17 @@ classifiers =
License :: OSI Approved :: MIT License
Programming Language :: Python
Programming Language :: Python :: 3
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
Programming Language :: Python :: 3.12

[options]
zip_safe = False
include_package_data = True
packages = find:
python_requires = >=3.7
python_requires = >=3.8
install_requires =
editdistpy>=0.1.3

Expand Down
17 changes: 8 additions & 9 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import json
from pathlib import Path

import pkg_resources
import importlib_resources
import pytest

from symspellpy import SymSpell
Expand All @@ -13,17 +13,15 @@
#######################################################################
@pytest.fixture
def bigram_path():
return pkg_resources.resource_filename(
"symspellpy", "frequency_bigramdictionary_en_243_342.txt"
)

ref = importlib_resources.files("symspellpy") / "frequency_bigramdictionary_en_243_342.txt"
with importlib_resources.as_file(ref) as path:
yield path

@pytest.fixture
def dictionary_path():
return pkg_resources.resource_filename(
"symspellpy", "frequency_dictionary_en_82_765.txt"
)

ref = importlib_resources.files("symspellpy") / "frequency_dictionary_en_82_765.txt"
with importlib_resources.as_file(ref) as path:
yield path

@pytest.fixture
def pickle_path():
Expand Down Expand Up @@ -90,3 +88,4 @@ def symspell_short(request):
if request.param is None:
return SymSpell(1, 3)
return SymSpell(1, 3, count_threshold=request.param)

11 changes: 5 additions & 6 deletions tests/test_editdistance.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@


def expected_levenshtein(string_1, string_2, max_distance):
max_distance = int(min(2 ** 31 - 1, max_distance))
max_distance = int(min(2**31 - 1, max_distance))
len_1 = len(string_1)
len_2 = len(string_2)
d = np.zeros((len_1 + 1, len_2 + 1))
Expand All @@ -42,7 +42,7 @@ def expected_levenshtein(string_1, string_2, max_distance):


def expected_damerau_osa(string_1, string_2, max_distance):
max_distance = int(min(2 ** 31 - 1, max_distance))
max_distance = int(min(2**31 - 1, max_distance))
len_1 = len(string_1)
len_2 = len(string_2)
d = np.zeros((len_1 + 1, len_2 + 1))
Expand Down Expand Up @@ -145,10 +145,9 @@ def test_abstract_distance_comparer(self):
with pytest.raises(TypeError) as excinfo:
comparer = AbstractDistanceComparer()
_ = comparer.distance("string_1", "string_2", 10)
assert (
"Can't instantiate abstract class AbstractDistanceComparer with "
f"abstract method{'s' if sys.version_info[1] < 9 else ''} distance"
) == str(excinfo.value)
assert str(excinfo.value).startswith(
"Can't instantiate abstract class AbstractDistanceComparer"
)

def test_internal_distance_comparer(self, get_edit_distance):
edit_distance, expected = get_edit_distance
Expand Down

0 comments on commit 8b45841

Please sign in to comment.