hundreds-father-404
10/29/2020, 4:33 AMPEX_EXTRA_SYS_PATH
can be relative; you don’t need the absolute path of the tmpdir.
You’re calling await Get(PythonSources, PythonSourcesRequest)
already. That’s good. That’s what you want.
Now, next step is to likely add this line:
env = {"PEX_EXTRA_SYS_PATH": ":".join(prepared_sources.source_roots)}
(https://github.com/pantsbuild/pants/blob/9dc89b69d075892605a50fe1aac107bcd0bef3ee/src/python/pants/backend/python/goals/pytest_runner.py#L231)
This will append the source roots to the $PYTHONPATH
. For example, if you have code at src/python/project/app.py
, then this will add src/python
to $PYTHONPATH
, which allows Python processes to import the module <http://project.app|project.app>
, rather than <http://src.python.project.app|src.python.project.app>