Skip to content
Open
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
9 changes: 5 additions & 4 deletions .github/actions/setup-python/action.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
---
name: "Setup Python and uv"
description: "Setup Python and uv with caching"
runs:
using: "composite"
steps:
- name: Set up Python
uses: actions/setup-python@v6
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version-file: "pyproject.toml"
python-version-file: "pyproject.toml"
- name: Install uv
uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7.6.0
with:
enable-cache: auto
version: 0.9.*
enable-cache: auto
version: 0.9.*
- name: Install dependencies
shell: bash
run: uv sync --locked --all-extras --dev
Expand Down
21 changes: 16 additions & 5 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,38 @@
---
name: checks
on:
pull_request:
workflow_dispatch:

permissions:
contents: read

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
persist-credentials: false
- uses: ./.github/actions/setup-python
- run: |
uv run ruff check --fix
uv run ruff format
uv run ruff check --fix
uv run ruff format

typecheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
persist-credentials: false
- uses: ./.github/actions/setup-python
- run: uv run ty check

vulture:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
persist-credentials: false
- uses: ./.github/actions/setup-python
- run: uv run vulture --min-confidence 100 --exclude ".venv" .
34 changes: 24 additions & 10 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
name: pytest
on:
pull_request:
Expand All @@ -10,21 +11,34 @@ jobs:
pytest:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
persist-credentials: false
- uses: ./.github/actions/setup-python
- run: |
uv run pytest
uv run pytest

# Browser/Playwright tests are excluded by default (pytest.ini) and run
# only on pull requests, where we install Chromium for them.
- name: Install Playwright browser
if: github.event_name == 'pull_request'
run: |
uv run playwright install --with-deps chromium
- name: Run browser tests
if: github.event_name == 'pull_request'
run: |
uv run pytest -m browser

- name: Run tests (with coverage)
run: |
uv run pytest \
--junitxml=pytest.xml \
--cov-report=term-missing:skip-covered \
--cov=. \
| tee pytest-coverage.txt
uv run pytest \
--junitxml=pytest.xml \
--cov-report=term-missing:skip-covered \
--cov=. \
| tee pytest-coverage.txt

- name: Pytest coverage comment
uses: MishaKav/pytest-coverage-comment@a01708271d42c5703d489b13eb503ba47c01e82a # main
uses: MishaKav/pytest-coverage-comment@dda025d84b1dd831193ed9cd5b1d7e33c79efa9b # v1.1.59
with:
pytest-coverage-path: ./pytest-coverage.txt
junitxml-path: ./pytest.xml
pytest-coverage-path: ./pytest-coverage.txt
junitxml-path: ./pytest.xml
9 changes: 9 additions & 0 deletions .pre-commit-config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---

repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.15.4
hooks:
- id: ruff-check
args: [--fix]
- id: ruff-format
14 changes: 14 additions & 0 deletions docs/schema/cheatsheet.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,20 @@
"default": false,
"description": "When true, free-form shortcut text is allowed; requires RenderKeys=false."
},
"theme": {
"type": "string",
"minLength": 1,
"default": "catppuccin",
"description": "Theme name: a built-in (e.g. 'catppuccin') or a user theme in the project's themes/ directory. Defaults to 'catppuccin'."
},
"custom_css": {
"type": "string",
"description": "Filename of a custom CSS file (resolved from the project's styles/ directory), layered after the theme."
},
"custom_css_inline": {
"type": "string",
"description": "Inline custom CSS, emitted last in the cascade so it overrides the theme and the custom CSS file."
},
"layout": {
"type": "object",
"additionalProperties": false,
Expand Down
32 changes: 28 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,30 @@ dependencies = ["jinja2>=3.1.6", "python-dotenv>=1.1.1", "ruamel-yaml>=0.18.14"]

[dependency-groups]
dev = [
"bandit>=1.8.6",
"prek>=0.3.6",
"pytest>=8.4.2",
"pytest-cov>=7.0.0",
"pytest-cov>=7.1.0",
"pytest-playwright>=0.7.1",
"ruff>=0.14.0",
"ty>=0.0.1a22",
"vulture>=2.14",
]

[build-system]
requires = ["uv_build>=0.10.9,<0.11.0"]
build-backend = "uv_build"

[tool.coverage.run]
omit = ["tests/*"]

[tool.ruff]
indent-width = 4
line-length = 120

[tool.ruff.lint]
# select = ["ALL"]
ignore = [
"ANN", # flake8-annotations
"COM", # flake8-commas
"C90", # mccabe complexity
"DJ", # django
"EXE", # flake8-executable
"BLE", # blind except
Expand All @@ -52,6 +58,24 @@ ignore = [
"TRY",
"SIM105", # faster without contextlib
]
extend-select = [
"F", # Pyflakes rules
"W", # PyCodeStyle warnings
"E", # PyCodeStyle errors
"I", # Sort imports properly
"UP", # Warn if certain things can changed due to newer Python versions
"C4", # Catch incorrect use of comprehensions, dict, list, etc
"FA", # Enforce from __future__ import annotations
"ISC", # Good use of string concatenation
"ICN", # Use common import conventions
"RET", # Good return practices
"SIM", # Common simplification rules
"TID", # Some good import practices
"TC", # Enforce importing certain types in a TYPE_CHECKING block
"PTH", # Use pathlib instead of os.path
"TD", # Be diligent with TODO comments
"C90",
]
fixable = ["ALL"]
unfixable = []
# Allow unused variables when underscore-prefixed.
Expand Down
5 changes: 4 additions & 1 deletion pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@ testpaths = tests
python_files = test_*.py
python_classes = Test*
python_functions = test_*
addopts =
addopts =
-v
--tb=short
--strict-markers
--disable-warnings
-m "not browser"
markers =
browser: browser-based Playwright tests

File renamed without changes.
Loading
Loading