shy-island-79431
11/09/2020, 10:47 PMrun, I get an import error: Error while finding module specification for 'package.package' (ModuleNotFoundError: No module named 'package')
When running test , the error is a simple ModuleNotFoundError .
Has anyone ran into a similar issue?witty-crayon-22786
11/09/2020, 11:00 PMshy-island-79431
11/09/2020, 11:09 PMpants.toml :
[source]
marker_filenames = ["setup.py"]
and when i run ./pants roots , i get
path/to/package/packageshy-island-79431
11/09/2020, 11:09 PMpath/to/package/package/srcwitty-crayon-22786
11/09/2020, 11:10 PMwitty-crayon-22786
11/09/2020, 11:11 PMwitty-crayon-22786
11/09/2020, 11:12 PMpath/to/package/package/package/package, a source root of path/to/package/package, will not let you import it as package.packagewitty-crayon-22786
11/09/2020, 11:12 PMwitty-crayon-22786
11/09/2020, 11:13 PMshy-island-79431
11/09/2020, 11:13 PMpath/to/package/src/package/package.py , so in that case, shouldn’t importing package.package work in this case?shy-island-79431
11/09/2020, 11:14 PMpath/to/package/src is a known source rootwitty-crayon-22786
11/09/2020, 11:14 PMpath/to/package/src/package/package.py, you’d need a source root path/to/package/src in order to import it as package.package, yea.witty-crayon-22786
11/09/2020, 11:14 PM__init__.py files.shy-island-79431
11/09/2020, 11:15 PM__init__.py files in path/to/package/src/package and path/to/package/test ; however, they are empty in this caseshy-island-79431
11/09/2020, 11:18 PMpython setup.py develop to run each of our libraries, this being the simplest of themshy-island-79431
11/09/2020, 11:18 PMwitty-crayon-22786
11/09/2020, 11:22 PMshy-island-79431
11/09/2020, 11:23 PMwitty-crayon-22786
11/09/2020, 11:24 PM./pants dependencies path/to/package/src/package/package.py show what you would expect?witty-crayon-22786
11/09/2020, 11:25 PM./pants run … on)shy-island-79431
11/09/2020, 11:26 PMpath/to/package/src/package/package.py:../../packageshy-island-79431
11/09/2020, 11:27 PMwitty-crayon-22786
11/09/2020, 11:28 PMwitty-crayon-22786
11/09/2020, 11:29 PMshy-island-79431
11/09/2020, 11:30 PMshy-island-79431
11/09/2020, 11:33 PMhappy-kitchen-89482
11/09/2020, 11:43 PMhappy-kitchen-89482
11/09/2020, 11:44 PMshy-island-79431
11/09/2020, 11:50 PMhappy-kitchen-89482
11/10/2020, 12:35 AMenough-analyst-54434
11/10/2020, 1:14 AMpath/to/package/setup.py which says path/to/package/src is the 1st python package, aka src is the root package. That is definitely not what is intended.witty-crayon-22786
11/10/2020, 1:15 AMenough-analyst-54434
11/10/2020, 1:15 AMwitty-crayon-22786
11/10/2020, 1:16 AM./pants roots looked right, but yea: would be good to add that to the ticket as wellenough-analyst-54434
11/10/2020, 1:18 AMenough-analyst-54434
11/10/2020, 1:32 AMsetup.py as a marker file" doc is the buggy thing here. That only works for projects with setup.py and a very specific structure.happy-kitchen-89482
11/10/2020, 2:15 AMhappy-kitchen-89482
11/10/2020, 2:16 AMsetup.py as the marker file only if it happens to be exactly at the package root.happy-kitchen-89482
11/10/2020, 2:17 AMhappy-kitchen-89482
11/10/2020, 2:17 AM