https://pantsbuild.org/ logo
#general
Title
# general
t

thousands-plumber-33255

02/17/2023, 10:53 AM
Is it possible to set the following setting to a different value for a specific source root (except for using the corresponding CLI flag for running targets in that source asthat does not scale well)?
Copy code
[python-infer]
string_imports_min_dots = 0
πŸ‘€ 1
I would like to add some background information: I need to set this to 0 for my django application as a lot of dependencies do not get inferred otherwise. Here I have
django/app1
for exmaple. In another application, source files include something like
tag="app1"
which is totally unrelated but not django/app1 gets automatically inferred which I is not desired. The problem is that I cannot add a wildcard exclude statemement in the dependencies field.
c

curved-television-6568

02/17/2023, 12:24 PM
Currently, I think the answer is no, you can’t. But it is an interesting problem to solve πŸ˜‰
t

thousands-plumber-33255

02/17/2023, 1:06 PM
Can you think of another solution? πŸ˜„ I.e. to exclude all of django for the interference part
c

curved-television-6568

02/17/2023, 1:14 PM
hmm.. not without writing some custom plugin I think.
also, this issue could be relevant here https://github.com/pantsbuild/pants/pull/17631
πŸ‘€ 1
t

thousands-plumber-33255

02/17/2023, 1:55 PM
Is it possible to add
# pants: no-infer-dep
to those lines with string imports??
c

curved-television-6568

02/17/2023, 2:11 PM
Ah.. yes I believe you can. Good find!
that completely slipped my mind πŸ˜…
t

thousands-plumber-33255

02/17/2023, 2:51 PM
Just tried and does not work 😞
c

curved-television-6568

02/17/2023, 2:56 PM
oh..
that seems like a missing feature πŸ€”
t

thousands-plumber-33255

02/17/2023, 3:40 PM
with DAG('dag_name', default_args=default_args, schedule_interval=None, tags=["app1"]) as dag: # pants: no-infer-dep
This is what I tried
c

curved-television-6568

02/17/2023, 3:52 PM
yea, I looked in the tests, and not seeing any tests for ignoring string deps makes me think this is a case that wasn’t considered yet.. https://github.com/pantsbuild/pants/blob/8384c5cfa73b148a761d6229b34b4205cb24e19d/[…]d/python/dependency_inference/parse_python_dependencies_test.py
t

thousands-plumber-33255

02/17/2023, 3:53 PM
Okay, I think I am just going to rename that tag
πŸ‘ 1
4 Views