Closed bjorn-martinsson closed 4 years ago
For some reason the automatic tests seem to break from this, but I can run things locally without any import errors. Really not sure what the issue is.
The ordersort
tests are still using the old import format.
Edit: Fixed it
The test are failing because your import syntax is wrong for the gcd test (fixed it)
I'm seeing errors like this under "tox run"
ImportError while importing test module '/home/runner/work/PyRival/PyRival/tests/algebra/test_chinese_remainder.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
tests/algebra/test_chinese_remainder.py:3: in <module>
from pyrival.chinese_remainder import *
E ModuleNotFoundError: No module named 'pyrival.chinese_remainder'
I'm really not sure why I'm getting these on tox. Locally running the imports does not cause any errors.
Currently PyRival uses a somewhat complicated import system
__init__.py
in a kind of complicated way.I propose fixing this by just having a single
__init__.py
file in the pyrival package containing a modification to__path__
, allowing all .py files inpyrival/...
to be reachable by doingimport pyrival.insert_filename_here
. This greatly simplifies PyRival, while also fixing all of the 3 issues above.With these changes it is possible to do things like
import pyrival.convex_hull_trick
from pyrival import convex_hull_trick
from pyrival.convex_hull_trick import convex_hull_trick
(this imports the functionconvex_hull_trick
insideconvex_hull_trick.py
)from pyrival.convex_hull_trick import *
@Mukundan314 and @cheran-senthil what do you think about this? I think something like this would definitely be an improvement.