Skip to content

ThePurpleOne/base_python

Repository files navigation

Template for a typed-checked, lint-ed, and formatted Python project.

Setup using the standard pyproject.toml and managed via Astral uv

It sets up:

Run code

uv run src/main.py

Needed tools

You'll need some tools to be able to use the environment properly.

Astral uv

https://docs.astral.sh/uv/getting-started/installation

On windows:

powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"

On mac or linux:

curl -LsSf https://astral.sh/uv/install.sh | sh

act

Act is a tool to run GitHub Actions locally. It's not mandatory, but it's very useful to test the CI pipeline locally.

Follow the instructions to install it on your system: https://nektosact.com/installation/index.html

Using the environment

Pre-commit

Run pre-commit hooks, that will format, lint and type check your code

uv run pre-commit run --all-files

Unit Tests

This step is not included in the pre-commit hooks to avoid disrupting the developer's workflow and to encourage frequent commits

Run tests

uv run pytest -v

Linting and Formatting by hand

This is already done by pre-commit, but you can run it manually if you want to. Run formatter

uv run ruff format .

Run linter

uv run ruff check .

Type Checking

It is ran in the CI pipeline, but you can run it locally if you want to.

Run type checker

uv run pyright

Run the CI locally using act

act

About

Base Python project Template with formatter, linter, type-checking, and uv

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages