https://pantsbuild.org/ logo
#development
Title
# development
h

hundreds-father-404

04/21/2023, 6:42 PM
I'm writing a Pants plugin that checks if absolute file/dir paths are missing. (Part of a
pants check-env
goal to make sure that users have their filesystem set up properly.) Would that be a useful utility to open source in
system_binaries.py
? Similar to
BinaryRequest
, but for filesystem paths
FYI I'm implementing it as a
Process
with
ProcessCacheScope.PER_RESTART_SUCCESFUL
, similar to what we do for finding binaries I am not using
pathlib.Path.exists()
because its caching semantics aren't correct I'm doing it by running a Bash script. But maybe this would be better as a Rust intrinsic?
h

happy-kitchen-89482

04/21/2023, 6:45 PM
Hmmm, TBH I don't have an opinion either way. Trying to think of how we would use this in the future, not coming up with anything, but that may be my limited imagination.
c

curved-television-6568

04/21/2023, 6:47 PM
I think there is benefit to have “rules” in this area to help ensure a compatible setup is present.
👍 1
the other day I was wrestling with issues that had me chasing ghosts for a while until we nailed it down to be due to https://github.com/xmlsec/python-xmlsec/issues/254 so turned out to not be an isolated issue, but still.
ENV vars and aliases are also worth looking at for this purpose
but maybe some rules should be opt-in or otherwise customizable.
h

hundreds-father-404

04/21/2023, 6:51 PM
Yeah, I don't think Pants itself would use this because we don't want to be forcing you to have certain absolute paths This is more of a utility for plugin authors, like Andreas's use case
ENV vars and aliases are also worth looking at for this purpose
I'm thinking the API would look something like
CheckedAbsolutePathsRequest(["..files"], ["..dirs"])
. So, the plugin could get fancy and determine those file paths to check via reading env vars I only want to add the basic plumbing / LEGO brick
👍 1
Andreas, how would you use this utility for https://github.com/xmlsec/python-xmlsec/issues/254? I'm not following
c

curved-television-6568

04/21/2023, 6:54 PM
I didn’t fully connect the two concepts here, just threw out that there are things outside of the project repo affecting what pants can do, and we may want to support to pin point if there are known issues there. that case may be slightly out of scope, but if we’d had the other stuff it potentially could’ve helped arrive at that sooner 😉
👍 1
h

hundreds-father-404

04/21/2023, 7:33 PM
Alright, I got this working.
Get(MissingAbsolutePaths, MissingAbsolutePathsRequest)
. Note that that is not digesting the files or anything. So, it sounds like Andreas is a +1 to upstreaming? Benjy is not sure?
c

curved-television-6568

04/21/2023, 7:42 PM
yes, I’m in favour of the direction.. I’m not sure what abs paths we’d want to look for at this point,tho..
p

proud-dentist-22844

04/21/2023, 9:21 PM
I think this WOULD be very beneficial for core pants.
environments
(the target, not env vars) need ways to define what counts as "compatible" beyond just the platform/architecture. Especially for
local_environment
, it would be very beneficial to define paths that must exist to use that environment. This issue is about allowing environments to determine compatibility based on env vars, and I think paths is a natural extension of that.
👀 1
👍 1
h

hundreds-father-404

04/21/2023, 10:05 PM
Interesting. Cool, I will start with adding
MissingAbsolutePaths
(in 1.5 weeks, leaving for a trip soon)