cold-soccer-63228
05/20/2022, 3:21 AMgoogle-api-python-client
and google-auth
libraries. In Python code, they're both referred to as google
, for example:
from google import auth
from google import api_core
I noticed that I can't specify two separate module_mappings
where the values are the same, otherwise the build system gets confused...fast-nail-55400
05/20/2022, 3:29 AMpython_sources
targets for the code that is importing those modules.module_mappings
feature is part of the Pants “dependency inference” feature which tries to automatically infer dependencies. In cases where it cannot, you can still use the dependencies
field on a target to explicitly set the dependency.)python_requirements()
target?python_requirements
plus #
then the name of the Python module.3rdparty/py#google-api-python-client
if the file 3rdparty/BUILD
had a python_requirements(name="py")
targetcold-soccer-63228
05/20/2022, 4:26 AMpath/to/source.py
having a dependency on path/__init__.py
, but the dependency not being inferred.
So I went ahead and added the following explicitly.
python_sources(
dependencies=["path/__init__.py"]
)
bitter-ability-32190
05/20/2022, 10:35 AMmodule_mappings
!
module_mappings
allow for any valid package name, so in your case google-api-python-client
should map to google.api_core
and likewise fgor google-auth
Ahh, I realized my issue was related to something else altogether. It ended up being due toThis shouldn't be necessary. Do your inits have contents? If so you might want to set https://www.pantsbuild.org/docs/reference-python-infer#section-initshaving a dependency onpath/to/source.py
, but the dependency not being inferred.path/__init__.py
cold-soccer-63228
05/20/2022, 2:40 PM__init__.py
files, but we're trying to migrate off of it...bitter-ability-32190
05/20/2022, 2:42 PM