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
36 changes: 36 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Build

on:
push:
branches:
- master
- main
- tmp-*
pull_request:

jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true

- name: Set up uv
uses: astral-sh/setup-uv@v6

- name: Install dependencies
run: uv sync --group dev

- name: Run tests
run: make test
33 changes: 12 additions & 21 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,38 +1,29 @@
PYTHON?=python
SOURCES=regen.py regen-git.py test_skel.py

UV:=$(shell uv --version)
ifdef UV
VENV:=uv venv
PIP:=uv pip
else
VENV:=python -m venv
PIP:=python -m pip
endif

.PHONY: venv
venv:
$(VENV) .venv
source .venv/bin/activate && make setup
venv: setup
@echo 'run `source .venv/bin/activate` to use virtualenv'

# The rest of these are intended to be run within the venv, where python points
# to whatever was used to set up the venv.

.PHONY: setup
setup:
$(PIP) install -Ur requirements-dev.txt
uv sync --group dev

.PHONY: test
test:
uv run coverage run -m pytest $(TESTOPTS)
uv run coverage report

.PHONY: format
format:
ruff format
ruff check --fix
uv run ruff format
uv run ruff check --fix

.PHONY: lint
lint:
ruff check $(SOURCES)
mypy --strict $(SOURCES)
uv run ruff check $(SOURCES)
uv run mypy --strict $(SOURCES)

.PHONY: checkdeps
checkdeps:
python -m checkdeps . --allow-names regen
uv run python -m checkdeps . --allow-names regen
41 changes: 40 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,47 @@
[project]
name = "skel"
version = "0"
requires-python = ">=3.10"
dependencies = []

[dependency-groups]
dev = [
"build >= 1",
"checkdeps == 0.9.0",
"coverage >= 7.14",
"mypy == 1.8.0",
"pytest >= 8",
"ruff == 0.8.0",
"volatile == 2.1.0",
"wheel == 0.42.0",
]

[tool.coverage.run]
branch = true
parallel = true
source = ["regen"]

[tool.coverage.report]
fail_under = 30
precision = 1
show_missing = true
skip_covered = true

[tool.pytest.ini_options]
addopts = "-ra"
testpaths = ["."]
python_files = ["test_*.py"]

[tool.ruff]
line-length = 88
target-version = "py310"

[tool.ruff.lint]
extend-select = [
select = [
"E4",
"E7",
"E9",
"F",
"I", # isort
]

Expand Down
7 changes: 0 additions & 7 deletions requirements-dev.txt

This file was deleted.

12 changes: 5 additions & 7 deletions templates/.github/workflows/build.yml.in
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ on:
- v*
pull_request:

env:
UV_SYSTEM_PYTHON: 1

jobs:
test:
runs-on: ${{ matrix.os }}
Expand All @@ -31,8 +28,7 @@ jobs:
allow-prereleases: true
- uses: astral-sh/setup-uv@v3
- name: Install
run: |
uv pip install -e .[test,dev]
run: uv sync --extra test --extra dev
- name: Test
run: |
git config --global user.name "Unit Test"
Expand All @@ -52,9 +48,9 @@ jobs:
python-version: "3.14"
- uses: astral-sh/setup-uv@v3
- name: Install
run: uv pip install build
run: uv sync --extra test --extra dev
- name: Build
run: python -m build
run: uv run python -m build
- name: Upload
uses: actions/upload-artifact@v4
with:
Expand All @@ -65,7 +61,9 @@ jobs:
needs: build
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
environment: pypi
permissions:
contents: read
id-token: write
steps:
- uses: actions/download-artifact@v4
Expand Down
2 changes: 0 additions & 2 deletions templates/MANIFEST.in.in

This file was deleted.

35 changes: 10 additions & 25 deletions templates/Makefile.in
Original file line number Diff line number Diff line change
@@ -1,37 +1,22 @@
ifeq ($(OS),Windows_NT)
ACTIVATE:=.venv/Scripts/activate
else
ACTIVATE:=.venv/bin/activate
endif

UV:=$(shell uv --version)
ifdef UV
VENV:=uv venv
PIP:=uv pip
else
VENV:=python -m venv
PIP:=python -m pip
endif

.venv:
$(VENV) .venv
uv sync --extra dev --extra test

.PHONY: setup
setup: .venv
source $(ACTIVATE) && $(PIP) install -Ue .[dev,test]
setup:
uv sync --extra dev --extra test

.PHONY: test
test:
python -m coverage run -m pytest $(TESTOPTS)
python -m coverage report
uv run coverage run -m pytest $(TESTOPTS)
uv run coverage report

.PHONY: format
format:
ruff format
ruff check --fix
uv run ruff format
uv run ruff check --fix

.PHONY: lint
lint:
ruff check
python -m checkdeps --allow-names {package} {package}
mypy --strict --install-types --non-interactive {package}
uv run ruff check
uv run python -m checkdeps --allow-names {package} {package}
uv run mypy --strict --install-types --non-interactive {package}
15 changes: 0 additions & 15 deletions templates/pyproject.toml

This file was deleted.

93 changes: 93 additions & 0 deletions templates/pyproject.toml.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
[build-system]
requires = [
"setuptools >= 77",
"setuptools-scm >= 8",
]
build-backend = "setuptools.build_meta"

[project]
name = "{pypi_name}"
description = "{short_desc}"
readme = "README.md"
requires-python = ">=3.10"
license = "MIT"
authors = [
{ name = "{author}", email = "{author_email}" },
]
classifiers = [
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
]
dynamic = ["version"]
dependencies = []

[project.urls]
Homepage = "{url}"

[project.optional-dependencies]
dev = [
"build >= 1",
"checkdeps == 0.9.0",
"mypy == 1.19.1",
"ruff == 0.15.6",
]
test = [
"coverage >= 7.14",
"pytest >= 8",
]

[project.scripts]
# foo = "foo:bar"

[tool.setuptools]
packages = { find = {} }
include-package-data = true

[tool.setuptools.package-data]
"{package}" = ["py.typed"]

[tool.setuptools_scm]
version_file = "{package}/_version.py"

[tool.coverage.run]
branch = true
parallel = true
source = ["{package}", "tests"]

[tool.coverage.report]
fail_under = 70
precision = 1
show_missing = true
skip_covered = true

[tool.pytest.ini_options]
addopts = "-ra"
testpaths = ["tests"]

[tool.mypy]
ignore_missing_imports = true

[tool.ruff]
line-length = 88
target-version = "py310"

[tool.ruff.lint]
select = [
"E4",
"E7",
"E9",
"F",
"I", # isort
]

[tool.ruff.lint.isort]
order-by-type = false

[tool.ruff.lint.per-file-ignores]
"tests/*" = [
"PLR2004", # Magic value used instead of constant (only in tests)
]
Loading
Loading