#πŸ”’ need help getting started with UV and python

42 messages Β· Page 1 of 1 (latest)

indigo quiver
#

have some experience with python
but thats with coding, idk much on managing the environment stuff
or even setting up venv stuff
now I'm hearing about UV which people say simplify everything with installing python to everything environment stuff

valid iceBOT
#

@indigo quiver

Python help channel opened

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.

indigo quiver
#

I tried installing uv

radiant rapids
indigo quiver
#

this what I currently got on powershell

radiant rapids
indigo quiver
#

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

radiant rapids
indigo quiver
#

and aim to learn to use VsCode

radiant rapids
#

there's a vs code extension for uv

stable crest
radiant rapids
stable crest
#

just saying no need for extension

radiant rapids
#

have you used uv before?

stable crest
#

yes pretty basic use

radiant rapids
#

uv often makes venvs on-the-fly, so if there's an IDE extension that supports it, that's the way to go.

stable crest
#

on-the-fly sounds fancy

radiant rapids
#

it's fancy as fuck

stable crest
#

so what it can do

radiant rapids
#

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

stable crest
#

i have read about this thing it was in some pep for scripte requirements

radiant rapids
#

yes, it follows the protocol in that pep

indigo quiver
#

like I also use idle

stable crest
#

sounds like total overkill but i wont complain

radiant rapids
#

you don't need to make individual venvs for one-off scripts

stable crest
#

but then again it is not for regular use

radiant rapids
#

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.

indigo quiver
#

so I just install uv extension on vscode?

#

how about it being in my user directory? instead of system

radiant rapids
#

idk, I haven't used VSC. I only know about the uv extension from a help session I did a few days ago.

radiant rapids
valid iceBOT
#
Python help channel closed for inactivity

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.