white-twilight-61019
08/29/2024, 5:18 AMBUILD file
python_sources(
name = "pkg",
# Source code folders.
sources = [
"service/**/*.py",
],
dependencies = [
# 3rd party dependencies
"3rdparty/python:poetry#pydantic",
"3rdparty/python:poetry#easydict",
# Internal dependencies (libraries, etc.)
"python/pkg/service:pkg", # Uses util service lock file to resolve packages
"python/pkg/common:pkg", # User python default lock file to resolve packages
],
resolve=parametrize("python-default", "python-util-service")
)
pex_binary(
name = "app",
entry_point = "service/main.py",
dependencies = [
":pkg",
],
layout = "packed",
)
docker_image(
name = "docker",
image_tags = [
"{build_args.GITHUB_SHA}",
],
source = "docker/Dockerfile",
# Container registry details
registries = [
"@service_registry",
],
# Pants-target dependencies
dependencies = [
":pkg",
":app",
],
)
`ERROR`:
06:06:05.55 [ERROR] 1 Exception encountered:
Engine traceback:
in package goal
ValueError: The explicit dependency <service>:pkg of the target at <service>:docker does not provide enough address parameters to identify which parametrization of the dependency target should be used.
careful-address-89803
09/02/2024, 11:35 PMmy-package~=1.0
and "service" requires my-package==1.2.3
. The "common" resolve might choose version 1.0.0, while "service" will choose 1.2.3. They can't be combined, because the locked versions aren't the same.
One solution is to include them both in the same resolve. That way, both sets of constraints will be evaluated and the correct version chosen.
If you want to share "common" with many services, you can use "parametrize" on the resolve for "common" to all the services' resolves.
See the section on multiple lockfiles in our docscareful-address-89803
09/02/2024, 11:37 PM