It would, but that’s assuming we come up with some solution outside of pyproject.toml that people like.
The best I can think of is based off of Provide structured output for environment/interpreter discovery · brettcannon/python-launcher · Discussion #168 · GitHub and having workflow tools install an entry point with a certain name prefix like how Git plug-ins work (e.g. _py_wsp_<tool name>). The tricky bit with that is it would require asking all workflow tools whether they apply or not to a project on first run. Now, my guess is most people don’t have more than one workflow tool installed at once, so it wouldn’t be a huge concern or performance hit. You could also cache which tool said they should be the one to work with the project (or as a way to override if you manually set the cache). This doesn’t provide a way for a project to explicitly say, “please use this workflow tool” and allow overriding (e.g. committing some .python-wsp file wouldn’t be easy to override). But it’s one possible alternative approach that may avoid pyproject.toml. There’s also may be some combination of discovery via PATH and pyproject.toml that works out. Or environment variables to point at workflow tools locally.
Yep, just like any tool you use.
And yet all of those tools all have their own way of doing things, and I don’t know where they draw the line on what they are okay with us dictating to them for how they operate.
You can if you don’t care about being as robust as the code Cary showed is. The spec is at JSON-RPC 2.0 Specification and as you can see it isn’t very long or complicated.
I wouldn’t say it supports it as much as wouldn’t prevent it while encouraging tools to support it.
That’s fair, but I will say the workflow tool authors who voted seemed to prefer the JSON-RPC approach.
And why supporting inline script metadata would be important.
Do we mandate allowing people to opt out of a setting for any other standard?
That I don’t know. I expect to remove the changes to the venv module which required needing the SC to be the ones deciding on this PEP. If I move forward with using pyproject.toml then it might get messy as to whose “jurisdiction” the PEP falls under.
To try and tie all of this back to the problem I’m trying to solve: how do we make it so tools like VS Code know where any environments exist (if any)? There’s a matrix here (do note that “fancier” support subsumes simpler ones, e.g. WSP can also cover what .python-envs does):
| Preference | First time loading the project | Already run workflow tool |
|---|---|---|
| Project has a preference | pyproject.toml |
.python-envs |
| User has a preference | VS Code supports it? | .python-envs |
| No one cares | VS Code’s choice? | .venv |
These are the scenarios I’m looking to (potentially) cover. Basically the bootstrapping of a fresh checkout is the “hard” problem to solve here.