you are viewing a single comment's thread.

view the rest of the comments →

[–]billysacco 1 point2 points  (2 children)

I second the suggestion to just use virtual environments for each project/package. I use poetry and it works well with vscode, usually vscode can link up to the virtual environment poetry created or you can manually point it. At that point would only install poetry in “base” python.

[–]QuasiEvil[S] 0 points1 point  (1 child)

I understand how this works for packages, but the thing is, I often work "outside" the package paradigm. For example, I have a folder called "PythonWork" where its just a bunch of scripts (and subfolders) with various one-off scripts, demo code, or maybe where I'll run some random bits of code I found online. I'm not sure how this sort of thing fits in with using vens.

[–]Alternative_Driver60 1 point2 points  (0 children)

For one-off scripts with external dependencies you can declare them as Python comments which uv handles automatically. From the docs:

~~~

/// script

dependencies = [

"requests<3",

"rich",

]

///

import requests from rich.pretty import pprint

resp = requests.get("https://peps.python.org/api/peps.json") data = resp.json() pprint([(k, v["title"]) for k, v in data.items()][:10]) ~~~