HI, first of thanks <@U02PATRM52L> and <@U051221NF...
# general
a
HI, first of thanks @refined-addition-53644 and @happy-kitchen-89482 for accommodating me the last few days with my questions. want to understand something • in my project I have multiple name space folders like
Copy code
├── ROOT Repo
├── .gitignore
├── README.md
├── lambda-one
│   └── lambda_one
|        ├── config -> directory containing other python files
|        └── lambda.py -> has import statement pointing to shared-code from shared_code.module_b.file_name import hello_world 
│   ├── tests -> contains test for this 
│   ├── poetry.lock
│   └── pyproject.toml
├── lambda-two
│   └── lambda_two
|        ├── config -> directory containing other python files
|        └── lambda.py -> has import statement pointing to shared-code -> from shared_code.module_b.file_name import sum 
│   ├── tests -> contains test for this 
│   ├── poetry.lock
│   └── pyproject.toml
├── shared-one
│   └── shared_code
|        ├── module_a -> directory containing python files
|        └── module_b -> directory containing python files
│   ├── tests -> contains test for this 
│   ├── poetry.lock
│   └── pyproject.toml
├── pants
└── pants.toml
I understand that pants supports creating of lock files. is it possible for pants to resolve the lock files for each module • I know I can define multiple resolve names and point to something but the problem is those lock files contain the same list of dependencies • what am wondering is if i can resolve the poetry.lock file in the pants.toml from each package and then within my
BUILD
do something like this
Copy code
# for lambda-one/BUILD
__defaults__(all=dict(resolve="lambda-one"))

poetry_requirements(
    name="poetry",
)

# for lambda-two/BUILD
__defaults__(all=dict(resolve="lambda-two"))

poetry_requirements(
    name="poetry",
)

# for shared-code/BUILD
__defaults__(all=dict(resolve="shared-code"))

poetry_requirements(
    name="poetry",
)
My thinking here is to have pants sort of "lock" each modules dependencies separately. wonder if that makes sense or something worth doing
this is to resolve this 073309.45 [WARN] Pants cannot infer owners for the following imports in the target lambda-one/lambda_one/lambda_function.py:lib@resolve=shared-code: * lambda_one.logging.logging.get_cloudlogbase_config (line: 10) These imports are not in the resolve used by the target (
shared-code
), but they were present in other resolves: * lambda_one.logging.logging.get_cloudlogbase_config: 'lambda-one' from lambda-one/lambda_one/logging/logging.py If you do not expect an import to be inferrable, add
# pants: no-infer-dep
to the import line. Otherwise, see https://www.pantsbuild.org/v2.14/docs/troubleshooting#import-errors-and-missing-dependencies for common problems. 073309.45 [WARN] Pants cannot infer owners for the following imports in the target lambda-one/lambda_one/lambda_function.py:lib@resolve=lambda-one: * shared_code.string_utils.string_utils.string_concat (line: 9) These imports are not in the resolve used by the target (
lambda-one
), but they were present in other resolves: * shared_code.string_utils.string_utils.string_concat: 'shared-code' from shared-code/shared_code/string_utils/string_utils.py:lib
or this ./pants package lambda-one/lambda_one/lambda_function.py ─╯ 073745.04 [WARN] Pants cannot infer owners for the following imports in the target lambda-one/lambda_one/lambda_function.pylib * shared_code.string_utils.string_utils.string_concat (line: 9) These imports are not in the resolve used by the target (
lambda-one
), but they were present in other resolves: * shared_code.string_utils.string_utils.string_concat: 'shared-code' from shared-code/shared_code/string_utils/string_utils.py:lib If you do not expect an import to be inferrable, add
# pants: no-infer-dep
to the import line. Otherwise,
r
Hey Bernard, as we talked yesterday the easier way would be to have common resolve for all (lambda-one, lambda-two, shared-code), otherwise you are going to run into this issue.
a
yeah it is just sad having to give up on it when I am so close
but strangely enough using the same config without doing anything new it packages it without any issues. any more.
what I am trying to figure out doe is if lambda-one imports share-code module. how does that get bundled as part of lambda-one package command. when I extracted the generated zip there apart from the import I can't find it anywhere in the packaged folder