From 4abb759e58c175c564c3e30b5677a537bce806af Mon Sep 17 00:00:00 2001 From: Paolo Melchiorre Date: Fri, 24 Oct 2025 19:26:31 +0200 Subject: [PATCH 1/5] Fix #6 - Remove default parameters changed in minify-html 0.17.1 --- RELEASE.md | 3 +++ pelican/plugins/minify/minify.py | 2 -- pyproject.toml | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) create mode 100644 RELEASE.md diff --git a/RELEASE.md b/RELEASE.md new file mode 100644 index 0000000..d644bbd --- /dev/null +++ b/RELEASE.md @@ -0,0 +1,3 @@ +Release type: patch + +- Fix compatibility with minify-html 0.17.1 and newer diff --git a/pelican/plugins/minify/minify.py b/pelican/plugins/minify/minify.py index ee21312..1a5227c 100644 --- a/pelican/plugins/minify/minify.py +++ b/pelican/plugins/minify/minify.py @@ -58,8 +58,6 @@ def __init__(self, pelican): def minify(self, content, minify_css, minify_js): return minify_html.minify( content, - do_not_minify_doctype=True, - keep_spaces_between_attributes=True, minify_css=minify_css, minify_js=minify_js, ) diff --git a/pyproject.toml b/pyproject.toml index 89ece17..8bb2edd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,6 +6,7 @@ authors = [ {name = "Alexander Herrmann", email = "106409+dArignac@users.noreply.github.com"}, {name = "Justin Mayer", email = "entroP@gmail.com"}, {name = "Ysard", email = "ysard@users.noreply.github.com"}, + {name = "Paolo Melchiorre", email = "paolo@melchiorre.org"}, ] keywords = [ "pelican", @@ -38,7 +39,7 @@ classifiers = [ requires-python = ">=3.8.1,<4.0" dependencies = [ "pelican>=4.5", - "minify_html>=0.10.8", + "minify_html>=0.17.1", ] [project.urls] From 1ed270650307f471319c9425caba953878bb7fd1 Mon Sep 17 00:00:00 2001 From: Justin Mayer Date: Fri, 31 Oct 2025 10:06:12 +0100 Subject: [PATCH 2/5] chore: Apply upstream template changes via Cruft --- .cruft.json | 5 +++-- .github/workflows/main.yml | 21 ++++++++++++--------- .pre-commit-config.yaml | 6 +++--- pyproject.toml | 16 ++++++++-------- tasks.py | 17 ++++++++++++----- 5 files changed, 38 insertions(+), 27 deletions(-) diff --git a/.cruft.json b/.cruft.json index 76d0e2f..723afec 100644 --- a/.cruft.json +++ b/.cruft.json @@ -1,6 +1,6 @@ { "template": "https://github.com/getpelican/cookiecutter-pelican-plugin", - "commit": "94970ab900aed538f451686a2eb51188dbfd1a28", + "commit": "d683335f82b19e1ed2c92abf4aa6d07678e5d273", "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": "d683335f82b19e1ed2c92abf4aa6d07678e5d273" } }, "directory": null diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e9a2dc0..a387288 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 @@ -48,7 +52,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 @@ -68,18 +72,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 1f1400a..06b0305 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.6.1 + rev: v0.14.2 hooks: - - id: ruff + - id: ruff-check - id: ruff-format args: ["--check"] diff --git a/pyproject.toml b/pyproject.toml index 8bb2edd..93d53b2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -28,11 +28,11 @@ classifiers = [ "License :: OSI Approved :: MIT License", "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", ] @@ -43,21 +43,21 @@ dependencies = [ ] [project.urls] -Homepage = "https://github.com/pelican-plugins/minify" +"Homepage" = "https://github.com/pelican-plugins/minify" "Issue Tracker" = "https://github.com/pelican-plugins/minify/issues" -Funding = "https://donate.getpelican.com/" +"Changelog" = "https://github.com/pelican-plugins/minify/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.6.0,<0.7.0", + "ruff>=0.14.2,<1.0.0", ] test = [ + "invoke>=2.2", "markdown>=3.4", "pytest>=7.0", "pytest-cov>=4.0", diff --git a/tasks.py b/tasks.py index e4e3790..8dc99af 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 = "minify" PKG_PATH = Path(f"pelican/plugins/{PKG_NAME}") @@ -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) From 438ac5345f2b6fbfd5a597aba60640fd87c123a7 Mon Sep 17 00:00:00 2001 From: Justin Mayer Date: Fri, 31 Oct 2025 10:16:51 +0100 Subject: [PATCH 3/5] Update `requires-python` to Python 3.10+ --- .cruft.json | 2 +- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.cruft.json b/.cruft.json index 723afec..02a2df8 100644 --- a/.cruft.json +++ b/.cruft.json @@ -18,7 +18,7 @@ "repo_url": "https://github.com/pelican-plugins/minify", "dev_status": "5 - Production/Stable", "tests_exist": true, - "python_version": ">=3.8.1,<4.0", + "python_version": ">=3.10", "pelican_version": ">=4.5", "_template": "https://github.com/getpelican/cookiecutter-pelican-plugin", "_commit": "d683335f82b19e1ed2c92abf4aa6d07678e5d273" diff --git a/pyproject.toml b/pyproject.toml index 93d53b2..ab10166 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -36,7 +36,7 @@ classifiers = [ "Topic :: Internet :: WWW/HTTP", "Topic :: Software Development :: Libraries :: Python Modules", ] -requires-python = ">=3.8.1,<4.0" +requires-python = ">=3.10" dependencies = [ "pelican>=4.5", "minify_html>=0.17.1", From 9d0b25da792343416cf649899018810618802061 Mon Sep 17 00:00:00 2001 From: Justin Mayer Date: Fri, 31 Oct 2025 10:19:54 +0100 Subject: [PATCH 4/5] Upgrade code for Python 3.10+ --- pelican/plugins/minify/minify.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pelican/plugins/minify/minify.py b/pelican/plugins/minify/minify.py index 1a5227c..8b8b25d 100644 --- a/pelican/plugins/minify/minify.py +++ b/pelican/plugins/minify/minify.py @@ -1,5 +1,5 @@ from fnmatch import fnmatch -from functools import lru_cache +from functools import cache import logging import os @@ -86,7 +86,7 @@ def write_to_file(path_file, callback): ) from e -@lru_cache(maxsize=None) +@cache def minify_method(method, content): """Wrap the minify method with a cached version. From 65d3659c3e1887b51dfc003e9c59448d8faf9e95 Mon Sep 17 00:00:00 2001 From: Justin Mayer Date: Fri, 31 Oct 2025 10:35:10 +0100 Subject: [PATCH 5/5] Prepare release --- RELEASE.md | 1 + 1 file changed, 1 insertion(+) diff --git a/RELEASE.md b/RELEASE.md index d644bbd..de996da 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -1,3 +1,4 @@ Release type: patch - Fix compatibility with minify-html 0.17.1 and newer +- Add Python 3.13 & 3.14 and drop Python 3.8 & 3.9