Provide pluggable/extensible subcommand support #222
Replies: 5 comments 13 replies
-
Another way to potentially pass in arguments is via JSON and stdin (i.e. pipe). |
Beta Was this translation helpful? Give feedback.
-
Does “git-style” include looking in something like |
Beta Was this translation helpful? Give feedback.
-
To make it easier to write commands in Python, the Launcher could check if the found command files have a |
Beta Was this translation helpful? Give feedback.
-
Looking at external commands for
This approach of effectively having subcommands call back into This might mean it makes sense to bake in a |
Beta Was this translation helpful? Give feedback.
-
How |
Beta Was this translation helpful? Give feedback.
-
This could be used to implement things like
py run
for.pyz
files.Following the git/cargo approach,
py
would look for anypy-
-prefixed binary onPATH
and then execute it on the behalf of the user (usingexecve()
). It would set the following environment variables:PY_LAUNCHER_PATH
: the path back to thepy
binaryPY_LAUNCHER_VERSION
: the version of the Python Launcher (in case that matters)PY_LAUNCHER_ARG
: the argument to the launcher, if any (e.g.-3.11
)All non-launcher arguments would be passed along to the
py-*
binary.The Launcher would gain a way to request interpreter details. From the subcommand, one could do
$PY_LAUNCHER_PATH $PY_LAUNCHER_ARG <something>
to get the list of known interpreters written to stdout as JSON (like how cargo subcommands work). I don't know if it's worth providing a way to short-circuit the search when an obvious interpreter is found for performance/simplicity of subcommands (e.g..venv
with no version restriction topy
), or just always return all results sorted in the order the Launcher would have selected an interpreter? I'm also not sure if this should be exposed as a subcommand (e.g.list --json
), a variant of--list
(e.g.--list-json
), an optional argument to--list
(e.g.--list=json:all
), or some other UX?Beta Was this translation helpful? Give feedback.
All reactions