A Project Template of Python with uv
Please first install the latest uv. https://docs.astral.sh/uv/getting-started/installation/
Then run the following command to install runtime libraries.
uv sync --no-dev
uv sync
This installs the following tools in addition to runtime libraries.
- ruff
- pyright
- pytest-cov
- pytest-xdist
- taskipy
The settings of those linter and formatters are written in pyproject.toml
Install/activate all extensions listed in .vscode/extensions.json
[project.scripts]
app = "app.cli:main"
[tool.taskipy.tasks]
pyright_lint = "pyright ."
ruff_format = "ruff format ."
ruff_lint = "ruff check ."
ruff_fix = "ruff check --fix ."
test = "pytest tests --cov=app --cov-report=term --cov-report=xml"
format = "task ruff_fix && task ruff_format"
lint = "task ruff_lint && task pyright_lint"
check = "task format && task lint && task test"
Please check the Dockerfile
for how to use multi-stage build with uv.