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
39 changes: 24 additions & 15 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,24 @@ permissions:
contents: read

jobs:
lint:
lint-pelican:
runs-on: ubuntu-latest
# GitHub Actions log output is not a TTY, so tools that autodetect
# colors turn them off in CI. Force colorized output via the common
# `FORCE_COLOR` convention (honored by pylint, rich, uv, etc.) plus
# `PY_COLORS=1` which mypy's `rich`-based pretty printer picks up.
# The per-tool flags below (`--output-format=colorized`,
# `--color-output`) make the intent explicit and work even for
# tools that don't read the env vars.
env:
FORCE_COLOR: "1"
PY_COLORS: "1"
defaults:
run:
# Applies to every `run:` step in this job; `uses:` steps are
# unaffected, so setup-uv's `cache-dependency-glob` below still
# resolves from the repository root.
working-directory: pelican
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
Expand All @@ -42,21 +58,14 @@ jobs:
with:
python-version: '3.11'

- name: Install dependencies
run: |
pip list
cd pelican
pip install -r requirements.txt --no-deps # Explicit dependency-only installation
pip install mypy types-PyYAML types-requests types-beautifulsoup4 types-markdown pylint
pip list
- name: Set up uv
uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0
with:
enable-cache: true
cache-dependency-glob: "pelican/uv.lock"

- name: Type testing with mypy
run: |
cd pelican
mypy --cache-dir /tmp/ --install-types --non-interactive
mypy --cache-dir /tmp/ --ignore-missing-imports .
run: uv run mypy --color-output --pretty --ignore-missing-imports .

- name: Code linting with pylint
run: |
cd pelican
pylint **/*.py
run: uv run pylint --output-format=colorized **/*.py
2 changes: 1 addition & 1 deletion pelican/plugin_paths.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@

"""

import sys
import json
import sys

DEFAULT_PELCONF = 'pelicanconf.py' # in current dir

Expand Down
4 changes: 0 additions & 4 deletions pelican/pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,6 @@ persistent=yes
# the version used to run pylint.
py-version=3.10

# When enabled, pylint would attempt to guess common misconfiguration and emit
# user-friendly hints instead of false-positive error messages.
suggestion-mode=yes

# Allow loading of arbitrary C extensions. Extensions are imported into the
# active Python interpreter and may run arbitrary code.
unsafe-load-any-extension=no
Expand Down
10 changes: 9 additions & 1 deletion pelican/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,20 @@ dependencies = [
# but the runtime install does not: Pelican itself (installed by the action
# at runtime via `uv tool install 'pelican[markdown]==<version>'`, with the
# version controlled by the action's `version` input rather than this file),
# plus linting and test tooling.
# plus linting, type-checking and test tooling. The `Linting and MyPy
# (Pelican)` workflow syncs this group via `uv sync --no-install-project`
# and runs mypy / pylint out of the resulting venv.
[dependency-groups]
dev = [
"pelican[markdown]>=4.11,<4.12",
"ruff>=0.6",
"pytest>=8",
"mypy>=1.10",
"pylint>=3",
"types-PyYAML>=6.0",
"types-requests>=2.33",
"types-beautifulsoup4>=4.12",
"types-markdown>=3.10",
]

[project.urls]
Expand Down
Loading