add PEP 723 script detection and activation#11
Conversation
|
Hi First of all, thanks for picking this up and doing the work. I've been recovering from a motorcycle accident for a while, so I didn't get around to looking into it. I have to say, I'm not completely convinced it makes sense to do this. It feels like it is a bit at odds with the purpose of the extension. I can only think of a use case where you have a script depending on a venv that is managed outside of the project that you want to debug for some reason, so you click on it and run "Debug Python File" and it loads the correct venv. Can you help me understand the use cases better? I will leave this open for the time being. If anyone else coming here thinks this is useful, please let me know and ideally help me to understand how. Thanks |
|
Oh man, I wish you a speedy and mainly full recovery 🍀 After switching to uv I was looking for a way to automatically activate the corresponding venv. I always had to manually select the venv. I work in a repo with multiple python applications / packages and many scripts I found your Extension and thought it is made for uv, but I just checked the readme and you never mention it. But still your extension works great for python projects/application's/packages where the venv is created in the projects directory. This way of handling venv's was introduced to me when i switched to uv, I don't know how other all-in-one package managers (poetry, hatch) manage venvs. Then there are scripts and PEP 723 allows inline metadata, usually to declare script dependencies. uv promotes this for scripts, but for some reason stores the venv in the it's cache directory. That's when your extension doesn't find the venv and won't activate it. That's where my PR comes in and find's the venv using Long story short:
|
Added PEP 723 support as requested in #10
Checks for PEP 723 compatible scripts and, searches for the venv path by running
uv python find --scriptan activates tit.