diff --git a/bw2data/backends/typos.py b/bw2data/backends/typos.py index ab513aee..34cbd521 100644 --- a/bw2data/backends/typos.py +++ b/bw2data/backends/typos.py @@ -1,7 +1,14 @@ from typing import Iterable import warnings from functools import partial -from ..string_distance import damerau_levenshtein + +try: + from rapidfuzz.distance import DamerauLevenshtein + damerau_levenshtein = DamerauLevenshtein.distance +except ImportError: + # Can happen on Windows, see + # https://github.com/rapidfuzz/RapidFuzz/tree/main?tab=readme-ov-file#with-pip + from ..string_distance import damerau_levenshtein VALID_ACTIVITY_TYPES = ( "process", diff --git a/requirements-test.txt b/requirements-test.txt index 9be30d18..95829e3e 100644 --- a/requirements-test.txt +++ b/requirements-test.txt @@ -8,6 +8,7 @@ platformdirs pytest pytest-cov python-coveralls +rapidfuzz requests>=1.1.0 scipy stats_arrays diff --git a/requirements.txt b/requirements.txt index e405cd5f..ece43436 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,6 +5,7 @@ numpy<2 peewee>=3.9.4 platformdirs requests>=1.1.0 +rapidfuzz scipy stats_arrays tqdm diff --git a/setup.py b/setup.py index 52c751da..3f7af527 100644 --- a/setup.py +++ b/setup.py @@ -34,6 +34,7 @@ "numpy<2", "peewee>=3.9.4", "platformdirs", + "rapidfuzz", "scipy", "stats_arrays", "tqdm",