Skip to content

Commit b75b04e

Browse files
add justfile and python version file
1 parent f72c7b6 commit b75b04e

File tree

6 files changed

+35
-6
lines changed

6 files changed

+35
-6
lines changed

template/.python-version.jinja

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{{python_version}}

template/justfile

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
default:
2+
@just --list
3+
4+
# setup for development
5+
setup: install git-setup
6+
7+
# install the packages
8+
install:
9+
{{if path_exists("uv.lock") != "true" {"uv sync --dev --all-extras --inexact"} else {"uv sync --dev --all-extras --locked --inexact"} }}
10+
11+
# ensure code quality before git commit via pre-commit and nbwipers
12+
git-setup: install
13+
uv run nbwipers install local
14+
uv run pre-commit install --install-hooks
15+
16+
# format and sort imports
17+
format:
18+
uv run ruff check --fix --select=I001 .
19+
uv run ruff format .
20+
21+
# autofix with ruff
22+
autofix:
23+
uv run ruff --fix --show-fixes .
24+
25+
# lint with ruff
26+
lint:
27+
uv run ruff check --output-format=full .

template/pyproject.toml.jinja

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ select = ["ALL"]
1717
ignore = ["COM", "ERA", "ISC001"]
1818

1919
[tool.ruff.lint.per-file-ignores]
20-
"!{{module_name}}/**.py" = ["ANN", "D"]
20+
"!{{module_name}}/**.py" = ["ANN", "D", "S101", "PLR2004", "T20"]
2121

2222
[tool.ruff.lint.isort]
2323
required-imports = ["from __future__ import annotations"]
@@ -33,5 +33,6 @@ dev-dependencies = [
3333
"nbwipers>=0.6.0",
3434
"ruff>=0.9.2",
3535
"pytest>=8",
36-
"pytest-cov>=6.0.0"
36+
"pytest-cov>=6.0.0",
37+
"pre-commit>=4.1.0",
3738
]

template/tests/__init__.py.jinja

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
"""Tests for {{project_name}}"""
1+
"""Tests for {{project_name}}."""

template/{% if github_actions %}.github{% endif %}/workflows/ci.yml.jinja

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
- name: "Set up Python"
2626
uses: actions/setup-python@v5
2727
with:
28-
python-version: "{{python_version}}"
28+
python-version-file: ".python-version"
2929
- name: Install the project
3030
run: uv sync --all-extras --dev
3131
- name: check format
@@ -41,7 +41,7 @@ jobs:
4141
- name: "Set up Python"
4242
uses: actions/setup-python@v5
4343
with:
44-
python-version: "{{python_version}}"
44+
python-version-file: ".python-version"
4545
- name: Install the project
4646
run: uv sync --all-extras --dev
4747
- name: unit tests
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
"""Module for {{project_name}}"""
1+
"""Module for {{project_name}}."""
22

33
from __future__ import annotations

0 commit comments

Comments
 (0)