This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author maxbachmann
Recipients maxbachmann
Date 2022-03-05.22:26:32
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1646519192.38.0.0729050305481.issue46935@roundup.psfhosted.org>
In-reply-to
Content
In my environment I installed the following two libraries:
```
pip install rapidfuzz
pip install python-Levenshtein
```
Those two libraries have the following structures:
rapidfuzz
|-distance
  |- __init__.py (from . import Levenshtein)
  |- Levenshtein.*.so
|-__init__.py (from rapidfuzz import distance)


Levenshtein
|-__init__.py

When importing Levenshtein first everything behaves as expected:
```
>>> import Levenshtein
>>> Levenshtein.
Levenshtein.apply_edit(       Levenshtein.jaro_winkler(     Levenshtein.ratio(
Levenshtein.distance(         Levenshtein.matching_blocks(  Levenshtein.seqratio(
Levenshtein.editops(          Levenshtein.median(           Levenshtein.setmedian(
Levenshtein.hamming(          Levenshtein.median_improve(   Levenshtein.setratio(
Levenshtein.inverse(          Levenshtein.opcodes(          Levenshtein.subtract_edit(
Levenshtein.jaro(             Levenshtein.quickmedian(   
>>> import rapidfuzz
>>> Levenshtein.
Levenshtein.apply_edit(       Levenshtein.jaro_winkler(     Levenshtein.ratio(
Levenshtein.distance(         Levenshtein.matching_blocks(  Levenshtein.seqratio(
Levenshtein.editops(          Levenshtein.median(           Levenshtein.setmedian(
Levenshtein.hamming(          Levenshtein.median_improve(   Levenshtein.setratio(
Levenshtein.inverse(          Levenshtein.opcodes(          Levenshtein.subtract_edit(
Levenshtein.jaro(             Levenshtein.quickmedian( 
```

However when importing rapidfuzz first it import `rapidfuzz.distance.Levenshtein` when running `import Levenshtein`
```
>>> import rapidfuzz
>>> Levenshtein
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'Levenshtein' is not defined
>>> import Levenshtein
>>> Levenshtein.
Levenshtein.array(                  Levenshtein.normalized_distance(    Levenshtein.similarity(
Levenshtein.distance(               Levenshtein.normalized_similarity(  
Levenshtein.editops(                Levenshtein.opcodes( 
```

My expectation was that in both cases `import Levenshtein` should import the `Levenshtein` module. I could reproduce this behavior on all Python versions I had available (Python3.8 - Python3.10) on Ubuntu and Fedora.
History
Date User Action Args
2022-03-05 22:26:32maxbachmannsetrecipients: + maxbachmann
2022-03-05 22:26:32maxbachmannsetmessageid: <1646519192.38.0.0729050305481.issue46935@roundup.psfhosted.org>
2022-03-05 22:26:32maxbachmannlinkissue46935 messages
2022-03-05 22:26:32maxbachmanncreate