diff --git a/.cruft.json b/.cruft.json index 710dd6c..a26761f 100644 --- a/.cruft.json +++ b/.cruft.json @@ -1,6 +1,6 @@ { "template": "https://github.com/getpelican/cookiecutter-pelican-plugin", - "commit": "b4b9b4f83b624cfd7728a3f1527d272be28ee916", + "commit": "ae9637f57b4da194014a7b27e32075a484041a30", "checkout": null, "context": { "cookiecutter": { @@ -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 diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 412699e..58e9b39 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 82c5d8f..43d3879 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -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 @@ -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"] diff --git a/RELEASE.md b/RELEASE.md new file mode 100644 index 0000000..74bf747 --- /dev/null +++ b/RELEASE.md @@ -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 diff --git a/pelican/plugins/search/search.py b/pelican/plugins/search/search.py index 54c6b5e..7a089de 100644 --- a/pelican/plugins/search/search.py +++ b/pelican/plugins/search/search.py @@ -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 @@ -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"]: diff --git a/pyproject.toml b/pyproject.toml index 9131ac0..9d1bb71 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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", @@ -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" diff --git a/tasks.py b/tasks.py index d60479e..68c2304 100644 --- a/tasks.py +++ b/tasks.py @@ -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}") @@ -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" @@ -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) diff --git a/tests/test_search_settings_generator.py b/tests/test_search_settings_generator.py index 1b3f4b2..9b5ac55 100644 --- a/tests/test_search_settings_generator.py +++ b/tests/test_search_settings_generator.py @@ -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={},