Skip to content

lucidfrontier45/python-pdm-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Python PDM Template

A Project Template of Python with PDM

Install

Please first install PDM >= 2.0 with pip/pipx.

pdm install --prod

Develop

pdm install

This installs the following tools in addition to pdm install --prod.

  • ruff
  • pyright
  • black
  • pytest-cov

The settings of those linter and formatters are written in pyproject.toml

VSCode Settings

cp vscode_templates .vscode

Then install/activate all extensions listed in .vscode/extensions.json

Creating Console Script

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

Define Project Command

[tool.pdm.scripts]
black = "black ."
pyright = "pyright ."
ruff_lint = "ruff ."
ruff_fix = "ruff --fix-only ."
test = "pytest tests --cov=app --cov-report=term --cov-report=xml"
format = { composite = ["black", "ruff_fix"] }
lint = { composite = ["ruff_lint", "pyright"] }
check = { composite = ["format", "lint", "test"] }

Build Docker Image

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

About

A Project Template of Python with PDM

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published