quaint-telephone-89068
03/08/2023, 2:22 AM./pants runner script which resolves target paths relative to the current directory. I'm thinking an example if implemented as a bash function pants_wrapper would allow something like:
> cd /path/to/pants/clone
> cd src/python/pants
> pants_wrapper -q repl ./util:
Python 2.7.15 (default, Jun 20 2018, 17:40:09)
[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.39.2)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>>
In a monorepo, this would allow working in some specific directory with some local files, then allow running pants on targets in that directory. This would also allow having multiple terminal sessions open at once in different directories of a monorepo to maintain WIP state in multiple directories at once.
There may be other benefits to using such a wrapper, and other transformations we can do besides just resolving target paths differently! I'm thinking implementing pants_wrapper above would probably involve a shell function that just invokes pants at the root with some wrapper script, while there may be some special logic in ArgSplitter if, say, a specific environment variable PANTS_RELATIVE_DIR or something is set in the pants invocation to resolve target specs relative to the directory path in that env var (which itself is relative to the buildroot).
@ShaneDelmore has brought this up multiple times and may have more input on what might be useful about this, especially as it appears sbt is able to do something like the terminal output above?
pantsbuild/pantsuser
03/08/2023, 2:22 AM