Python use case: Use importlib.metadata.files
to call just
from a Python package that depends on rust-just
!
#2618
blakeNaccarato
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm planning to build out a tool that maps some Justfile recipes to a Python CLI (allowing to keep the implementation in one place). This would use
subprocess.run
directly onjust.exe
, but the problem was in finding a reliable way to locatejust.exe
if installed via e.g.pip install rust-just
.Well, I think
files
fromimportlib.metadata
is the way to go. It produces objects that have a.locate()
method to find their actual place, which is a bit more robust than, idk,Path(sys.executable).parent / "just.exe"
or something to try and navigate to thebin
/scripts
directory manually.Anyways, if anyone else is hacking together some abomination of a Python package that calls
just
like myself, this is an option!Beta Was this translation helpful? Give feedback.
All reactions