Re:uv downloads overtake Poetry for Wagtail users
by Wulfheart on Monday March 17, 2025 @05:25AM
(#43386556)
Ok, you convinced me to give it a try. Tbh, I am a casual user of python and I don't want to touch it unless I have a damn good reason to use it.
[ Parent
| on HN ]
Re:uv downloads overtake Poetry for Wagtail users
by mlnj on Monday March 17, 2025 @05:59AM
(#43386727)
You do not need a damn good reason for this. Just try it out on a simple hello world. Then try it out on a project already using poetry for eg.
uv init
uv sync
and you're done
I'd say if you do not run into the pitfalls of a large python codebase with hundreds of dependencies, you'll not get the bigger argument people are talking about.
Re:uv downloads overtake Poetry for Wagtail users
by stavros on Monday March 17, 2025 @06:18AM
(#43386825)
I don't think you need to sync, do you? It always just does it when running.
That said, I do wish uv had `uv activate`. I like just working in the virtualenv without having to `uv run` everything.
Re:uv downloads overtake Poetry for Wagtail users
by hobofan on Monday March 17, 2025 @06:31AM
(#43386916)
I do usually include instructions in our READMEs to do a `uv sync` as install command, in order to separate error causes, and also to allow for bootstrapping the venv so that it's available for IDEs.
Re:uv downloads overtake Poetry for Wagtail users
by stavros on Monday March 17, 2025 @06:41AM
(#43386983)
That makes sense, thanks.
Re:uv downloads overtake Poetry for Wagtail users
by drcongo on Monday March 17, 2025 @07:20AM
(#43387275)
You can still `source .venv/bin/activate(.fish)` and skip the uv run bit. I have Fish shell configured to automatically activate a .venv if it finds one in a directory I switch to.
Re:uv downloads overtake Poetry for Wagtail users
by stavros on Monday March 17, 2025 @09:07AM
(#43388173)
I do do that, can you please share your fish script to autoload it? I have something for Poetry envs, but not venv dirs.
Re:uv downloads overtake Poetry for Wagtail users
by drcongo on Monday March 17, 2025 @01:16PM
(#43390654)
Sure thing - so I mostly ended up using this for activating a .venv in a fabfile directory using this...
function __auto_fab --on-variable PWD
iterm2_print_user_vars
if [ -d "fabfile" ]
if [ -d "fabfile/.venv" ]
if not set -q done_fab
and not set -q VIRTUAL_ENV
echo -n "Starting fabfile venv... "
pushd fabfile > /dev/null
source .venv/bin/activate.fish --prompt="[fab]"
popd > /dev/null
set -g done_fab 1
echo -e "\r Fabfile venv activated "
end
else
echo "Run gofab to create the .venv"
end
end
end
I've since deleted the one to do a .venv in this directory, but I think it was roughly this... function __auto_venv --on-variable PWD
if [ -d ".venv" ]
if not set -q done_venv
echo -n "Starting venv... "
source .venv/bin/activate.fish --prompt="[venv]"
set -g done_venv 1
echo -e "\r Venv activated "
end
end
end
(just tested that and it seems to work - the --prompt actually gets overridden by the project name from uv's pyproject.toml now though so that's not really necessary, was useful at some point in the past)These live in ~/.config/fish/conf.d/events.fish
Re:uv downloads overtake Poetry for Wagtail users
by stavros on Monday March 17, 2025 @01:24PM
(#43390739)
Thank you!
Re:uv downloads overtake Poetry for Wagtail users
by SAI_Peregrinus on Monday March 17, 2025 @02:51PM
(#43391636)
I'm not them, but I use `direnv` for this. Their wiki includes two layout_uv[1] scripts, one that uses `uv` just to activate a regular venv and a second that uses it to manage the whole project. I use the latter.
Re:uv downloads overtake Poetry for Wagtail users
by stavros on Monday March 17, 2025 @03:02PM
(#43391728)
That's great, thanks! I use direnv but didn't know they had this.
Re:uv downloads overtake Poetry for Wagtail users
by SAI_Peregrinus on Tuesday March 18, 2025 @12:27PM
(#43401304)
Custom layouts are awesome. You can set up any script to run when direnv runs, so you can support just about anything you want even before direnv adds a builtin.
Re:uv downloads overtake Poetry for Wagtail users
by 0cf8612b2e1e on Monday March 17, 2025 @11:49AM
(#43389798)
I keep going back and forth on ‘uv run’. I like being explicit with the tooling, but it feels like extra unneeded verbosity when you could just interact with the venv directly. Especially since I ported a bunch of scripts from ‘poetry run’
Re:uv downloads overtake Poetry for Wagtail users
by jorvi on Monday March 17, 2025 @09:06AM
(#43388167)
> I am a casual user of python and I don't want to touch it unless I have a damn good reason to use it.
I... what? Python is a beautiful way to evolve beyond the troglodyte world of sh for system scripts. You are seriously missing out by being so pertinently against it.
Re:uv downloads overtake Poetry for Wagtail users
by OutOfHere on Monday March 17, 2025 @06:03PM
(#43393180)
Just you wait till someone shows you how Rust is to Python what Python is to shell scripts. For one, null safety is a major issue in most corporate Python code, and much less of an issue in Rust code.