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
7 changes: 4 additions & 3 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": "94970ab900aed538f451686a2eb51188dbfd1a28",
"commit": "d683335f82b19e1ed2c92abf4aa6d07678e5d273",
"checkout": null,
"context": {
"cookiecutter": {
Expand All @@ -18,9 +18,10 @@
"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"
"_template": "https://github.com/getpelican/cookiecutter-pelican-plugin",
"_commit": "d683335f82b19e1ed2c92abf4aa6d07678e5d273"
}
},
"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 @@ -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
Expand All @@ -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
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.6.1
rev: v0.14.2
hooks:
- id: ruff
- id: ruff-check
- id: ruff-format
args: ["--check"]
4 changes: 4 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -0,0 +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
6 changes: 2 additions & 4 deletions pelican/plugins/minify/minify.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from fnmatch import fnmatch
from functools import lru_cache
from functools import cache
import logging
import os

Expand Down Expand Up @@ -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,
)
Expand Down Expand Up @@ -88,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.

Expand Down
21 changes: 11 additions & 10 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -27,36 +28,36 @@ 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",
]
requires-python = ">=3.8.1,<4.0"
requires-python = ">=3.10"
dependencies = [
"pelican>=4.5",
"minify_html>=0.10.8",
"minify_html>=0.17.1",
]

[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",
Expand Down
17 changes: 12 additions & 5 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 = "minify"
PKG_PATH = Path(f"pelican/plugins/{PKG_NAME}")
Expand Down Expand Up @@ -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