Hi All, We are using pants version 2.19 and have m...
# general
a
Hi All, We are using pants version 2.19 and have multiple resolves setup. How can we exclude a single module from parametrizing? For example, I would like to limit utils.py to use just default resolve but rest of the modules in that directory are parametrized to use both the default and airflow resolves. I have the following settings in the PANTS file:
Copy code
python_sources(
    resolve=parametrize("default", "airflow"),
    overrides={"utils.py": {"resolve": "default"}},
)
But running into the following error when importing utils.py:
nownedDependencyError: Pants cannot infer owners for the following imports in the target src/pdl/builds/person/metrics/publish_release_metrics.py:
* pdl.svc.data.databricks.common.helpers.utils.get_dbutils (line: 29)
Thanks in advance!
b
Sorry for the trouble, is it possible for you to make a reduced example that shows your problem? It's a bit hard to debug without more context?
a
Thank you for taking a look. Here is a reduced example: We have two resolves(default and airflow) setup in our repo. I have a directory (say,
svc/data/helpers
)which is parametrized to use both default and airflow resolves since it has some shared code. But I want to limit one module (say
utils.py
) in that directory to use only the default resolve using overrides, but looks like pants doesn't allow that. PANTS file in
svc/data/helpers
has the following:
Copy code
python_sources(
    resolve=parametrize("default", "airflow"),
    overrides={"utils.py": {"resolve": "default"}},
)
Running into the following error on a module(say svc/builds/publish_metrics.py- which uses default resolve) that imports utils.py:
nownedDependencyError: Pants cannot infer owners for the following imports in the target svc/builds/publish_metrics.py):
* svc.data.helpers.utils (line: 29)
b
We’ll be able to help more with more specifics. The best approach would be a repository or a gist that we can clone and actually execute to see the problem. if that’s not possible, sharing your pants.toml and the exact file structure and import lines in the source code (since this relates to dependency inference) is best.
a
I will see if I can get more specifics. But wanted to check if the above settings is even allowed with PANTS? i.e. does PANTS support limiting a module to a specific resolve using overrides if it's directory(python_sources target) is parametrized to use both the resolves?