#π need help getting started with UV and python
42 messages Β· Page 1 of 1 (latest)
@indigo quiver
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
I tried installing uv
okay, what happens if you do uv --version in the shell?
this what I currently got on powershell
it's easier for people to read when you show text as text, not as a screenshot.
alr
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.
Install the latest PowerShell for new features and improvements! https://aka.ms/PSWindows PS C:\WINDOWS\system32> powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex" Downloading uv 0.8.4 (x86_64-pc-windows-msvc) Installing to C:\Users\batal\.local\bin
uv.exe
uvx.exe
uvw.exe
everything's installed!
To add C:\Users\batal\.local\bin to your PATH, either restart your shell or run:
set Path=C:\Users\batal\.local\bin;%Path% (cmd)
$env:Path = "C:\Users\batal\.local\bin;$env:Path" (powershell)
why is also in my user directory?
I ran it with admin though
the last part has instructions that you should follow.
are you working on a python project or writing individual scripts or what?
I wanna get started learning python again
and aim to learn to use VsCode
there's a vs code extension for uv
honestly there is no need for that
make venv with
python -m venv .venv
they're asking how to use uv
just saying no need for extension
have you used uv before?
yes pretty basic use
uv often makes venvs on-the-fly, so if there's an IDE extension that supports it, that's the way to go.
on-the-fly sounds fancy
it's fancy as fuck
so what it can do
suppose you have a script that isn't part of a project. you can do
uv add --script my_script.py requests pandas tabulate
and it adds comments to my_script.py saying that those are the requirements for that script
and then you do uv run my_script.py, and it either makes a venv with those requirements on-the-fly, or uses the one from the last time you ran that script
and the venv isn't added to that directory. it lives in uv's cache
so it's a cleaner way of managing dependencies
i have read about this thing it was in some pep for scripte requirements
yes, it follows the protocol in that pep
like I also use idle
sounds like total overkill but i wont complain
it's actually underkill
you don't need to make individual venvs for one-off scripts
mainly i use global for that
but then again it is not for regular use
what if other people have to use that script, and it requires a specific combination of dependencies? you don't want to have to do pip freeze and look for the lines that are relevant.
with uv, all you have to do is send them the one script, without any additional files, and uv parses the specific set of requirements from the comments and makes the venv.
so I just install uv extension on vscode?
how about it being in my user directory? instead of system
idk, I haven't used VSC. I only know about the uv extension from a help session I did a few days ago.
curious, what ide u use?
pycharm. you can use whichever one you want.
This help channel has been closed. Feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.