Python development with uv
Python development with uv.
# ensure uv is installed
## create project
uv init [--app] # application
uv init --package # package
uv init --lib # library
uv init --bare # minimal
## manage dependency
uv add httpx # add single dependency
uv add httpx --dev # add dev dependency
uv remove httpx # remove single dependency
uv sync # install and create uv.lock
uv lock # update lock file
uv tree # display dependency
## run command within the project environment
uv run main.py # module in workspace
uv run hello # command defined by [project.scripts]
## run executable tool
uv tool list # list installed tool
uv tool dir # show tool path
uv tool install sometool # install tool
uv tool uninstall sometool # uninstall tool
uv tool upgrade sometool # upgrade tool
uv tool run sometool # run sometool without installation, alias: uvx
uv tool update-shell # add executables to path
## develop current project as tool
uv tool install -e . # install current project tool as editable
uv tool install . # install current project tool as immutable
## manage virtual env
uv venv # create venv
uv venv --python 3.11 # create venv with specific python version