DidYouMean-Python
DidYouMean-Python copied to clipboard
fixed paths for pip install
Hi @SylvainDe,
I know you have another PR that fixes this module's imports to make it work with pip install
(https://github.com/SylvainDe/DidYouMean-Python/issues/52), but it's a bit outdated so I thought I'd open a new one.
The fix is fairly simple, where before you had:
from didyoumean_common_tests import (
TestWithStringFunction,
get_exception,
no_exception,
NoFileIoError,
unittest_module
)
now it's
from .didyoumean_common_tests import (
TestWithStringFunction,
get_exception,
no_exception,
NoFileIoError,
unittest_module
)
notice the .
before didyoumean_common_tests
, that tells python's importer to import those functions from the didyoumean_common_tests
of didyoumean
.
Similarly:
import didyoumean_common_tests as common
becomes
from didyoumean import didyoumean_common_tests as common
Hope that this helps clarify things a little bit, it might take a bit to wrap your head around how to import stuff (I know it took me quite a while).
Btw I've moved readme_examples.py
outside of the package's folder because generally code for examples and tests should be separate from the package's code (e.g. see folder structure here).
Feel free to move it back if you prefer
Bumped a new commit with fixes for those errors
Wow, that was fast!
Many thanks for the 3 iterations! Now, the CI is detecting more interesting issues... which may be caused by a few things that were done improperly in my original code. I'll try to get a better understanding of what we have... (Also, I guess I may have to drop support for older Python versions)
mmm that's weird, I haven't run the tests but the package worked fine for me.. I've only used pytest for running tests though, so not sure what the problem is here.
it might help to keep you test code and your package code separate, that might be the cause of error (it complains about relative imports)
FYI, I've started to try out a few things on https://github.com/SylvainDe/DidYouMean-Python/tree/testingPr53 with very limited success. I'll keep you posted if I do thing something interesting in the future and merge your PR at that point.
sounds good, good luck!
@SylvainDe ping for this or any of the three PRs attacking the same problem