A Project Template of Python with Rye
Please first install the latest Rye. https://rye-up.com/guide/installation/
Then run the following command to install runtime libraries.
rye sync --no-dev --no-lock
rye sync
This installs the following tools in addition to runtime libraries.
- pyright
- pytest-cov
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.rye.scripts]
pyright_lint = "pyright ."
rye_format = "rye format ."
rye_lint = "rye lint ."
rye_fix = "rye lint --fix ."
test = "pytest tests --cov=app --cov-report=term --cov-report=xml"
format = { chain = ["rye_fix", "rye_format"] }
lint = { chain = ["rye_lint", "pyright_lint"] }
check = { chain = ["format", "lint", "test"] }
Please check the Dockerfile
for how to use multi-stage build with Rye.
When you develop on VSCode, the Ruff extention already contains a Ruff executable.
When you develop on terminal, Rye contains a Ruff and rye format/lint
uses it.