stale-nightfall-29801
10/26/2021, 9:21 AMpython_library(
name = "bar",
sources = ["bar/*.py"],
)
python_tests(
name="test",
sources = ["test/test_*.py"],
dependencies=[":bar","foo:foo"],
)
pex_binary(
name="run",
dependencies=[":bar"],
entry_point="bar/server.py:main",
)
Here is the error:
$ ./pants run bar:run
Traceback (most recent call last):
File "/home/james/Documents/monorepo/.pants.d/tmpfiz317ey/run.pex/.bootstrap/pex/pex.py", line 483, in execute
File "/home/james/Documents/monorepo/.pants.d/tmpfiz317ey/run.pex/.bootstrap/pex/pex.py", line 401, in _wrap_coverage
File "/home/james/Documents/monorepo/.pants.d/tmpfiz317ey/run.pex/.bootstrap/pex/pex.py", line 432, in _wrap_profiling
File "/home/james/Documents/monorepo/.pants.d/tmpfiz317ey/run.pex/.bootstrap/pex/pex.py", line 539, in _execute
File "/home/james/Documents/monorepo/.pants.d/tmpfiz317ey/run.pex/.bootstrap/pex/pex.py", line 655, in execute_entry
File "/home/james/Documents/monorepo/.pants.d/tmpfiz317ey/run.pex/.bootstrap/pex/pex.py", line 686, in execute_pkg_resources
File "/home/james/Documents/monorepo/.pants.d/tmpfiz317ey/run.pex/.bootstrap/pex/vendor/_vendored/setuptools/pkg_resources/__init__.py", line 2481, in resolve
ModuleNotFoundError: No module named 'server'
And checking my ./pants/roots
is see:
bar
bar/bar
bar/test
Also the tests run fine when I do ./pants test bar:test
Given my past problems I'm assuming it's a roots issue, but my other targets (2 packages, 2 tests) and the tests here all work. It's just the pex_binary
in this web service that seems to not be working now.curved-television-6568
10/26/2021, 9:31 AMbar/bar
root that causing issues.. did you see it required for something else to work?curved-television-6568
10/26/2021, 9:33 AMstale-nightfall-29801
10/26/2021, 10:05 AMbar
tests fine but fails to runcurved-television-6568
10/26/2021, 10:07 AMbar
to allow other parts to reference your modules as bar.data
etc…curved-television-6568
10/26/2021, 10:08 AMstale-nightfall-29801
10/26/2021, 10:16 AMstale-nightfall-29801
10/26/2021, 11:14 AMfoo/foo/<code>
so a pattern of ./foo
always yields ./foo
& ./foo/foo
The Fix:
[source]
marker_filenames = ["BUILD"]
As I only put BUILD
in my roots.
Thanks againcurved-television-6568
10/26/2021, 12:05 PMhappy-kitchen-89482
10/26/2021, 3:45 PMhappy-kitchen-89482
10/26/2021, 3:45 PMtailor
, but it's trickier than you might thinkstale-nightfall-29801
10/28/2021, 1:41 PM