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
8 changes: 5 additions & 3 deletions .github/workflows/ruff.yml → .github/workflows/prek.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
name: Ruff
name: Prek
on:
push:
branches: main
pull_request:
branches: "*"

jobs:
ruff:
prek:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: astral-sh/ruff-action@v3
- uses: j178/prek-action@v1
with:
extra-args: '--all-files'
2 changes: 1 addition & 1 deletion .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ jobs:
- uses: astral-sh/setup-uv@v5
- run: uv python install
- run: uv sync
- run: uv run pytest -vv
- run: uv run pytest -vv
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# python-template

This project uses [`uv`](https://github.com/astral-sh/uv), which can be installed in one line:
This project uses [`uv`](https://github.com/astral-sh/uv), which can be installed in one line:
```bash
# On macOS and Linux.
curl -LsSf https://astral.sh/uv/install.sh | sh
Expand All @@ -19,7 +19,7 @@ uv sync --dev
source .venv/bin/activate
```

For development, make sure to install the project with the `-e` flag
For development, make sure to install the project with the `-e` flag
so the source code isn't distributed to `.venv`:
```
uv pip install -e .
Expand Down
18 changes: 18 additions & 0 deletions prek.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[[repos]]
repo = "builtin"
hooks = [
{ id = "trailing-whitespace", args = ["--markdown-linebreak-ext=md"] },
{ id = "end-of-file-fixer" },
{ id = "check-yaml" },
{ id = "check-toml" },
{ id = "check-merge-conflict" },
{ id = "check-added-large-files" },
]

[[repos]]
repo = "https://github.com/astral-sh/ruff-pre-commit"
rev = "v0.15.5"
hooks = [
{ id = "ruff-check", args = ["--fix"] },
{ id = "ruff-format" },
]
1 change: 0 additions & 1 deletion src/python_template/cli.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

def main():
print("Hello from python-template")

Expand Down
4 changes: 1 addition & 3 deletions src/python_template/utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@


def foo():
return "foo"
return "foo"
3 changes: 2 additions & 1 deletion tests/test_utils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from python_template.utils import foo


def test_foo():
result = foo()
assert result == "foo"
assert result == "foo"
Loading