Where's the latest and greatest on how dependency ...
# general
h
Where's the latest and greatest on how dependency inference works for files/resources targets? I'd like to try it out, but I don't remember where in the docs/blogs specifies how to use it.
l
h
That doesn't seem to mention automatic inference, though.
l
hmm you are right
e
h
Thanks! Any examples of what the strings look like? Do you have to hardcode something relative to the project source root to be inferred?
e
The strings are whatever works with
__import("...")__
or
importlib.importmodule("...")
.
So the string must be a valid Python module that can be found on the
sys.path
at runtime.
Perhaps I'm not understanding the question.
h
Oh, I thought it was for picking up generic files
Like say I have a yaml resource
e
Oh, right:
Copy code
Infer a target's asset dependencies based on strings that look like Posix filepaths, such as those given to open or pkgutil.get_data.
That seems pretty clear to me.
Experiment!
c
If you're after 2.16.0.dev1 You can try the
python-dump-source-analysis
goal, it'll tell you what Pants is thinking. It's possible that Pants has found something that looks like it could be an inferred file, but it can't find the file (for whatever reason) and isn't going to sweat it. I think the most relevant source is here , which talks about the specifics of which files Pants looks for when it finds a possible asset import