I haven’t caught up with the thread beyond the post I’m replying to, so apologies if any of this has already been covered.
That sounds mostly correct, but the key thing to note is that uv’s model is designed around the user specifying their desired configuration as part of interacting with their project or workspace, rather than working directly with the underlying environment. uv currently makes the environment available through .venv so that other tools can also support that interaction. In the future, if we establish other ways for those tools to determine which environment to use, we may allow users to opt out of .venv entirely.
Yes, with the distinction above, I think we are on the same page.
To clarify, we are not asking for a protocol to expose uv’s configuration-selection mechanism at all, nor do we object to a protocol that supports environment enumeration. What matters to us is that a workflow tool like ours can interoperate without implementing environment enumeration.
We are not opposed to WSP as a concept. Putting aside what it would support, we have reservations about the complexity of the proposed approaches.
A number of us on the team think that a long-running process and RPC protocol would introduce complexity disproportionate to our needs.
I have something in mind, although I have yet to fully discuss it with my colleagues, so I can’t speak for the team on it yet. That said, the get part is not far removed from functionality uv already has.
The earlier discussions explored something similar, but from what I can tell, they did not consider allowing different workflow tools to implement different subsets of functionality. It’s just a sketch, and I am aware that I’m glossing over a lot of important details that have been discussed, so please take it with a pinch of salt. Even so, I have tried to account for how different workflow tools operate.
The idea is to define separate capabilities:
[workflow.environment]
get = ["command", "..."]
select = ["command", "..."]
get would return the path to the current environment, creating it if it does not exist yet. If the workflow tool’s answer could change (like in uv’s case), it would instead return the path to a symlink, junction or redirect file, and long-running programs would be expected to detect changes to that indirection and re-resolve it, while monitoring the environment it references.
select would list environment identities when passed no arguments, and prepare the selected environment and return its path when passed an identity. get could optionally return an identity correlating its result with an entry in this list. Tools with a concept of a “default” environment could mark one entry as the default in their response.
Both commands would be executed in the directory containing the pyproject.toml. Each could emit a single JSON object on stdout, with progress reported on stderr if needed.
uv could implement only get, without returning an identity. Other tools could implement select or both, while simpler tools could continue to rely on .venv.
Additional capabilities could be standardised separately when concrete needs arise rather than anticipated as part of the protocol in this PEP. If we felt uv needed a standardised configuration-selection mechanism, we could submit a PEP for workflow.configuration.select; remote-environment support could likewise be proposed through workflow.environment.remote. Future capabilities need not even be command-based.
Reserving the workflow namespace seems sufficient to leave room for extensibility while keeping this PEP and any capabilities it defines as simple as possible.
We’re all off next week, so we probably won’t be reading or replying here until we’re back. I just wanted to mention that so it doesn’t look like we’ve lost interest.