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

bitter-ability-32190

04/08/2022, 4:35 PM
Another win for us: migrating python tests and enabled
[python-infer].assets
. • Run test • test fails "No such resource: XYZ" • Add relevant
BUILD.pants
• test succeeds No need to declare the
overrides: {"filename.py": dependencies: ["resourcepath1", "resourcepath2"]}
😈
💯 3
h

high-yak-85899

04/08/2022, 4:37 PM
Where can I read up on the path inference? We often do things like
pathlib.Path(__file__)
and potentially some form of
.parent
or
.parents
and get the necessary resource/file.
b

bitter-ability-32190

04/08/2022, 4:38 PM
As you can hopefully imagine it's quite simple today. Basically it takes strings with some number of slashes in it (configurable) and tries to match them to
resources
relative tot he files' parent or
files
relative to build root.
h

high-yak-85899

04/08/2022, 4:40 PM
Cool. I'll try it out!
b

bitter-ability-32190

04/08/2022, 4:41 PM
So
pkgutil.get_data("data/foo.txt")
would be inferred if there's a resource at
__file__ / ".." / "data" / "foo.txt"
h

hundreds-father-404

04/08/2022, 5:21 PM
I'm excited also that we can continue to improve this inference over time. Josh laid the foundation
1
5 Views