Tenma-Server / Tenma

Comic book server with in-browser reader
MIT License
252 stars 31 forks source link

Suggest to loosen the dependency on fuzzywuzzy #72

Open Agnes-U opened 1 year ago

Agnes-U commented 1 year ago

Hi, your project Tenma requires "fuzzywuzzy==0.15.1" in its dependency. After analyzing the source code, we found that some other versions of fuzzywuzzy can also be suitable without affecting your project, i.e., fuzzywuzzy 0.8.0, 0.8.1, 0.8.2, 0.9.0, 0.10.0, 0.11.0, 0.11.1, 0.12.0, 0.13.0, 0.14.0, 0.15.0, 0.16.0, 0.17.0, 0.18.0. Therefore, we suggest to loosen the dependency on fuzzywuzzy from "fuzzywuzzy==0.15.1" to "fuzzywuzzy>=0.8.0,<=0.18.0" to avoid any possible conflict for importing more packages or for downstream projects that may use Tenma.

May I pull a request to loosen the dependency on fuzzywuzzy?

By the way, could you please tell us whether such dependency analysis may be potentially helpful for maintaining dependencies easier during your development?



For your reference, here are details in our analysis.

Your project Tenma(commit id: 396a3daa14bff15a889aafb15f49158da9ea4956) directly uses 2 APIs from package fuzzywuzzy.

fuzzywuzzy.fuzz.partial_ratio, fuzzywuzzy.fuzz.ratio

From which, 11 functions are then indirectly called, including 7 fuzzywuzzy's internal APIs and 4 outsider APIs, as follows (neglecting some repeated function occurrences).

[/Tenma-Server/Tenma]
+--fuzzywuzzy.fuzz.partial_ratio
|      +--fuzzywuzzy.utils.make_type_consistent
|      +--difflib.SequenceMatcher
|      +--fuzzywuzzy.StringMatcher.StringMatcher.__init__
|      |      +--warnings.warn
|      |      +--fuzzywuzzy.StringMatcher.StringMatcher._reset_cache
|      +--difflib.SequenceMatcher.get_matching_blocks
|      +--fuzzywuzzy.StringMatcher.StringMatcher.get_matching_blocks
|      |      +--fuzzywuzzy.StringMatcher.StringMatcher.get_opcodes
|      +--difflib.SequenceMatcher.ratio
|      +--fuzzywuzzy.StringMatcher.StringMatcher.ratio
|      +--fuzzywuzzy.utils.intr
+--fuzzywuzzy.fuzz.ratio
|      +--fuzzywuzzy.utils.make_type_consistent
|      +--difflib.SequenceMatcher
|      +--fuzzywuzzy.StringMatcher.StringMatcher.__init__
|      +--fuzzywuzzy.utils.intr
|      +--difflib.SequenceMatcher.ratio
|      +--fuzzywuzzy.StringMatcher.StringMatcher.ratio

We scan fuzzywuzzy's versions among [0.8.0, 0.8.1, 0.8.2, 0.9.0, 0.10.0, 0.11.0, 0.11.1, 0.12.0, 0.13.0, 0.14.0, 0.15.0, 0.16.0, 0.17.0, 0.18.0] and 0.15.1, the changing functions (diffs being listed below) have none intersection with any function or API we mentioned above (either directly or indirectly called by this project).

diff: 0.15.1(original) 0.8.0
['fuzzywuzzy.fuzz.token_sort_ratio', 'fuzzywuzzy.process.extract', 'fuzzywuzzy.fuzz.QRatio', 'fuzzywuzzy.process.extractOne', 'fuzzywuzzy.utils.check_for_none', 'fuzzywuzzy.fuzz.UWRatio', 'fuzzywuzzy.fuzz._token_set', 'fuzzywuzzy.fuzz.partial_token_set_ratio', 'fuzzywuzzy.fuzz.WRatio', 'fuzzywuzzy.fuzz.UQRatio', 'fuzzywuzzy.fuzz._process_and_sort', 'fuzzywuzzy.process.extractWithoutOrder', 'fuzzywuzzy.utils.validate_string', 'fuzzywuzzy.process.extractBests', 'fuzzywuzzy.string_processing.StringProcessor.replace_non_letters_non_numbers_with_whitespace', 'fuzzywuzzy.string_processing.StringProcessor', 'fuzzywuzzy.fuzz.token_set_ratio', 'fuzzywuzzy.fuzz._token_sort', 'fuzzywuzzy.fuzz.partial_token_sort_ratio']

diff: 0.15.1(original) 0.8.1
['fuzzywuzzy.fuzz.token_sort_ratio', 'fuzzywuzzy.process.extract', 'fuzzywuzzy.fuzz.QRatio', 'fuzzywuzzy.process.extractOne', 'fuzzywuzzy.utils.check_for_none', 'fuzzywuzzy.fuzz.UWRatio', 'fuzzywuzzy.fuzz._token_set', 'fuzzywuzzy.fuzz.partial_token_set_ratio', 'fuzzywuzzy.fuzz.WRatio', 'fuzzywuzzy.fuzz.UQRatio', 'fuzzywuzzy.fuzz._process_and_sort', 'fuzzywuzzy.process.extractWithoutOrder', 'fuzzywuzzy.utils.validate_string', 'fuzzywuzzy.process.extractBests', 'fuzzywuzzy.string_processing.StringProcessor.replace_non_letters_non_numbers_with_whitespace', 'fuzzywuzzy.string_processing.StringProcessor', 'fuzzywuzzy.fuzz.token_set_ratio', 'fuzzywuzzy.fuzz._token_sort', 'fuzzywuzzy.fuzz.partial_token_sort_ratio']

diff: 0.15.1(original) 0.8.2
['fuzzywuzzy.fuzz.token_sort_ratio', 'fuzzywuzzy.process.extract', 'fuzzywuzzy.fuzz.QRatio', 'fuzzywuzzy.process.extractOne', 'fuzzywuzzy.utils.check_for_none', 'fuzzywuzzy.fuzz.UWRatio', 'fuzzywuzzy.fuzz._token_set', 'fuzzywuzzy.fuzz.partial_token_set_ratio', 'fuzzywuzzy.fuzz.WRatio', 'fuzzywuzzy.fuzz.UQRatio', 'fuzzywuzzy.fuzz._process_and_sort', 'fuzzywuzzy.process.extractWithoutOrder', 'fuzzywuzzy.utils.validate_string', 'fuzzywuzzy.process.extractBests', 'fuzzywuzzy.string_processing.StringProcessor.replace_non_letters_non_numbers_with_whitespace', 'fuzzywuzzy.string_processing.StringProcessor', 'fuzzywuzzy.fuzz.token_set_ratio', 'fuzzywuzzy.fuzz._token_sort', 'fuzzywuzzy.fuzz.partial_token_sort_ratio']

diff: 0.15.1(original) 0.9.0
['fuzzywuzzy.process.extractBests', 'fuzzywuzzy.fuzz._token_set', 'fuzzywuzzy.fuzz.partial_token_set_ratio', 'fuzzywuzzy.fuzz.token_sort_ratio', 'fuzzywuzzy.fuzz.WRatio', 'fuzzywuzzy.process.extractOne', 'fuzzywuzzy.utils.check_for_none', 'fuzzywuzzy.fuzz.UQRatio', 'fuzzywuzzy.fuzz.UWRatio', 'fuzzywuzzy.process.extract', 'fuzzywuzzy.fuzz.token_set_ratio', 'fuzzywuzzy.fuzz._process_and_sort', 'fuzzywuzzy.fuzz.QRatio', 'fuzzywuzzy.process.extractWithoutOrder', 'fuzzywuzzy.fuzz._token_sort', 'fuzzywuzzy.utils.validate_string', 'fuzzywuzzy.fuzz.partial_token_sort_ratio']

diff: 0.15.1(original) 0.10.0
['fuzzywuzzy.process.extractBests', 'fuzzywuzzy.fuzz._token_set', 'fuzzywuzzy.fuzz.partial_token_set_ratio', 'fuzzywuzzy.fuzz.token_sort_ratio', 'fuzzywuzzy.fuzz.WRatio', 'fuzzywuzzy.process.extractOne', 'fuzzywuzzy.fuzz.UQRatio', 'fuzzywuzzy.fuzz.UWRatio', 'fuzzywuzzy.process.extract', 'fuzzywuzzy.fuzz.token_set_ratio', 'fuzzywuzzy.fuzz._process_and_sort', 'fuzzywuzzy.fuzz.QRatio', 'fuzzywuzzy.process.extractWithoutOrder', 'fuzzywuzzy.fuzz._token_sort', 'fuzzywuzzy.utils.validate_string', 'fuzzywuzzy.fuzz.partial_token_sort_ratio']

diff: 0.15.1(original) 0.11.0
['fuzzywuzzy.process.extractBests', 'fuzzywuzzy.fuzz.WRatio', 'fuzzywuzzy.process.extractOne', 'fuzzywuzzy.fuzz.UQRatio', 'fuzzywuzzy.fuzz.UWRatio', 'fuzzywuzzy.process.extract', 'fuzzywuzzy.fuzz.QRatio', 'fuzzywuzzy.process.extractWithoutOrder', 'fuzzywuzzy.utils.validate_string']

diff: 0.15.1(original) 0.11.1
['fuzzywuzzy.process.extractBests', 'fuzzywuzzy.fuzz.WRatio', 'fuzzywuzzy.process.extractOne', 'fuzzywuzzy.fuzz.UQRatio', 'fuzzywuzzy.fuzz.UWRatio', 'fuzzywuzzy.process.extract', 'fuzzywuzzy.fuzz.QRatio', 'fuzzywuzzy.process.extractWithoutOrder', 'fuzzywuzzy.utils.validate_string']

diff: 0.15.1(original) 0.12.0
['fuzzywuzzy.process.extractBests', 'fuzzywuzzy.fuzz.WRatio', 'fuzzywuzzy.process.extractOne', 'fuzzywuzzy.fuzz.UQRatio', 'fuzzywuzzy.fuzz.UWRatio', 'fuzzywuzzy.process.extract', 'fuzzywuzzy.fuzz.QRatio', 'fuzzywuzzy.process.extractWithoutOrder', 'fuzzywuzzy.utils.validate_string']

diff: 0.15.1(original) 0.13.0
['fuzzywuzzy.fuzz.WRatio', 'fuzzywuzzy.fuzz.UQRatio', 'fuzzywuzzy.fuzz.UWRatio', 'fuzzywuzzy.process.extract', 'fuzzywuzzy.fuzz.QRatio', 'fuzzywuzzy.process.extractWithoutOrder', 'fuzzywuzzy.utils.validate_string']

diff: 0.15.1(original) 0.14.0
['fuzzywuzzy.fuzz.WRatio', 'fuzzywuzzy.fuzz.UQRatio', 'fuzzywuzzy.fuzz.UWRatio', 'fuzzywuzzy.process.extract', 'fuzzywuzzy.fuzz.QRatio', 'fuzzywuzzy.process.extractWithoutOrder', 'fuzzywuzzy.utils.validate_string']

diff: 0.15.1(original) 0.15.0
['fuzzywuzzy.fuzz.WRatio', 'fuzzywuzzy.fuzz.UWRatio', 'fuzzywuzzy.fuzz.UQRatio', 'fuzzywuzzy.process.extract', 'fuzzywuzzy.fuzz.QRatio', 'fuzzywuzzy.process.extractWithoutOrder']

diff: 0.15.1(original) 0.16.0
['fuzzywuzzy.process.extract', 'fuzzywuzzy.process.extractWithoutOrder']

diff: 0.15.1(original) 0.17.0
['fuzzywuzzy.fuzz._token_set', 'fuzzywuzzy.utils.check_for_equivalence', 'fuzzywuzzy.process.extract', 'fuzzywuzzy.process.extractWithoutOrder', 'fuzzywuzzy.utils.full_process']

diff: 0.15.1(original) 0.18.0
['fuzzywuzzy.fuzz._token_set', 'fuzzywuzzy.utils.check_for_equivalence', 'fuzzywuzzy.process.extract', 'fuzzywuzzy.process.extractWithoutOrder', 'fuzzywuzzy.utils.full_process']

As for other packages, the APIs of @outside_package_name are called by fuzzywuzzy in the call graph and the dependencies on these packages also stay the same in our suggested versions, thus avoiding any outside conflict.

Therefore, we believe that it is quite safe to loose your dependency on fuzzywuzzy from "fuzzywuzzy==0.15.1" to "fuzzywuzzy>=0.8.0,<=0.18.0". This will improve the applicability of Tenma and reduce the possibility of any further dependency conflict with other projects/packages.