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
5 changes: 3 additions & 2 deletions .cruft.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"template": "https://github.com/getpelican/cookiecutter-pelican-plugin",
"commit": "b4b9b4f83b624cfd7728a3f1527d272be28ee916",
"commit": "ae9637f57b4da194014a7b27e32075a484041a30",
"checkout": null,
"context": {
"cookiecutter": {
Expand All @@ -20,7 +20,8 @@
"tests_exist": true,
"python_version": ">=3.8.1,<4.0",
"pelican_version": ">=4.5",
"_template": "https://github.com/getpelican/cookiecutter-pelican-plugin"
"_template": "https://github.com/getpelican/cookiecutter-pelican-plugin",
"_commit": "ae9637f57b4da194014a7b27e32075a484041a30"
}
},
"directory": null
Expand Down
21 changes: 12 additions & 9 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
with:
persist-credentials: false

- name: Set up Python ${{ matrix.python-version }} & PDM
uses: pdm-project/setup-pdm@v4
Expand All @@ -37,7 +39,9 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
with:
persist-credentials: false

- name: Validate links in Markdown files
uses: JustinBeckwith/linkinator-action@v1
Expand All @@ -47,7 +51,7 @@ jobs:
- name: Set up Python & PDM
uses: pdm-project/setup-pdm@v4
with:
python-version: "3.10"
python-version: "3.11"

- name: Install dependencies
run: pdm install
Expand All @@ -67,18 +71,17 @@ jobs:
id-token: write

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5

- name: Set up Python
uses: actions/setup-python@v5
uses: actions/setup-python@v6
with:
python-version: "3.10"
python-version: "3.11"

- name: Check release
id: check_release
run: |
python -m pip install autopub httpx
python -m pip install https://github.com/scikit-build/github-release/archive/master.zip
python -m pip install autopub[github]
autopub check

- name: Publish
Expand Down
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ ci:
# See https://pre-commit.com/hooks.html for info on hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v6.0.0
hooks:
- id: check-added-large-files
- id: check-ast
Expand All @@ -21,8 +21,8 @@ repos:
- id: trailing-whitespace

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.5.1
rev: v0.15.9
hooks:
- id: ruff
- id: ruff-check
- id: ruff-format
args: ["--check"]
5 changes: 5 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Release type: patch

- Write `search.toml` with UTF-8 encoding
- Support Python 3.13 & 3.14
- Drop Python 3.8 & 3.9 support
3 changes: 1 addition & 2 deletions pelican/plugins/search/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from pathlib import Path
from shutil import which
import subprocess
from typing import Dict, List

from jinja2.filters import do_striptags as striptags
import rtoml
Expand Down Expand Up @@ -101,7 +100,7 @@ def _index_output(self) -> bool:

def get_input_files(
self,
) -> List[Dict]:
) -> list[dict]:
pages = self.context["pages"] + self.context["articles"]

for article in self.context["articles"]:
Expand Down
22 changes: 11 additions & 11 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,36 +15,36 @@ classifiers = [
"License :: OSI Approved :: GNU Affero General Public License v3",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"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",
"Topic :: Internet :: WWW/HTTP",
"Topic :: Software Development :: Libraries :: Python Modules",
]
requires-python = ">=3.8.1,<4.0"
requires-python = ">=3.10,<4.0"
dependencies = [
"pelican>=4.5",
"rtoml>=0.9.0",
"rtoml>=0.13.0",
]

[project.urls]
Homepage = "https://github.com/pelican-plugins/search"
"Homepage" = "https://github.com/pelican-plugins/search"
"Issue Tracker" = "https://github.com/pelican-plugins/search/issues"
Funding = "https://donate.getpelican.com/"
"Changelog" = "https://github.com/pelican-plugins/search/blob/main/CHANGELOG.md"
"Funding" = "https://donate.getpelican.com/"

[project.optional-dependencies]
markdown = ["markdown>=3.4"]

[tool.pdm]

[tool.pdm.dev-dependencies]
[dependency-groups]
lint = [
"invoke>=2.2",
"ruff>=0.5.0,<0.6.0"
"ruff>=0.15.9,<1.0.0",
]
test = [
"invoke>=2.2",
"chardet>=5.2",
"markdown>=3.4",
"pytest>=7.0",
Expand All @@ -59,7 +59,7 @@ source-includes = [
"CONTRIBUTING.md",
]
includes = ["pelican/"]
excludes = ["**/.DS_Store", "**/test_data/**", "tasks.py"]
excludes = ["**/.DS_Store"]

[tool.autopub]
project-name = "Search"
Expand Down
21 changes: 14 additions & 7 deletions tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
from invoke import task

logger = logging.getLogger(__name__)
level = logging.INFO
logger.setLevel(level)
console_handler = logging.StreamHandler()
console_handler.setLevel(level)
logger.addHandler(console_handler)

PKG_NAME = "search"
PKG_PATH = Path(f"pelican/plugins/{PKG_NAME}")
Expand All @@ -18,11 +23,11 @@
BIN_DIR = "bin" if os.name != "nt" else "Scripts"
VENV_BIN = Path(VENV) / Path(BIN_DIR)

TOOLS = ("cruft", "pdm", "pre-commit")
TOOLS = ("cruft", "pdm", "prek")
PDM = which("pdm") if which("pdm") else (VENV_BIN / "pdm")
CMD_PREFIX = f"{VENV_BIN}/" if ACTIVE_VENV else f"{PDM} run "
CRUFT = which("cruft") if which("cruft") else f"{CMD_PREFIX}cruft"
PRECOMMIT = which("pre-commit") if which("pre-commit") else f"{CMD_PREFIX}pre-commit"
PRECOMMIT = which("prek") if which("prek") else f"{CMD_PREFIX}prek"
PTY = os.name != "nt"


Expand All @@ -47,20 +52,22 @@ def format(c, check=False, diff=False):


@task
def ruff(c, fix=False, diff=False):
def ruff(c, concise=False, fix=False, diff=False):
"""Run Ruff to ensure code meets project standards."""
diff_flag, fix_flag = "", ""
concise_flag, fix_flag, diff_flag = "", "", ""
if concise:
concise_flag = "--output-format=concise"
if fix:
fix_flag = "--fix"
if diff:
diff_flag = "--diff"
c.run(f"{CMD_PREFIX}ruff check {diff_flag} {fix_flag} .", pty=PTY)
c.run(f"{CMD_PREFIX}ruff check {concise_flag} {diff_flag} {fix_flag} .", pty=PTY)


@task
def lint(c, fix=False, diff=False):
def lint(c, concise=False, fix=False, diff=False):
"""Check code style via linting tools."""
ruff(c, fix=fix, diff=diff)
ruff(c, concise=concise, fix=fix, diff=diff)
format(c, check=(not fix), diff=diff)


Expand Down
2 changes: 1 addition & 1 deletion tests/test_search_settings_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def test_raise_exception_if_stork_not_there(self, mocker: MockerFixture):
)

with pytest.raises(
Exception, match="Stork must be installed and available on \\$PATH."
Exception, match=r"Stork must be installed and available on \$PATH."
):
generator = SearchSettingsGenerator(
context={},
Expand Down
Loading