Uv really fixes Python. It takes it from "oh god I have to fight Python again" to "wow it was actually fast and easy". I think all the other projects (pyenv, poetry, pip, etc.) should voluntarily retire for the good of Python. If everyone moved to Uv right now, Python would be in a far better place. I'm serious. (It's not going to happen though because the Python community has no taste.) The only very minor issue I'v…
Strong agree. The respectful act of other package managers would be consider themselves deprecated and point to uv instead.
Switching from Pyenv to Uv
121–130 of 239 posts
Re: Switching from Pyenv to Uv
#122Re: Switching from Pyenv to Uv
#123For scripting... HIGHLY recommend putting your dependencies inline. E.g.: #!/usr/bin/env python3 # /// script # requires-python = ">=3.11" # dependencies = [ # "psycopg2-binary", # "pyyaml", # ] # /// Then - uv run -s file.py
Do you need a wrapper script for scripts in the PATH or execve? I would usualy chmod+x the script but I am not sure here.
#!/home/tetha/Tools/uv runRe: Switching from Pyenv to Uv
#124What does uv offer over bog-standard setuptools, pip, pip-tools, and build? Right now, the only thing I really want is dependency pinning in wheels but not pyproject.yaml, so I can pip install the source and get the latest and greatest, or I can pip install a wheel and get the frozen dependencies I used to build the wheel. Right now, if I want the second case, I have to publish the requirements.txt file and add the w…
Re: Switching from Pyenv to Uv
#125The functionalities of three tooling projects, namely uv, ruff (linter), and pyright (type checker) need to merge and become mandatory for new Python projects. Together they will bring some limited sanity to Python.
i believe there is a type checker branch on ruff git
Re: Switching from Pyenv to Uv
#126Earlier quoted context omitted.
Do you need a wrapper script for scripts in the PATH or execve? I would usualy chmod+x the script but I am not sure here.
Not at a laptop to try this right now, but shouldn't this be possible with the shebang? Something along the lines of: #!/home/tetha/Tools/uv run
#!/usr/bin/env uv runRe: Switching from Pyenv to Uv
#127For scripting... HIGHLY recommend putting your dependencies inline. E.g.: #!/usr/bin/env python3 # /// script # requires-python = ">=3.11" # dependencies = [ # "psycopg2-binary", # "pyyaml", # ] # /// Then - uv run -s file.py
Do you need a wrapper script for scripts in the PATH or execve? I would usualy chmod+x the script but I am not sure here.
#!/usr/bin/env uv run --scriptRe: Switching from Pyenv to Uv
#128Uv really fixes Python. It takes it from "oh god I have to fight Python again" to "wow it was actually fast and easy". I think all the other projects (pyenv, poetry, pip, etc.) should voluntarily retire for the good of Python. If everyone moved to Uv right now, Python would be in a far better place. I'm serious. (It's not going to happen though because the Python community has no taste.) The only very minor issue I'v…
True. I had to give up on mypy and move to pyright because mypy uses pip to install missing types and they refuse to support uv. In the CI pipeline where I use UV, I don't have a pip installed so mypy complains about missing pip. Of course I can do it by myself by adding typing pkgs to requirement.txt file then what's the point of devtools! And I don't want requirements.txt when I already got pyproject.toml. Once you…
Re: Switching from Pyenv to Uv
#129Earlier quoted context omitted.
Yes, uv is well suited to that use case by declaring your Python version and/or dependencies right in the script itself: https://docs.astral.sh/uv/guides/scripts/#declaring-script-d... You can use an alternate shebang line so you can run the script directly: #!/usr/bin/env -S uv run --script # /// script # requires-python = ">=3.12" # dependencies = [ # "requests", # "typer-slim", # ] # /// import requests import typ…
Yes but I then still then have to declare all dependencies for all tiny throwaway script, right now I have global python in pyenv and installed tons of plugins and didn't have too much issues with conflicts so was good enough for me
Or better, do the above, then create a virtual env, set the virtual env in your.bashrc and install everything into that
Better still... use uv script --init See other comments on this post