From 5bb7cd83996e7edec4fcc1ef51658cb30797e175 Mon Sep 17 00:00:00 2001 From: Justin Mayer Date: Wed, 19 Feb 2025 19:04:44 +0100 Subject: [PATCH 1/8] Use PDM+Ruff instead of Poetry+Black+Flake+isort --- .github/workflows/main.yml | 104 ++++++++++++++---------------- .gitignore | 4 ++ .pre-commit-config.yaml | 29 +++------ pyproject.toml | 125 ++++++++++++++++++++++++------------- tasks.py | 85 ++++++++++++++----------- tox.ini | 3 - 6 files changed, 190 insertions(+), 160 deletions(-) delete mode 100644 tox.ini diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 020c3a6..e978a35 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -5,98 +5,90 @@ on: [push, pull_request] env: PYTEST_ADDOPTS: "--color=yes" +permissions: + contents: read + jobs: test: - name: Test - ${{ matrix.python-version }} + name: Test - Python ${{ matrix.python-version }} runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.8", "3.9", "3.10", "3.11"] + python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] steps: - - uses: actions/checkout@v2 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - - name: Set up Pip cache - uses: actions/cache@v2 - id: pip-cache + - uses: actions/checkout@v4 with: - path: ~/.cache/pip - key: pip-${{ hashFiles('**/pyproject.toml') }} - - name: Upgrade Pip - run: python -m pip install --upgrade pip - - name: Install Poetry - run: python -m pip install poetry - - name: Set up Poetry cache - uses: actions/cache@v2 - id: poetry-cache + persist-credentials: false + + - name: Set up Python ${{ matrix.python-version }} & PDM + uses: pdm-project/setup-pdm@v4 with: - path: ~/.cache/pypoetry/virtualenvs - key: poetry-${{ hashFiles('**/poetry.lock') }} + python-version: ${{ matrix.python-version }} + cache: true + cache-dependency-path: ./pyproject.toml + - name: Install dependencies - run: | - poetry run pip install --upgrade pip - poetry install + run: pdm install + - name: Run tests - run: poetry run invoke tests + run: pdm run invoke tests lint: name: Lint runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Set up Python - uses: actions/setup-python@v2 + - uses: actions/checkout@v4 with: - python-version: "3.9" - - name: Set Poetry cache - uses: actions/cache@v2 - id: poetry-cache + persist-credentials: false + + - name: Set up Python & PDM + uses: pdm-project/setup-pdm@v4 with: - path: ~/.cache/pypoetry/virtualenvs - key: poetry-${{ hashFiles('**/poetry.lock') }} - - name: Upgrade Pip - run: python -m pip install --upgrade pip - - name: Install Poetry - run: python -m pip install poetry + python-version: "3.10" + - name: Install dependencies - run: | - poetry run pip install --upgrade pip - poetry install + run: pdm install + - name: Run linters - run: poetry run invoke lint --diff + run: pdm run invoke lint --diff deploy: name: Deploy environment: Deployment needs: [test, lint] runs-on: ubuntu-latest - if: ${{ github.ref=='refs/heads/main' && github.event_name!='pull_request' }} + if: github.ref=='refs/heads/main' && github.event_name!='pull_request' + + permissions: + contents: write + id-token: write steps: - - uses: actions/checkout@v2 - - name: Setup Python - uses: actions/setup-python@v2 + - uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 with: - python-version: "3.9" + python-version: "3.10" + - name: Check release id: check_release run: | - python -m pip install --upgrade pip - python -m pip install poetry githubrelease httpx==0.18.2 autopub - echo "##[set-output name=release;]$(autopub check)" + python -m pip install autopub[github] + autopub check + - name: Publish - if: ${{ steps.check_release.outputs.release=='' }} + if: ${{ steps.check_release.outputs.autopub_release=='true' }} env: - GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} - PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - git remote set-url origin https://$GITHUB_TOKEN@github.com/${{ github.repository }} autopub prepare - poetry build autopub commit + autopub build autopub githubrelease - poetry publish -u __token__ -p $PYPI_PASSWORD + + - name: Upload package to PyPI + if: ${{ steps.check_release.outputs.autopub_release=='true' }} + uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/.gitignore b/.gitignore index 15983ba..6a61316 100644 --- a/.gitignore +++ b/.gitignore @@ -37,6 +37,10 @@ share/python-wheels/ *.egg MANIFEST +# PDM +.pdm-python +pdm.lock + # Poetry poetry.lock diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1addff5..9a37874 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -5,11 +5,12 @@ ci: # See https://pre-commit.com/hooks.html for info on hooks repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.4.0 + rev: v5.0.0 hooks: - id: check-added-large-files - id: check-ast - id: check-case-conflict + - id: check-docstring-first - id: check-merge-conflict - id: check-toml - id: check-yaml @@ -19,25 +20,9 @@ repos: - id: forbid-new-submodules - id: trailing-whitespace - - repo: https://github.com/psf/black - rev: 23.3.0 + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.9.6 hooks: - - id: black - - - repo: https://github.com/PyCQA/flake8 - rev: 3.9.2 - hooks: - - id: flake8 - args: [--max-line-length=88] - language_version: python3 - - - repo: https://github.com/PyCQA/isort - rev: 5.12.0 - hooks: - - id: isort - - - repo: https://github.com/asottile/pyupgrade - rev: v3.3.1 - hooks: - - id: pyupgrade - args: [--py36-plus] + - id: ruff + - id: ruff-format + args: ["--check"] diff --git a/pyproject.toml b/pyproject.toml index 5461458..8f3d078 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,72 +1,109 @@ -[tool.poetry] +[project] name = "pelican-tailwindcss" version = "0.2.0" -description = "Pelican plugin to add TailwindCSS to your website." -authors = ["Luca Fedrizzi "] -license = "AGPL-3.0" +description = "Pelican plugin to add Tailwind CSS to your web site" +authors = [{name = "Pelican Dev Team", email = "authors@getpelican.com"}] +license = {text = "AGPL-3.0"} readme = "README.md" keywords = ["pelican", "plugin", "tailwindcss", "css", "css-framework"] -repository = "https://github.com/pelican-plugins/tailwindcss" -documentation = "https://docs.getpelican.com" -packages = [ - { include = "pelican" }, -] - classifiers = [ - "Development Status :: 1 - Planning", + "Development Status :: 4 - Beta", "Environment :: Console", "Framework :: Pelican", "Framework :: Pelican :: Plugins", "Intended Audience :: End Users/Desktop", + "License :: OSI Approved :: GNU Affero General Public License v3", "Operating System :: OS Independent", + "Programming Language :: Python :: 3", + "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", "Topic :: Internet :: WWW/HTTP", "Topic :: Software Development :: Libraries :: Python Modules", ] +requires-python = "~=3.9" +dependencies = [ + "pelican>=4.5", +] -[tool.poetry.urls] -"Funding" = "https://donate.getpelican.com/" +[project.urls] +"Homepage" = "https://github.com/pelican-plugins/tailwindcss" "Issue Tracker" = "https://github.com/pelican-plugins/tailwindcss/issues" +"Changelog" = "https://github.com/pelican-plugins/tailwindcss/blob/main/CHANGELOG.md" +"Funding" = "https://donate.getpelican.com/" -[tool.poetry.dependencies] -python = ">=3.8.1,<4.0" -pelican = ">=4.5" -markdown = {version = ">=3.2", optional = true} +[project.optional-dependencies] +markdown = ["markdown>=3.4"] -[tool.poetry.dev-dependencies] -black = "^23" -flake8 = "^3.9" -flake8-black = "^0.3" -invoke = "^2.0" -isort = "^5.12" -livereload = "^2.6" -markdown = "^3.3" -pytest = "^7.0" -pytest-cov = "^3.0" -pytest-pythonpath = "^0.7" -pytest-sugar = "^0.9" -Werkzeug = ">=1.0" +[dependency-groups] +lint = [ + "invoke>=2.2", + "ruff>=0.9.1,<1.0.0", +] +test = [ + "invoke>=2.2", + "markdown>=3.4", + "pytest>=7.0", + "pytest-cov>=4.0", + "pytest-sugar>=1.0", +] -[tool.poetry.extras] -markdown = ["markdown"] +[tool.pdm.build] +source-includes = [ + "CHANGELOG.md", + "CONTRIBUTING.md", +] +includes = ["pelican/"] +excludes = ["**/.DS_Store", "**/test_data/**", "tasks.py"] [tool.autopub] -project-name = "tailwindcss" +project-name = "Tailwind CSS" git-username = "botpub" git-email = "52496925+botpub@users.noreply.github.com" append-github-contributor = true -[tool.isort] -# Maintain compatibility with Black -profile = "black" -multi_line_output = 3 +[tool.ruff.lint] +select = [ + "B", # flake8-bugbear + "BLE", # flake8-blind-except + "C4", # flake8-comprehensions + "D", # pydocstyle + "E", # pycodestyle + "F", # pyflakes + "I", # isort + "ICN", # flake8-import-conventions + "ISC", # flake8-implicit-str-concat + "PGH", # pygrep-hooks + "PL", # pylint + "RET", # flake8-return + "RUF", # ruff-specific rules + "SIM", # flake8-simplify + "T10", # flake8-debugger + "T20", # flake8-print + "TID", # flake8-tidy-imports + "TRY", # tryceratops + "UP", # pyupgrade + "W", # pycodestyle + "YTT", # flake8-2020 +] -# Sort imports within their section independent of the import type -force_sort_within_sections = true +ignore = [ + "D100", # missing docstring in public module + "D103", # missing docstring in public function + "D104", # missing docstring in public package + "D203", # blank line before class docstring + "D213", # multi-line docstring summary should start at the second line + "ISC001", # disabled so `ruff format` works without warning + "T201", # print statements found +] -# Designate "pelican" as separate import section -known_pelican = "pelican" -sections = "FUTURE,STDLIB,THIRDPARTY,PELICAN,FIRSTPARTY,LOCALFOLDER" +[tool.ruff.lint.isort] +combine-as-imports = true +force-sort-within-sections = true +known-first-party = ["pelican"] [build-system] -requires = ["poetry-core>=1.0.0"] -build-backend = "poetry.core.masonry.api" +requires = ["pdm-backend"] +build-backend = "pdm.backend" diff --git a/tasks.py b/tasks.py index 03c5517..93cc58e 100644 --- a/tasks.py +++ b/tasks.py @@ -1,14 +1,15 @@ from inspect import cleandoc +import logging import os from pathlib import Path from shutil import which -import sys from invoke import task +logger = logging.getLogger(__name__) + PKG_NAME = "tailwindcss" PKG_PATH = Path(f"pelican/plugins/{PKG_NAME}") -TOOLS = ("poetry", "pre-commit") ACTIVE_VENV = os.environ.get("VIRTUAL_ENV", None) VENV_HOME = Path(os.environ.get("WORKON_HOME", "~/.local/share/virtualenvs")) @@ -16,52 +17,53 @@ VENV = str(VENV_PATH.expanduser()) BIN_DIR = "bin" if os.name != "nt" else "Scripts" VENV_BIN = Path(VENV) / Path(BIN_DIR) -POETRY = which("poetry") if which("poetry") else (VENV_BIN / "poetry") -CMD_PREFIX = f"{VENV_BIN}/" if ACTIVE_VENV else f"{POETRY} run " + +TOOLS = ("cruft", "pdm", "pre-commit") +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" -PTY = True if os.name != "nt" else False +PTY = os.name != "nt" @task -def tests(c): - """Run the test suite.""" - c.run(f"{CMD_PREFIX}pytest", pty=PTY) +def tests(c, deprecations=False): + """Run the test suite, optionally with `--deprecations`.""" + deprecations_flag = "" if deprecations else "-W ignore::DeprecationWarning" + c.run(f"{CMD_PREFIX}pytest {deprecations_flag}", pty=PTY) @task -def black(c, check=False, diff=False): - """Run Black auto-formatter, optionally with `--check` or `--diff`.""" +def format(c, check=False, diff=False): + """Run Ruff's auto-formatter, optionally with `--check` or `--diff`.""" check_flag, diff_flag = "", "" if check: check_flag = "--check" if diff: diff_flag = "--diff" - c.run(f"{CMD_PREFIX}black {check_flag} {diff_flag} {PKG_PATH} tasks.py") + c.run( + f"{CMD_PREFIX}ruff format {check_flag} {diff_flag} {PKG_PATH} tasks.py", pty=PTY + ) @task -def isort(c, check=False, diff=False): - """Ensure imports are sorted according to project standards.""" - check_flag, diff_flag = "", "" - if check: - check_flag = "-c" +def ruff(c, concise=False, fix=False, diff=False): + """Run Ruff to ensure code meets project standards.""" + 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}isort {check_flag} {diff_flag} .") - - -@task -def flake8(c): - """Check code for PEP8 compliance via Flake8.""" - c.run(f"{CMD_PREFIX}flake8 {PKG_PATH} tasks.py") + c.run(f"{CMD_PREFIX}ruff check {concise_flag} {diff_flag} {fix_flag} .", pty=PTY) @task -def lint(c, diff=False): +def lint(c, concise=False, fix=False, diff=False): """Check code style via linting tools.""" - isort(c, check=True, diff=diff) - black(c, check=True, diff=diff) - flake8(c) + ruff(c, concise=concise, fix=fix, diff=diff) + format(c, check=(not fix), diff=diff) @task @@ -69,32 +71,45 @@ def tools(c): """Install development tools in the virtual environment if not already on PATH.""" for tool in TOOLS: if not which(tool): + logger.info(f"** Installing {tool} **") c.run(f"{CMD_PREFIX}pip install {tool}") @task def precommit(c): """Install pre-commit hooks to .git/hooks/pre-commit.""" + logger.info("** Installing pre-commit hooks **") c.run(f"{PRECOMMIT} install") +@task +def update(c, check=False): + """Apply upstream plugin template changes to this project.""" + if check: + logger.info("** Checking for upstream template changes **") + c.run(f"{CRUFT} check", pty=PTY) + else: + logger.info("** Updating project from upstream template **") + c.run(f"{CRUFT} update", pty=PTY) + + @task def setup(c): """Set up the development environment.""" - if which("poetry") or ACTIVE_VENV: + if which("pdm") or ACTIVE_VENV: tools(c) - c.run(f"{CMD_PREFIX}python -m pip install --upgrade pip") - c.run(f"{POETRY} install") + c.run(f"{CMD_PREFIX}python -m pip install --upgrade pip", pty=PTY) + c.run(f"{PDM} update --dev", pty=PTY) precommit(c) - print("\nDevelopment environment should now be set up and ready!\n") + logger.info("\nDevelopment environment should now be set up and ready!\n") else: error_message = """ - Poetry is not installed, and there is no active virtual environment available. + PDM is not installed, and there is no active virtual environment available. You can either manually create and activate a virtual environment, or you can - install Poetry via: + install PDM via: - curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python - + curl -sSL https://raw.githubusercontent.com/pdm-project/pdm/main/install-pdm.py | python3 - Once you have taken one of the above two steps, run `invoke setup` again. """ # noqa: E501 - sys.exit(cleandoc(error_message)) + raise SystemExit(cleandoc(error_message)) diff --git a/tox.ini b/tox.ini deleted file mode 100644 index abbd0dc..0000000 --- a/tox.ini +++ /dev/null @@ -1,3 +0,0 @@ -[flake8] -max-line-length = 88 -ignore = E203, W503 From 9653266628a8813433044e7ca1b3830c83cab622 Mon Sep 17 00:00:00 2001 From: Justin Mayer Date: Wed, 19 Feb 2025 19:06:43 +0100 Subject: [PATCH 2/8] Adjust funding link --- .github/FUNDING.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index 7e0d535..c2e5ca8 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1,2 +1,2 @@ -custom: https://donate.getpelican.com +github: justinmayer liberapay: pelican From a60808aa0460321979b29ecfc841b2ac7f203312 Mon Sep 17 00:00:00 2001 From: Justin Mayer Date: Wed, 19 Feb 2025 19:07:12 +0100 Subject: [PATCH 3/8] Update and enhance README --- README.md | 34 ++++++++++++++-------------------- 1 file changed, 14 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 8367d2a..431be71 100644 --- a/README.md +++ b/README.md @@ -1,33 +1,27 @@ -# TailwindCSS Plugin for Pelican 🌬 +# Tailwind CSS Plugin for Pelican 🌬 [![Build Status](https://img.shields.io/github/actions/workflow/status/pelican-plugins/tailwindcss/main.yml?branch=main)](https://github.com/pelican-plugins/tailwindcss/actions) [![PyPI Version](https://img.shields.io/pypi/v/pelican-tailwindcss)](https://pypi.org/project/pelican-tailwindcss/) +[![Downloads](https://img.shields.io/pypi/dm/pelican-tailwindcss)](https://pypi.org/project/pelican-tailwindcss/) ![License](https://img.shields.io/pypi/l/pelican-tailwindcss?color=blue) -This plugin helps you use [TailwindCSS][] in your Pelican website. - -| Author | GitHub | Twitter | -| :-----------: | :------------------------------------------------: | :----------------------------------------------------: | -| Luca Fedrizzi | [https://github.com/lcfd](https://github.com/lcfd) | [https://twitter.com/lc_fd](https://twitter.com/lc_fd) | +This plugin helps you use [Tailwind CSS][] in your Pelican web site. ## Why Use This Plugin? -Because you want use [TailwindCSS][] in seconds. -Not hours. +Because you want use [Tailwind CSS][] in seconds. Not hours. ## Requirements -In order to run this plugin, you need to install NodeJS. (I'm looking to replace this dependency by using a Python package. – Luca) +In order to run this plugin, you need to install Node.JS. (Someday this dependency could be replaced with a Python package.) ## Installation This plugin can be installed via: -`python -m pip install pelican-tailwindcss` - -or + python -m pip install pelican-tailwindcss -`poetry add pelican-tailwindcss` +As long as you have not explicitly added a `PLUGINS` setting to your Pelican settings file, then the newly-installed plugin should be automatically detected and enabled. Otherwise, you must add `tailwindcss` to your existing `PLUGINS` list. For more information, please see the [How to Use Plugins](https://docs.getpelican.com/en/latest/plugins.html#how-to-use-plugins) documentation. ## Basic Usage @@ -60,7 +54,7 @@ or ``` -4. Done! You should be ready to use [TailwindCSS][] in your website template. +4. Done! You should be ready to use [Tailwind CSS][] in your website template. ## Advanced Usage @@ -80,16 +74,16 @@ TAILWIND = { } ``` -### Tailwind plugins install +### Tailwind Plugin Installation -As you can see from the example above it is possible to add the `plugins` property to the configuration. -Just add the name of a Tailwind plugin in this property and the plugin will be installed. +As you can see from the example above, it is possible to add the `plugins` property to the configuration. +Just add the name of a Tailwind plugin to the list, and the plugin will be installed. -## Useful informations +## Useful Information ### Plugins -Your `tailwind.config.js` file will only be copied when Pelican starts. This means that any changes after starting Pelican will not be considered. For example if you want to install a new plugin for Tailwind you will have to restart Pelican. +Your `tailwind.config.js` file will only be copied when Pelican starts. This means that any changes made after starting Pelican will not be recognized. For example, if you want to install a new plugin for Tailwind, you will have to restart Pelican in order for that plugin to become active. ## Contributing @@ -104,4 +98,4 @@ To start contributing to this plugin, review the [Contributing to Pelican][] doc This project is licensed under the AGPL-3.0 license. -[TailwindCSS]: https://github.com/tailwindlabs/tailwindcss +[Tailwind CSS]: https://github.com/tailwindlabs/tailwindcss From 6fb4f756cdbb3365ecfdfba214022c7b7673e8e4 Mon Sep 17 00:00:00 2001 From: Justin Mayer Date: Wed, 19 Feb 2025 19:07:47 +0100 Subject: [PATCH 4/8] Fix missing f-string --- pelican/plugins/tailwindcss/tailwindcss.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pelican/plugins/tailwindcss/tailwindcss.py b/pelican/plugins/tailwindcss/tailwindcss.py index d4852b0..45cc762 100644 --- a/pelican/plugins/tailwindcss/tailwindcss.py +++ b/pelican/plugins/tailwindcss/tailwindcss.py @@ -48,7 +48,7 @@ def initialize(po): else: print(f"{utils.LOG_PREFIX} No settings were found") else: - print("{utils.LOG_PREFIX} Initialization required, first start") + print(f"{utils.LOG_PREFIX} Initialization required -- first start") commands.run_in_plugin("npm install") if TAILWIND_SETTINGS: print(f"{utils.LOG_PREFIX} Settings were found") From 311220a4b22ff1316b5016d05da492e4e08453a6 Mon Sep 17 00:00:00 2001 From: Justin Mayer Date: Wed, 19 Feb 2025 19:09:17 +0100 Subject: [PATCH 5/8] Apply new code style standards to project --- pelican/plugins/tailwindcss/__init__.py | 2 +- pelican/plugins/tailwindcss/tailwindcss.py | 4 ++-- pelican/plugins/tailwindcss/utils/commands.py | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/pelican/plugins/tailwindcss/__init__.py b/pelican/plugins/tailwindcss/__init__.py index 3793728..a321ed2 100644 --- a/pelican/plugins/tailwindcss/__init__.py +++ b/pelican/plugins/tailwindcss/__init__.py @@ -1 +1 @@ -from .tailwindcss import * # NOQA +from .tailwindcss import * # noqa: F403,PGH004,RUF100 diff --git a/pelican/plugins/tailwindcss/tailwindcss.py b/pelican/plugins/tailwindcss/tailwindcss.py index 45cc762..be7b20a 100644 --- a/pelican/plugins/tailwindcss/tailwindcss.py +++ b/pelican/plugins/tailwindcss/tailwindcss.py @@ -1,5 +1,5 @@ import os -import os.path as path +from os import path import shutil import subprocess @@ -63,7 +63,7 @@ def generate_css(po): twconfig_file_path = os.path.join(BASE_DIR, "tailwind.config.js") input_output = f"-i {input_file_path} -o {output_file_path}" - print(f"{utils.LOG_PREFIX} Build css ({output_file_path})") + print(f"{utils.LOG_PREFIX} Build CSS ({output_file_path})") commands.run_in_plugin( f"npx tailwindcss -c {twconfig_file_path} {input_output}", diff --git a/pelican/plugins/tailwindcss/utils/commands.py b/pelican/plugins/tailwindcss/utils/commands.py index ecd9929..0ce549d 100644 --- a/pelican/plugins/tailwindcss/utils/commands.py +++ b/pelican/plugins/tailwindcss/utils/commands.py @@ -1,4 +1,4 @@ -import os.path as path +from os import path import subprocess PLUGIN_BASE_DIR = path.abspath(path.join(__file__, "../../")) @@ -9,4 +9,5 @@ def run_in_plugin(command: str): args=command, cwd=PLUGIN_BASE_DIR, shell=True, + check=False, ) From c7528c2ceb05ca1d1008a4116b2a144caab66b7e Mon Sep 17 00:00:00 2001 From: Justin Mayer Date: Wed, 19 Feb 2025 19:11:31 +0100 Subject: [PATCH 6/8] Link to latest upstream template commit via Cruft --- .cruft.json | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 .cruft.json diff --git a/.cruft.json b/.cruft.json new file mode 100644 index 0000000..c58b572 --- /dev/null +++ b/.cruft.json @@ -0,0 +1,28 @@ +{ + "template": "https://github.com/getpelican/cookiecutter-pelican-plugin", + "commit": "8d76f8a131f62fb06a285de1f142973c1ea7222a", + "checkout": null, + "context": { + "cookiecutter": { + "plugin_name": "Tailwind CSS", + "repo_name": "tailwindcss", + "package_name": "tailwindcss", + "distribution_name": "pelican-tailwindcss", + "version": "0.2.0", + "description": "Pelican plugin to add Tailwind CSS to your web site", + "authors": "{name = \"Pelican Dev Team\", email = \"authors@getpelican.com\"}", + "keywords": "\"pelican\", \"plugin\", \"tailwindcss\", \"css\", \"css-framework\"", + "readme": "README.md", + "contributing": "CONTRIBUTING.md", + "license": "GNU Affero General Public License v3|AGPL-3.0", + "repo_url": "https://github.com/pelican-plugins/tailwindcss", + "dev_status": "4 - Beta", + "tests_exist": false, + "python_version": "~=3.9", + "pelican_version": ">=4.5", + "_template": "https://github.com/getpelican/cookiecutter-pelican-plugin", + "_commit": "8a4f543e999c7a2b4ab49c724bf84ff4192f4c94" + } + }, + "directory": null +} From ebd7bc5e1fa11456941346b0588d3a941819ba55 Mon Sep 17 00:00:00 2001 From: Justin Mayer Date: Thu, 20 Feb 2025 09:35:55 +0100 Subject: [PATCH 7/8] Do not package ephemeral Node.js & Tailwind files --- pyproject.toml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 8f3d078..1e2e73d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -56,7 +56,14 @@ source-includes = [ "CONTRIBUTING.md", ] includes = ["pelican/"] -excludes = ["**/.DS_Store", "**/test_data/**", "tasks.py"] +excludes = [ + "**/.DS_Store", + "**/package-lock.json", + "**/node_modules", + "**/tailwind.config.js", + "**/test_data/**", + "tasks.py", +] [tool.autopub] project-name = "Tailwind CSS" From 55cffac26c9abb79d6fefe1ba1ed1ac9f4e8f9d7 Mon Sep 17 00:00:00 2001 From: Justin Mayer Date: Thu, 20 Feb 2025 13:59:14 +0100 Subject: [PATCH 8/8] Prepare release --- CHANGELOG.md | 2 +- RELEASE.md | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 RELEASE.md diff --git a/CHANGELOG.md b/CHANGELOG.md index c1e8a3b..495c049 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ CHANGELOG 0.2.0 - 2022-07-10 ------------------ -Now we can install and use TailwindCSS plugins. +Add support for installing and using Tailwind CSS plugins. Contributed by [Luca Fedrizzi](https://github.com/lcfd) via [PR #3](https://github.com/pelican-plugins/tailwindcss/pull/3/) diff --git a/RELEASE.md b/RELEASE.md new file mode 100644 index 0000000..e989347 --- /dev/null +++ b/RELEASE.md @@ -0,0 +1,4 @@ +Release type: minor + +* Fix NPM error (`could not determine executable to run`), perhaps related to Tailwind CSS 4.x release ([#8](https://github.com/pelican-plugins/tailwindcss/pull/8/)) +* Use PDM & Ruff instead of Poetry, Black, Flake8, and isort ([#9](https://github.com/pelican-plugins/tailwindcss/pull/9/))