I'm making a change where I have a bunch of `Packa...
# development
b
I'm making a change where I have a bunch of `PackageFieldSet`s and need to do lookup based on
OutputPathField
. Unfortunately it's generic, so I don't have a value to plug into
OutputPathField.value_or_default
. Any objects to adding a mandatory field to
PackageFieldSet
for the
default_file_ending
? I'm guessing there's places this breaks down (like no OutputPath or multiple)?
āœ… 1
h
I'm not sure it even needs to be dynamic? Maybe worth auditing call sites
I think either Benjy or I added
OutputPathField
and I only did it as a function arg because it felt less boilerplatey maybe?
b
Ah hmm so: ā€¢
PyOx
doens't use a file ending, same as
GoBinary
and
HelmChart
ā€¢
PythonDist
doesn't have an output path ā€¢
Archive
uses a dynamic value based on the format
šŸ‘ 1
Which tells me we might want to add an abstract method to
PackageFieldSet
to aid us. Although
PythonDist
is an odd duck
h
i don't remember why python dist does not, and if we could change it to
b
(FWIW
BuiltPackage
uses a tuple of artifacts, so maybe we're going down the wrong path and instead need a way to query what artifact paths would be without building them?)
šŸ‘ 1
(For what I'm working on though, using
OutputPathField
would get us 80% of the way, and we can file an issue and fix "generically" for
PyDist
)
h
True. I think it might make sense for that to computed in a method on
OutputPathField
. Only issue is that would prohibit using the Rules API to help you out with that calculation. I don't know if that's necessary Using the Rules API would mean a dedicated plugin hook for what the output path of the artifact-to-be-built will be šŸ¤®
b
I just realized there's an easy hack to workaround this quite well. Just take the file extension of the needle and use it when looking in the haystack. It'll overinfer deps (in the unlikely case two output paths are similar up to the extension), however there isnt any real harm to adding a little extra to the sandbox. It'll also not work for PyDist, but at least it's forward progress with 0 retrofits
h
Just take the file extension of the needle and use it when looking in the haystack.
Ah, so if the Dockerfile has
COPY path/to/foo.pex
then we will call
OutputPath.value_or_default(".pex")
on everything? Seems reasonable to me
b
Yes, but for N needles in the Haystack. PR posted you'll see šŸ˜„