Skip to content

lucidfrontier45/python-uv-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

python-uv-template

A Project Template of Python with uv

Install

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

Develop

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

VSCode Settings

Install/activate all extensions listed in .vscode/extensions.json

Creating Console Script

[project.scripts]
app = "app.cli:main"

Define Project Command

[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"

Build Docker Image

Please check the Dockerfile for how to use multi-stage build with uv.

About

A Project Template of Python with uv

Resources

License

Stars

Watchers

Forks

Packages

No packages published