Template repository for python repos.
Create a virtual environment:
py -3.12 -m venv .venvActivate the virtual environment:
.venv\Scripts\activateInstall the dependencies:
pip install .[dev]Note
You can also install just the build dependencies with pip install .
Note
And instead of pip install [some-package], you should rather add it to pyproject.toml
This is a template repository for python repos. It is intended to be used as a starting point for new python projects, and to provide a consistent structure. It includes the following:
- A
README.mdfile with a basic description of the project. - A
LICENSEfile with the MIT license. - A
pyproject.tomlfile with the following:- A
projectsection with the project name, version, description, author, dependencies, and dev dependencies. - A
tool.ruffsection for specifying linting and formatting rules using Ruff, with strict yet sensible defaults. - A
tool.mypysection for specifying type checking rules using mypy.
- A
- A
.vscodefolder with the following:- A
settings.jsonwith sensible defaults for VS Code. - A
extensions.jsonwith the recommended extensions for VS Code python projects.
- A
Ruff is a linter and formatter for python, written in Rust. I've used every single linter and formatter combination out there, and it's just the best, hands down. Everything else is either slow, doesn't work well together, doesn't give all the options I want, or doesn't work well with VSCode. Just use Ruff.
How I with Ruff had mypy support already, but alas, it does not. So we need Mypy. Mypy is a type checker if you don't know. I've set it to be very strict, but you can change that in the pyproject.toml file.
Eh, just because I'm used to it.