Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,29 @@ on:
pull_request:
branches: [ main ]

permissions:
contents: read
pull-requests: read

jobs:
code-check-and-unit-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
- name: Setup just
uses: extractions/setup-just@v3
- name: Install uv
uses: astral-sh/setup-uv@v1
uses: astral-sh/setup-uv@v7
with:
enable-cache: true
version: latest
version: ">=0.11,<0.12"
- name: Check gitleaks
uses: gitleaks/gitleaks-action@v3
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITLEAKS_ENABLE_COMMENTS: false
- name: Setup environment
run: |
just sync
Expand Down
3 changes: 2 additions & 1 deletion Brewfile
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
brew "gitleaks"
brew "just"
brew "uv"
brew "uv"
18 changes: 11 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# Python Project Template ![](https://github.com/ahcode0919/python-project-template/actions/workflows/python.yml/badge.svg?branch=main)
# Python Project Template

[![CI](https://github.com/ahcode0919/python-project-template/actions/workflows/python.yml/badge.svg?branch=main)](https://github.com/ahcode0919/python-project-template/actions/workflows/python.yml)
[![gitleaks](https://img.shields.io/badge/protected%20by-gitleaks-blue)](https://github.com/gitleaks/gitleaks)

Baseline Python project template

Expand All @@ -23,12 +26,13 @@ Note: Project uses `uv` and `just` to manage project configuration and commands

## Project Commands

* Local
* `just lint` - lint project files
* Dev container
* `just lint` - lint and stylecheck project files
* Run unit tests: `just test`
* Install dependency: `uv add {package}`
* `just sync` - sync project dependencies (all groups)
* `just lint` - type check, lint, format, and spellcheck project files (applies fixes)
* `just ci-lint` - run the same checks without modifying files (used in CI)
* `just test` - run unit tests
* `just prek` - run pre-commit hooks via prek
* `just git-leaks` - scan staged changes for secrets with gitleaks
* `uv add {package}` - install a dependency

## Usage

Expand Down
4 changes: 4 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,15 @@ ci-lint:
uv run ruff check .
uv run ruff format --check .
uv run codespell
git-leaks:
gitleaks git --pre-commit --staged --redact
lint:
uv run ty check
uv run ruff check . --fix
uv run ruff format .
uv run codespell
prek:
uv run prek
sync:
uv sync --all-groups
test:
Expand Down
7 changes: 7 additions & 0 deletions prek.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,12 @@ hooks = [
language = "system",
entry = "just test",
pass_filenames = false
},
{
id = "git-leaks",
name = "git leaks",
language = "system",
entry = "gitleaks git --pre-commit --staged --redact",
pass_filenames = false
}
]
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name = "example"
description = "example"
version = "0.0.1"
requires-python = ">=3.14"

dependencies = []

[build-system]
Expand Down Expand Up @@ -37,3 +38,6 @@ extend-ignore = ["E501"] # Line too long (handled by formatter)

[tool.ruff.format]
quote-style = "double"

[tool.uv]
required-version = ">=0.11,<0.12"
Loading