From bf2dca8df6f3fcfb69e6c53e5e825350be0d665d Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 3 May 2021 17:36:04 +0000 Subject: [PATCH 01/59] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/psf/black: 19.10b0 → 21.4b2](https://github.com/psf/black/compare/19.10b0...21.4b2) - https://gitlab.com/pycqa/flake8 → https://github.com/PyCQA/flake8 - [github.com/PyCQA/flake8: 3.9.0 → 3.9.1](https://github.com/PyCQA/flake8/compare/3.9.0...3.9.1) - [github.com/PyCQA/isort: 5.7.0 → 5.8.0](https://github.com/PyCQA/isort/compare/5.7.0...5.8.0) --- .pre-commit-config.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 3338bab..179bc61 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -14,18 +14,18 @@ repos: - id: trailing-whitespace - repo: https://github.com/psf/black - rev: 19.10b0 + rev: 21.4b2 hooks: - id: black - - repo: https://gitlab.com/pycqa/flake8 - rev: 3.9.0 + - repo: https://github.com/PyCQA/flake8 + rev: 3.9.1 hooks: - id: flake8 args: [--max-line-length=88] language_version: python3.7 - repo: https://github.com/PyCQA/isort - rev: 5.7.0 + rev: 5.8.0 hooks: - id: isort From 10931570ba071bbd2a5d589f78ba67560038e1b5 Mon Sep 17 00:00:00 2001 From: Leonardo Giordani Date: Tue, 4 May 2021 08:08:46 +0100 Subject: [PATCH 02/59] Fixed file termination --- .pre-commit-config.yaml | 2 +- CHANGELOG.md | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 179bc61..d289950 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -23,7 +23,7 @@ repos: hooks: - id: flake8 args: [--max-line-length=88] - language_version: python3.7 + language_version: python3 - repo: https://github.com/PyCQA/isort rev: 5.8.0 diff --git a/CHANGELOG.md b/CHANGELOG.md index 5bb40ec..6e8c93c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,5 +7,3 @@ CHANGELOG Initial release as namespace plugin [Justin Mayer](https://github.com/justinmayer) [PR #1](https://github.com/pelican-plugins/share-post/pull/1/) - - From 8bc139b33545de3b1191e5b92cd3595ece06fa1e Mon Sep 17 00:00:00 2001 From: Justin Mayer Date: Tue, 4 May 2021 05:26:23 -0500 Subject: [PATCH 03/59] Add pre-commit hooks --- .pre-commit-config.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d289950..12e895e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,3 +1,4 @@ +--- # See https://pre-commit.com/hooks.html for info on hooks repos: - repo: https://github.com/pre-commit/pre-commit-hooks @@ -6,11 +7,13 @@ repos: - id: check-added-large-files - id: check-ast - id: check-case-conflict + - id: check-merge-conflict - id: check-toml - id: check-yaml - id: debug-statements - id: detect-private-key - id: end-of-file-fixer + - id: forbid-new-submodules - id: trailing-whitespace - repo: https://github.com/psf/black From 98f25e3ed052f27c8f6727e32136237bab74f7f2 Mon Sep 17 00:00:00 2001 From: Justin Mayer Date: Tue, 4 May 2021 05:35:39 -0500 Subject: [PATCH 04/59] Add funding links --- .github/FUNDING.yml | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .github/FUNDING.yml diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..7e0d535 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,2 @@ +custom: https://donate.getpelican.com +liberapay: pelican From ba52c4c0d17a36c7baf46b462ef2ae7947da4bbd Mon Sep 17 00:00:00 2001 From: Justin Mayer Date: Tue, 4 May 2021 05:36:56 -0500 Subject: [PATCH 05/59] Update linters and adjust dependency versions --- .github/workflows/main.yml | 4 ++++ pyproject.toml | 10 +++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c5b40b3..56da503 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -49,6 +49,10 @@ jobs: steps: - uses: actions/checkout@v2 + - name: Validate links in Markdown files + uses: JustinBeckwith/linkinator-action@v1 + with: + retry: true - name: Set up Python uses: actions/setup-python@v2 with: diff --git a/pyproject.toml b/pyproject.toml index 920a711..f21d8ae 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -28,19 +28,19 @@ classifiers = [ "Issue Tracker" = "https://github.com/pelican-plugins/share-post/issues" [tool.poetry.dependencies] -python = "^3.6" -pelican = "^4.5" -markdown = {version = "^3.2.2", optional = true} +python = ">=3.6.2,<4.0" +pelican = ">=4.5" +markdown = {version = ">=3.2", optional = true} beautifulsoup4 = "^4.9.3" [tool.poetry.dev-dependencies] -black = {version = "^19.10b0", allow-prereleases = true} +black = {version = "^21.4b2", allow-prereleases = true} flake8 = "^3.9" flake8-black = "^0.2.0" invoke = "^1.3" isort = "^5.4" livereload = "^2.6" -markdown = "^3.2.2" +markdown = "^3.2" pytest = "^6.0" pytest-cov = "^2.8" pytest-pythonpath = "^0.7.3" From eba18bca846b9b4bd6cdafdca210d63fd8b7649e Mon Sep 17 00:00:00 2001 From: Justin Mayer Date: Tue, 4 May 2021 05:37:47 -0500 Subject: [PATCH 06/59] Support Poetry-managed virtualenvs in Invoke tasks --- tasks.py | 69 +++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 46 insertions(+), 23 deletions(-) diff --git a/tasks.py b/tasks.py index 0377b73..f0fbc52 100644 --- a/tasks.py +++ b/tasks.py @@ -1,79 +1,102 @@ +from inspect import cleandoc import os from pathlib import Path from shutil import which +import sys from invoke import task PKG_NAME = "share_post" 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")) -VENV_PATH = Path(ACTIVE_VENV) if ACTIVE_VENV else (VENV_HOME / PKG_NAME) +VENV_PATH = Path(ACTIVE_VENV) if ACTIVE_VENV else (VENV_HOME.expanduser() / PKG_NAME) VENV = str(VENV_PATH.expanduser()) - -TOOLS = ["poetry", "pre-commit"] -POETRY = which("poetry") if which("poetry") else (VENV / Path("bin") / "poetry") -PRECOMMIT = ( - which("pre-commit") if which("pre-commit") else (VENV / Path("bin") / "pre-commit") -) +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 " +PRECOMMIT = which("pre-commit") if which("pre-commit") else f"{CMD_PREFIX}pre-commit" +PTY = True if os.name != "nt" else False @task def tests(c): - """Run the test suite""" - c.run(f"{VENV}/bin/pytest", pty=True) + """Run the test suite.""" + c.run(f"{CMD_PREFIX}pytest", pty=PTY) @task def black(c, check=False, diff=False): - """Run Black auto-formatter, optionally with --check or --diff""" + """Run Black auto-formatter, optionally with `--check` or `--diff`.""" check_flag, diff_flag = "", "" if check: check_flag = "--check" if diff: diff_flag = "--diff" - c.run(f"{VENV}/bin/black {check_flag} {diff_flag} {PKG_PATH} tasks.py") + c.run(f"{CMD_PREFIX}black {check_flag} {diff_flag} {PKG_PATH} tasks.py") @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" if diff: diff_flag = "--diff" - c.run(f"{VENV}/bin/isort {check_flag} {diff_flag} .") + c.run(f"{CMD_PREFIX}isort {check_flag} {diff_flag} .") @task def flake8(c): - c.run(f"{VENV}/bin/flake8 {PKG_PATH} tasks.py") + """Check code for PEP8 compliance via Flake8.""" + c.run(f"{CMD_PREFIX}flake8 {PKG_PATH} tasks.py") @task -def lint(c): - isort(c, check=True) - black(c, check=True) +def lint(c, diff=False): + """Check code style via linting tools.""" + isort(c, check=True, diff=diff) + black(c, check=True, diff=diff) flake8(c) @task def tools(c): - """Install tools in the virtual environment if not already on PATH""" + """Install development tools in the virtual environment if not already on PATH.""" for tool in TOOLS: if not which(tool): - c.run(f"{VENV}/bin/pip install {tool}") + print(f"** Installing {tool}.") + c.run(f"{CMD_PREFIX}pip install {tool}") @task def precommit(c): - """Install pre-commit hooks to .git/hooks/pre-commit""" + """Install pre-commit hooks to `.git/hooks/pre-commit`.""" + print("** Installing pre-commit hooks.") c.run(f"{PRECOMMIT} install") @task def setup(c): - c.run(f"{VENV}/bin/pip install -U pip") - tools(c) - c.run(f"{POETRY} install") - precommit(c) + """Set up the development environment.""" + if which("poetry") or ACTIVE_VENV: + tools(c) + c.run(f"{CMD_PREFIX}python -m pip install --upgrade pip") + c.run(f"{POETRY} install") + precommit(c) + print("\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. + You can either manually create and activate a virtual environment, or you can + install Poetry via: + + curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python - + + Once you have taken one of the above two steps, run `invoke setup` again. + """ # noqa: E501 + sys.exit(cleandoc(error_message)) From 9d6e04bc9e823f1d5916d68e6222ddc889e39f1d Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 10 May 2021 20:44:09 +0000 Subject: [PATCH 07/59] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/psf/black: 21.4b2 → 21.5b1](https://github.com/psf/black/compare/21.4b2...21.5b1) - [github.com/PyCQA/flake8: 3.9.1 → 3.9.2](https://github.com/PyCQA/flake8/compare/3.9.1...3.9.2) --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 12e895e..cebc3aa 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -17,12 +17,12 @@ repos: - id: trailing-whitespace - repo: https://github.com/psf/black - rev: 21.4b2 + rev: 21.5b1 hooks: - id: black - repo: https://github.com/PyCQA/flake8 - rev: 3.9.1 + rev: 3.9.2 hooks: - id: flake8 args: [--max-line-length=88] From 554f40881d3eb4b499c3a332014d72f8afb6df58 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 17 May 2021 17:39:14 +0000 Subject: [PATCH 08/59] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/pre-commit/pre-commit-hooks: v3.4.0 → v4.0.1](https://github.com/pre-commit/pre-commit-hooks/compare/v3.4.0...v4.0.1) --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index cebc3aa..50fbfb5 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,7 +2,7 @@ # See https://pre-commit.com/hooks.html for info on hooks repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v3.4.0 + rev: v4.0.1 hooks: - id: check-added-large-files - id: check-ast From 612effae8349049221ab7a29fdadf2a8a0bc3894 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 31 May 2021 17:43:42 +0000 Subject: [PATCH 09/59] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/psf/black: 21.5b1 → 21.5b2](https://github.com/psf/black/compare/21.5b1...21.5b2) --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 50fbfb5..6512c4a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -17,7 +17,7 @@ repos: - id: trailing-whitespace - repo: https://github.com/psf/black - rev: 21.5b1 + rev: 21.5b2 hooks: - id: black From f0350269232a30cf8667d19aa5ff5916a0d6039d Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 21 Jun 2021 17:51:59 +0000 Subject: [PATCH 10/59] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/psf/black: 21.5b2 → 21.6b0](https://github.com/psf/black/compare/21.5b2...21.6b0) - [github.com/PyCQA/isort: 5.8.0 → 5.9.1](https://github.com/PyCQA/isort/compare/5.8.0...5.9.1) --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 6512c4a..7282d4a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -17,7 +17,7 @@ repos: - id: trailing-whitespace - repo: https://github.com/psf/black - rev: 21.5b2 + rev: 21.6b0 hooks: - id: black @@ -29,6 +29,6 @@ repos: language_version: python3 - repo: https://github.com/PyCQA/isort - rev: 5.8.0 + rev: 5.9.1 hooks: - id: isort From cf84a2d2058a148fc106faa83fa3d7cb1f9296e8 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 12 Jul 2021 23:39:18 +0000 Subject: [PATCH 11/59] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/PyCQA/isort: 5.9.1 → 5.9.2](https://github.com/PyCQA/isort/compare/5.9.1...5.9.2) --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7282d4a..29ccea0 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -29,6 +29,6 @@ repos: language_version: python3 - repo: https://github.com/PyCQA/isort - rev: 5.9.1 + rev: 5.9.2 hooks: - id: isort From 1adfca3fecc302189fb18d0c19dcd1f5df60f2fc Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 19 Jul 2021 22:26:15 +0000 Subject: [PATCH 12/59] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/psf/black: 21.6b0 → 21.7b0](https://github.com/psf/black/compare/21.6b0...21.7b0) --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 29ccea0..49070b2 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -17,7 +17,7 @@ repos: - id: trailing-whitespace - repo: https://github.com/psf/black - rev: 21.6b0 + rev: 21.7b0 hooks: - id: black From fa7eae4550e5a601fea54464802721cc29bede39 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 30 Aug 2021 19:48:58 +0000 Subject: [PATCH 13/59] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/psf/black: 21.7b0 → 21.8b0](https://github.com/psf/black/compare/21.7b0...21.8b0) - [github.com/PyCQA/isort: 5.9.2 → 5.9.3](https://github.com/PyCQA/isort/compare/5.9.2...5.9.3) --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 49070b2..3c42323 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -17,7 +17,7 @@ repos: - id: trailing-whitespace - repo: https://github.com/psf/black - rev: 21.7b0 + rev: 21.8b0 hooks: - id: black @@ -29,6 +29,6 @@ repos: language_version: python3 - repo: https://github.com/PyCQA/isort - rev: 5.9.2 + rev: 5.9.3 hooks: - id: isort From 0f32936bcefc260d25953622fef823c351dbbd25 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 20 Sep 2021 20:25:30 +0000 Subject: [PATCH 14/59] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/psf/black: 21.8b0 → 21.9b0](https://github.com/psf/black/compare/21.8b0...21.9b0) --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 3c42323..ca6351d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -17,7 +17,7 @@ repos: - id: trailing-whitespace - repo: https://github.com/psf/black - rev: 21.8b0 + rev: 21.9b0 hooks: - id: black From 922b99bfaee6fade5f769a9467643150da0885b1 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 11 Oct 2021 20:12:19 +0000 Subject: [PATCH 15/59] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/PyCQA/flake8: 3.9.2 → 4.0.1](https://github.com/PyCQA/flake8/compare/3.9.2...4.0.1) --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ca6351d..1e0e000 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -22,7 +22,7 @@ repos: - id: black - repo: https://github.com/PyCQA/flake8 - rev: 3.9.2 + rev: 4.0.1 hooks: - id: flake8 args: [--max-line-length=88] From 3129e0378f0e14b48d147e48ab9e2e445bad2e79 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 15 Nov 2021 21:11:33 +0000 Subject: [PATCH 16/59] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/psf/black: 21.9b0 → 21.10b0](https://github.com/psf/black/compare/21.9b0...21.10b0) - [github.com/PyCQA/isort: 5.9.3 → 5.10.1](https://github.com/PyCQA/isort/compare/5.9.3...5.10.1) --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1e0e000..8acd3c4 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -17,7 +17,7 @@ repos: - id: trailing-whitespace - repo: https://github.com/psf/black - rev: 21.9b0 + rev: 21.10b0 hooks: - id: black @@ -29,6 +29,6 @@ repos: language_version: python3 - repo: https://github.com/PyCQA/isort - rev: 5.9.3 + rev: 5.10.1 hooks: - id: isort From d4dd47a32245e6087c288d294ca69d9eb45570fd Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 22 Nov 2021 21:33:30 +0000 Subject: [PATCH 17/59] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/psf/black: 21.10b0 → 21.11b1](https://github.com/psf/black/compare/21.10b0...21.11b1) --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8acd3c4..c74859e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -17,7 +17,7 @@ repos: - id: trailing-whitespace - repo: https://github.com/psf/black - rev: 21.10b0 + rev: 21.11b1 hooks: - id: black From 2f7f91af2a426a5e16653fd335d1f5924919f592 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 6 Dec 2021 21:59:17 +0000 Subject: [PATCH 18/59] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/psf/black: 21.11b1 → 21.12b0](https://github.com/psf/black/compare/21.11b1...21.12b0) --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c74859e..82ff3c1 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -17,7 +17,7 @@ repos: - id: trailing-whitespace - repo: https://github.com/psf/black - rev: 21.11b1 + rev: 21.12b0 hooks: - id: black From 3c48e56b62e64beec77a716817085c7db1e748fe Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 27 Dec 2021 22:03:11 +0000 Subject: [PATCH 19/59] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/pre-commit/pre-commit-hooks: v4.0.1 → v4.1.0](https://github.com/pre-commit/pre-commit-hooks/compare/v4.0.1...v4.1.0) --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 82ff3c1..053dbc4 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,7 +2,7 @@ # See https://pre-commit.com/hooks.html for info on hooks repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.0.1 + rev: v4.1.0 hooks: - id: check-added-large-files - id: check-ast From 5e913c20f9537e575913fd1e317405ef115a93d3 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 31 Jan 2022 23:10:40 +0000 Subject: [PATCH 20/59] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/psf/black: 21.12b0 → 22.1.0](https://github.com/psf/black/compare/21.12b0...22.1.0) --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 053dbc4..c11a50d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -17,7 +17,7 @@ repos: - id: trailing-whitespace - repo: https://github.com/psf/black - rev: 21.12b0 + rev: 22.1.0 hooks: - id: black From c4d692a412744e5c35050a101a20f6f122c1930d Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 11 Apr 2022 22:30:52 +0000 Subject: [PATCH 21/59] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/pre-commit/pre-commit-hooks: v4.1.0 → v4.2.0](https://github.com/pre-commit/pre-commit-hooks/compare/v4.1.0...v4.2.0) - [github.com/psf/black: 22.1.0 → 22.3.0](https://github.com/psf/black/compare/22.1.0...22.3.0) --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c11a50d..f0c2adb 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,7 +2,7 @@ # See https://pre-commit.com/hooks.html for info on hooks repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.1.0 + rev: v4.2.0 hooks: - id: check-added-large-files - id: check-ast @@ -17,7 +17,7 @@ repos: - id: trailing-whitespace - repo: https://github.com/psf/black - rev: 22.1.0 + rev: 22.3.0 hooks: - id: black From 01d75d58e9b260e45373cf6f7a4ee624bd23f431 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 11 Oct 2022 01:48:52 +0000 Subject: [PATCH 22/59] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/pre-commit/pre-commit-hooks: v4.2.0 → v4.3.0](https://github.com/pre-commit/pre-commit-hooks/compare/v4.2.0...v4.3.0) - [github.com/psf/black: 22.3.0 → 22.10.0](https://github.com/psf/black/compare/22.3.0...22.10.0) - [github.com/PyCQA/flake8: 4.0.1 → 5.0.4](https://github.com/PyCQA/flake8/compare/4.0.1...5.0.4) --- .pre-commit-config.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f0c2adb..362f77f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,7 +2,7 @@ # See https://pre-commit.com/hooks.html for info on hooks repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.2.0 + rev: v4.3.0 hooks: - id: check-added-large-files - id: check-ast @@ -17,12 +17,12 @@ repos: - id: trailing-whitespace - repo: https://github.com/psf/black - rev: 22.3.0 + rev: 22.10.0 hooks: - id: black - repo: https://github.com/PyCQA/flake8 - rev: 4.0.1 + rev: 5.0.4 hooks: - id: flake8 args: [--max-line-length=88] From 0312f7a972e38de09b8f08a6ca4bc6f2a6d49e0c Mon Sep 17 00:00:00 2001 From: Leonardo Giordani Date: Fri, 4 Nov 2022 09:26:43 +0000 Subject: [PATCH 23/59] Use new version of GH actions --- .github/workflows/main.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 56da503..c21809a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -14,13 +14,13 @@ jobs: python-version: [3.6, 3.7, 3.8, 3.9] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} - name: Set up Pip cache - uses: actions/cache@v2 + uses: actions/cache@v3 id: pip-cache with: path: ~/.cache/pip @@ -30,7 +30,7 @@ jobs: - name: Install Poetry run: python -m pip install poetry - name: Set up Poetry cache - uses: actions/cache@v2 + uses: actions/cache@v3 id: poetry-cache with: path: ~/.cache/pypoetry/virtualenvs @@ -48,17 +48,17 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Validate links in Markdown files uses: JustinBeckwith/linkinator-action@v1 with: retry: true - name: Set up Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: "3.x" - name: Set Poetry cache - uses: actions/cache@v2 + uses: actions/cache@v3 id: poetry-cache with: path: ~/.cache/pypoetry/virtualenvs @@ -83,9 +83,9 @@ jobs: if: ${{ github.ref=='refs/heads/main' && github.event_name!='pull_request' }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Setup Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: "3.x" - name: Check release From 89d1f123e8094245d11aaceb926ab05fffcac430 Mon Sep 17 00:00:00 2001 From: Maurizio Paglia Date: Mon, 5 Dec 2022 12:05:40 +0100 Subject: [PATCH 24/59] Added Mastodon share code --- pelican/plugins/share_post/share_post.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pelican/plugins/share_post/share_post.py b/pelican/plugins/share_post/share_post.py index f30b088..2942389 100644 --- a/pelican/plugins/share_post/share_post.py +++ b/pelican/plugins/share_post/share_post.py @@ -54,6 +54,13 @@ def create_link_diaspora(title, url, content): def create_link_facebook(title, url, content): return f"https://www.facebook.com/sharer/sharer.php?u={url}" +@create_link +def create_link_mastodon(title, url, content): + tags = getattr(content, "tags", []) + tags = ", ".join([tag.slug for tag in tags]) + hashtags = f"&hashtags={tags}" if tags else "" + return f"https://toot.kytta.dev/?text={title}&url={url}{hashtags}" + @create_link def create_link_twitter(title, url, content): From 38429bd52b66a70d5ddb881092539a2cb36ff808 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 23 Dec 2022 08:36:47 +0000 Subject: [PATCH 25/59] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- pelican/plugins/share_post/share_post.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pelican/plugins/share_post/share_post.py b/pelican/plugins/share_post/share_post.py index 2942389..35deb80 100644 --- a/pelican/plugins/share_post/share_post.py +++ b/pelican/plugins/share_post/share_post.py @@ -54,6 +54,7 @@ def create_link_diaspora(title, url, content): def create_link_facebook(title, url, content): return f"https://www.facebook.com/sharer/sharer.php?u={url}" + @create_link def create_link_mastodon(title, url, content): tags = getattr(content, "tags", []) From 56488d52d18f8d2f44565ab72b5e42f27373c434 Mon Sep 17 00:00:00 2001 From: Leonardo Giordani Date: Fri, 23 Dec 2022 10:28:07 +0000 Subject: [PATCH 26/59] Removed Python 3.6 --- .github/workflows/main.yml | 2 +- pyproject.toml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c21809a..1017d0d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: [3.6, 3.7, 3.8, 3.9] + python-version: [3.7, 3.8, 3.9] steps: - uses: actions/checkout@v3 diff --git a/pyproject.toml b/pyproject.toml index f21d8ae..86d8b82 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -28,9 +28,9 @@ classifiers = [ "Issue Tracker" = "https://github.com/pelican-plugins/share-post/issues" [tool.poetry.dependencies] -python = ">=3.6.2,<4.0" +python = ">=3.7,<4.0" pelican = ">=4.5" -markdown = {version = ">=3.2", optional = true} +markdown = {version = ">=3.2.2", optional = true} beautifulsoup4 = "^4.9.3" [tool.poetry.dev-dependencies] From ab3cd4c3dd0d026fc0c829eb1d6674721a2fb1bd Mon Sep 17 00:00:00 2001 From: Leonardo Giordani Date: Fri, 23 Dec 2022 10:35:41 +0000 Subject: [PATCH 27/59] Fixed Black version --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 86d8b82..7797840 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -34,7 +34,7 @@ markdown = {version = ">=3.2.2", optional = true} beautifulsoup4 = "^4.9.3" [tool.poetry.dev-dependencies] -black = {version = "^21.4b2", allow-prereleases = true} +black = {version = ">=22.3.0", allow-prereleases = true} flake8 = "^3.9" flake8-black = "^0.2.0" invoke = "^1.3" From b46226f6ce332c2f50ea53cfca5534760b386b1c Mon Sep 17 00:00:00 2001 From: Leonardo Giordani Date: Fri, 23 Dec 2022 10:40:29 +0000 Subject: [PATCH 28/59] Trying to fix the CI tasks --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1017d0d..1bafead 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -56,7 +56,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v4 with: - python-version: "3.x" + python-version: "3.9" - name: Set Poetry cache uses: actions/cache@v3 id: poetry-cache @@ -87,7 +87,7 @@ jobs: - name: Setup Python uses: actions/setup-python@v4 with: - python-version: "3.x" + python-version: "3.9" - name: Check release id: check_release run: | From acdc6116333135023018b8b466d098652a4ddb78 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 20 Dec 2022 02:50:52 +0000 Subject: [PATCH 29/59] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/pre-commit/pre-commit-hooks: v4.3.0 → v4.4.0](https://github.com/pre-commit/pre-commit-hooks/compare/v4.3.0...v4.4.0) - [github.com/psf/black: 22.10.0 → 22.12.0](https://github.com/psf/black/compare/22.10.0...22.12.0) - [github.com/PyCQA/flake8: 5.0.4 → 6.0.0](https://github.com/PyCQA/flake8/compare/5.0.4...6.0.0) - [github.com/PyCQA/isort: 5.10.1 → v5.11.3](https://github.com/PyCQA/isort/compare/5.10.1...v5.11.3) --- .pre-commit-config.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 362f77f..772091e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,7 +2,7 @@ # See https://pre-commit.com/hooks.html for info on hooks repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.3.0 + rev: v4.4.0 hooks: - id: check-added-large-files - id: check-ast @@ -17,18 +17,18 @@ repos: - id: trailing-whitespace - repo: https://github.com/psf/black - rev: 22.10.0 + rev: 22.12.0 hooks: - id: black - repo: https://github.com/PyCQA/flake8 - rev: 5.0.4 + rev: 6.0.0 hooks: - id: flake8 args: [--max-line-length=88] language_version: python3 - repo: https://github.com/PyCQA/isort - rev: 5.10.1 + rev: v5.11.3 hooks: - id: isort From cbbe302c692fd8c91a9894700b6da98ed28f56cf Mon Sep 17 00:00:00 2001 From: Leonardo Giordani Date: Fri, 23 Dec 2022 10:49:02 +0000 Subject: [PATCH 30/59] Added Maurizio Paglia as a contributor --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 926e737..6ca3735 100644 --- a/README.md +++ b/README.md @@ -77,7 +77,8 @@ Contributors * [Talha Mansoor](https://www.oncrashreboot.com) - talha131@gmail.com * [Jonathan DEKHTIAR](https://github.com/DEKHTIARJonathan) - contact@jonathandekhtiar.eu * [Justin Mayer](https://justinmayer.com) -* [Leonardo Giordani](https://www.thedigitalcatonline.com) +* [Leonardo Giordani](https://github.com/lgiordani) +* [Maurizio Paglia](https://github.com/mpaglia0) License From db31937745a24701e026715a230ed3fb46fde4f8 Mon Sep 17 00:00:00 2001 From: Maurizio Paglia Date: Wed, 28 Dec 2022 11:39:26 +0100 Subject: [PATCH 31/59] Fixed Mastodon code Pls check hashtags variable since I think code is correct but tags are not passed to the web service. Thks! --- pelican/plugins/share_post/share_post.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/pelican/plugins/share_post/share_post.py b/pelican/plugins/share_post/share_post.py index 35deb80..c6a8abb 100644 --- a/pelican/plugins/share_post/share_post.py +++ b/pelican/plugins/share_post/share_post.py @@ -57,10 +57,16 @@ def create_link_facebook(title, url, content): @create_link def create_link_mastodon(title, url, content): - tags = getattr(content, "tags", []) - tags = ", ".join([tag.slug for tag in tags]) - hashtags = f"&hashtags={tags}" if tags else "" - return f"https://toot.kytta.dev/?text={title}&url={url}{hashtags}" + if hasattr(content, 'tags'): + taglist = content.tags + new_taglist = [] + for i in taglist: + new_taglist.append('#' + str(i)) + hashtags = ' '.join(str(x).replace(" ", "") for x in new_taglist) + else: + hashtags = '' + + return f"https://toot.kytta.dev/?text={title}{newline}{url}{newline}{hashtags}" @create_link From 739b4bfb82be8e38ba0fd3102e530a30091b0772 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 28 Dec 2022 10:39:52 +0000 Subject: [PATCH 32/59] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- pelican/plugins/share_post/share_post.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pelican/plugins/share_post/share_post.py b/pelican/plugins/share_post/share_post.py index c6a8abb..06e1c32 100644 --- a/pelican/plugins/share_post/share_post.py +++ b/pelican/plugins/share_post/share_post.py @@ -57,15 +57,15 @@ def create_link_facebook(title, url, content): @create_link def create_link_mastodon(title, url, content): - if hasattr(content, 'tags'): + if hasattr(content, "tags"): taglist = content.tags new_taglist = [] for i in taglist: - new_taglist.append('#' + str(i)) - hashtags = ' '.join(str(x).replace(" ", "") for x in new_taglist) + new_taglist.append("#" + str(i)) + hashtags = " ".join(str(x).replace(" ", "") for x in new_taglist) else: - hashtags = '' - + hashtags = "" + return f"https://toot.kytta.dev/?text={title}{newline}{url}{newline}{hashtags}" From 6eaa7893ce4397d846a9d94da60658bf48ebd4bd Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 4 Apr 2023 08:33:02 +0000 Subject: [PATCH 33/59] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/psf/black: 22.12.0 → 23.3.0](https://github.com/psf/black/compare/22.12.0...23.3.0) - [github.com/PyCQA/isort: v5.11.3 → 5.12.0](https://github.com/PyCQA/isort/compare/v5.11.3...5.12.0) --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 772091e..753aec9 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -17,7 +17,7 @@ repos: - id: trailing-whitespace - repo: https://github.com/psf/black - rev: 22.12.0 + rev: 23.3.0 hooks: - id: black @@ -29,6 +29,6 @@ repos: language_version: python3 - repo: https://github.com/PyCQA/isort - rev: v5.11.3 + rev: 5.12.0 hooks: - id: isort From 2ddfbbf326ad2c68dc58b28b89f8aea0d3ccff20 Mon Sep 17 00:00:00 2001 From: Justin Mayer Date: Wed, 10 May 2023 08:55:49 +0200 Subject: [PATCH 34/59] Auto-update precommit.ci hooks on quarterly basis --- .pre-commit-config.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 753aec9..08632cf 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,4 +1,7 @@ --- +ci: + autoupdate_schedule: quarterly + # See https://pre-commit.com/hooks.html for info on hooks repos: - repo: https://github.com/pre-commit/pre-commit-hooks From 8de72f2182d404418dd65b75f9ead5e1f67ab163 Mon Sep 17 00:00:00 2001 From: Maurizio Paglia Date: Thu, 11 May 2023 08:27:01 +0200 Subject: [PATCH 35/59] Update share_post.py --- pelican/plugins/share_post/share_post.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pelican/plugins/share_post/share_post.py b/pelican/plugins/share_post/share_post.py index 06e1c32..99edc1e 100644 --- a/pelican/plugins/share_post/share_post.py +++ b/pelican/plugins/share_post/share_post.py @@ -21,6 +21,8 @@ from pelican.generators import ArticlesGenerator, PagesGenerator _create_link_functions = [] +newline = '%0D%0A' + # Use this decorator to mark a function as # a link creator. The function's prototype shall be From 96dfe3ea42a95d600dbad4a8465af82686ee714c Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 11 May 2023 06:27:09 +0000 Subject: [PATCH 36/59] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- pelican/plugins/share_post/share_post.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pelican/plugins/share_post/share_post.py b/pelican/plugins/share_post/share_post.py index 99edc1e..63c05c9 100644 --- a/pelican/plugins/share_post/share_post.py +++ b/pelican/plugins/share_post/share_post.py @@ -21,7 +21,7 @@ from pelican.generators import ArticlesGenerator, PagesGenerator _create_link_functions = [] -newline = '%0D%0A' +newline = "%0D%0A" # Use this decorator to mark a function as From 0fdb907f1fd9dac0d8a8151c61cfb285d570e713 Mon Sep 17 00:00:00 2001 From: Maurizio Paglia Date: Sat, 13 May 2023 15:24:00 +0200 Subject: [PATCH 37/59] Fixed hashtags error --- pelican/plugins/share_post/share_post.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pelican/plugins/share_post/share_post.py b/pelican/plugins/share_post/share_post.py index 63c05c9..ccb4286 100644 --- a/pelican/plugins/share_post/share_post.py +++ b/pelican/plugins/share_post/share_post.py @@ -63,7 +63,7 @@ def create_link_mastodon(title, url, content): taglist = content.tags new_taglist = [] for i in taglist: - new_taglist.append("#" + str(i)) + new_taglist.append("%23" + str(i)) hashtags = " ".join(str(x).replace(" ", "") for x in new_taglist) else: hashtags = "" From b3a8f622db50d4c2bd4ef30eb6f73bfe80f393d7 Mon Sep 17 00:00:00 2001 From: Maurizio Paglia Date: Thu, 18 May 2023 07:53:32 +0200 Subject: [PATCH 38/59] Fixed code for hashtags --- pelican/plugins/share_post/share_post.py | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/pelican/plugins/share_post/share_post.py b/pelican/plugins/share_post/share_post.py index ccb4286..9b9971a 100644 --- a/pelican/plugins/share_post/share_post.py +++ b/pelican/plugins/share_post/share_post.py @@ -59,16 +59,13 @@ def create_link_facebook(title, url, content): @create_link def create_link_mastodon(title, url, content): - if hasattr(content, "tags"): - taglist = content.tags - new_taglist = [] - for i in taglist: - new_taglist.append("%23" + str(i)) - hashtags = " ".join(str(x).replace(" ", "") for x in new_taglist) - else: - hashtags = "" + hashtags = "" - return f"https://toot.kytta.dev/?text={title}{newline}{url}{newline}{hashtags}" + if hasattr(content, "tags"): + new_taglist = [f"%23{str(i).replace(' ', '')}" for i in content.tags] + hashtags = " ".join(new_taglist) + + return f"https://toot.kytta.dev/?text={title}{newline}{url}{newline}{hashtags}" @create_link From f813736c57bece47d76275c9d8add7c58d4317b7 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 18 May 2023 05:53:39 +0000 Subject: [PATCH 39/59] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- pelican/plugins/share_post/share_post.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pelican/plugins/share_post/share_post.py b/pelican/plugins/share_post/share_post.py index 9b9971a..f779c15 100644 --- a/pelican/plugins/share_post/share_post.py +++ b/pelican/plugins/share_post/share_post.py @@ -59,13 +59,13 @@ def create_link_facebook(title, url, content): @create_link def create_link_mastodon(title, url, content): - hashtags = "" + hashtags = "" - if hasattr(content, "tags"): - new_taglist = [f"%23{str(i).replace(' ', '')}" for i in content.tags] - hashtags = " ".join(new_taglist) + if hasattr(content, "tags"): + new_taglist = [f"%23{str(i).replace(' ', '')}" for i in content.tags] + hashtags = " ".join(new_taglist) - return f"https://toot.kytta.dev/?text={title}{newline}{url}{newline}{hashtags}" + return f"https://toot.kytta.dev/?text={title}{newline}{url}{newline}{hashtags}" @create_link From 694a2725dee00f575bf166975c8e27959e2b0f28 Mon Sep 17 00:00:00 2001 From: Justin Mayer Date: Sat, 1 Jul 2023 11:29:51 +0200 Subject: [PATCH 40/59] Fix build status badge Resolves: https://github.com/badges/shields/issues/8671 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6ca3735..fce34cd 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Share Post: A Plugin for Pelican -[![Build Status](https://img.shields.io/github/workflow/status/pelican-plugins/share-post/build)](https://github.com/pelican-plugins/share-post/actions) +[![Build Status](https://img.shields.io/github/actions/workflow/status/pelican-plugins/share-post/main.yml?branch=main)](https://github.com/pelican-plugins/share-post/actions) [![PyPI Version](https://img.shields.io/pypi/v/pelican-share-post)](https://pypi.org/project/pelican-share-post/) ![License](https://img.shields.io/pypi/l/pelican-share-post?color=blue) From 1f7e1430ad213ca19d03be86f05882f8262b3478 Mon Sep 17 00:00:00 2001 From: Justin Mayer Date: Sat, 1 Jul 2023 11:32:03 +0200 Subject: [PATCH 41/59] Change botpub email address for Git commits --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 7797840..b8805a8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -53,7 +53,7 @@ markdown = ["markdown"] [tool.autopub] project-name = "Share Post" git-username = "botpub" -git-email = "botpub@autopub.rocks" +git-email = "52496925+botpub@users.noreply.github.com" append-github-contributor = true [tool.isort] From 9aa8315ce0207720cc1432eed5624df088eca338 Mon Sep 17 00:00:00 2001 From: Justin Mayer Date: Thu, 31 Aug 2023 15:34:29 +0200 Subject: [PATCH 42/59] Drop Python 3.7 from CI test matrix --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1bafead..37ddfa7 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: [3.7, 3.8, 3.9] + python-version: ["3.8", "3.9"] steps: - uses: actions/checkout@v3 From 2387c736098abb2fbbf983d5b4496f5529a69614 Mon Sep 17 00:00:00 2001 From: Justin Mayer Date: Thu, 31 Aug 2023 15:37:18 +0200 Subject: [PATCH 43/59] Update development dependencies --- pyproject.toml | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index b8805a8..d8bab08 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,7 +2,7 @@ name = "pelican-share-post" version = "1.0.0" description = "A Pelican plugin to create share URLs of article" -authors = ["Talha Mansoor "] +authors = ["Talha Mansoor ", "Justin Mayer "] license = "MIT" readme = "README.md" keywords = ["pelican", "plugin", "social"] @@ -34,18 +34,15 @@ markdown = {version = ">=3.2.2", optional = true} beautifulsoup4 = "^4.9.3" [tool.poetry.dev-dependencies] -black = {version = ">=22.3.0", allow-prereleases = true} +black = ">=22.3.0" flake8 = "^3.9" -flake8-black = "^0.2.0" -invoke = "^1.3" +flake8-black = "^0.3" +invoke = "^2.1" isort = "^5.4" -livereload = "^2.6" -markdown = "^3.2" +markdown = "^3.4" pytest = "^6.0" pytest-cov = "^2.8" -pytest-pythonpath = "^0.7.3" -pytest-sugar = "^0.9.4" -Werkzeug = "^1.0" +pytest-sugar = "^0.9.7" [tool.poetry.extras] markdown = ["markdown"] From 33e329de02d64181489fde515b9543e0ec08daec Mon Sep 17 00:00:00 2001 From: Justin Mayer Date: Thu, 31 Aug 2023 15:38:29 +0200 Subject: [PATCH 44/59] Document Mastodon functionality in README --- README.md | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index fce34cd..5871750 100644 --- a/README.md +++ b/README.md @@ -23,38 +23,41 @@ Usage This plugin adds to each Pelican article a dictionary of URLs that, when followed, allows the reader to easily share the article via specific channels. When activated, the plugin adds the attribute `share_post` to each article with the following format: -``` python +```python article.share_post = { - "facebook": "", "email": "", - "twitter": "", "diaspora": "", - "linkedin": "", + "facebook": "", "hacker-news": "", + "linkedin": "", + "mastodon": "", "reddit": "", + "twitter": "", } ``` You can then access those variables in your template. For example: -``` html+jinja +```html+jinja {% if article.share_post and article.status != 'draft' %}

Share on: - Diaspora* + Email ❄ - Twitter + DiasporaFacebook ❄ + Hacker News + ❄ LinkedIn ❄ - HackerNews - ❄ - Email + MastodonReddit + ❄ + Twitter

{% endif %} From 64188516c21f9c4955fe0582aaef1a4460ee3d4c Mon Sep 17 00:00:00 2001 From: Justin Mayer Date: Thu, 31 Aug 2023 15:43:18 +0200 Subject: [PATCH 45/59] Prepare release --- RELEASE.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 RELEASE.md diff --git a/RELEASE.md b/RELEASE.md new file mode 100644 index 0000000..9d3e106 --- /dev/null +++ b/RELEASE.md @@ -0,0 +1,3 @@ +Release type: minor + +Add Mastodon share link From 1e7e630453b38775ff51534f0766b017477a2918 Mon Sep 17 00:00:00 2001 From: botpub <52496925+botpub@users.noreply.github.com> Date: Thu, 31 Aug 2023 13:45:10 +0000 Subject: [PATCH 46/59] Release Share Post 1.1.0 --- CHANGELOG.md | 5 +++++ RELEASE.md | 3 --- pyproject.toml | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) delete mode 100644 RELEASE.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 6e8c93c..7eb580f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,11 @@ CHANGELOG ========= +1.1.0 - 2023-08-31 +------------------ + +Add Mastodon share link + 1.0.0 - 2021-03-19 ------------------ diff --git a/RELEASE.md b/RELEASE.md deleted file mode 100644 index 9d3e106..0000000 --- a/RELEASE.md +++ /dev/null @@ -1,3 +0,0 @@ -Release type: minor - -Add Mastodon share link diff --git a/pyproject.toml b/pyproject.toml index d8bab08..4610bc5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "pelican-share-post" -version = "1.0.0" +version = "1.1.0" description = "A Pelican plugin to create share URLs of article" authors = ["Talha Mansoor ", "Justin Mayer "] license = "MIT" From 656d3773ec5e54df05e6277e2bbe5c8b38b08243 Mon Sep 17 00:00:00 2001 From: Frank Martin Date: Sun, 5 Nov 2023 18:33:13 +0000 Subject: [PATCH 47/59] Fixed typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5871750..f76dab4 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,7 @@ You can then access those variables in your template. For example: ❄ LinkedIn ❄ - Mastodon + MastodonReddit ❄ From 56ebe6ad5bdda61609028357c6b5ec683749537c Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 1 Jan 2024 20:54:46 +0000 Subject: [PATCH 48/59] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/pre-commit/pre-commit-hooks: v4.4.0 → v4.5.0](https://github.com/pre-commit/pre-commit-hooks/compare/v4.4.0...v4.5.0) - [github.com/psf/black: 23.3.0 → 23.12.1](https://github.com/psf/black/compare/23.3.0...23.12.1) - [github.com/PyCQA/flake8: 6.0.0 → 6.1.0](https://github.com/PyCQA/flake8/compare/6.0.0...6.1.0) - [github.com/PyCQA/isort: 5.12.0 → 5.13.2](https://github.com/PyCQA/isort/compare/5.12.0...5.13.2) --- .pre-commit-config.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 08632cf..190275a 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.4.0 + rev: v4.5.0 hooks: - id: check-added-large-files - id: check-ast @@ -20,18 +20,18 @@ repos: - id: trailing-whitespace - repo: https://github.com/psf/black - rev: 23.3.0 + rev: 23.12.1 hooks: - id: black - repo: https://github.com/PyCQA/flake8 - rev: 6.0.0 + rev: 6.1.0 hooks: - id: flake8 args: [--max-line-length=88] language_version: python3 - repo: https://github.com/PyCQA/isort - rev: 5.12.0 + rev: 5.13.2 hooks: - id: isort From 3c7656fa10e9e27863f3b71a3dfe4a28bc5e7ee6 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 1 Apr 2024 22:50:36 +0000 Subject: [PATCH 49/59] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/psf/black: 23.12.1 → 24.3.0](https://github.com/psf/black/compare/23.12.1...24.3.0) - [github.com/PyCQA/flake8: 6.1.0 → 7.0.0](https://github.com/PyCQA/flake8/compare/6.1.0...7.0.0) --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 190275a..7cd6a56 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -20,12 +20,12 @@ repos: - id: trailing-whitespace - repo: https://github.com/psf/black - rev: 23.12.1 + rev: 24.3.0 hooks: - id: black - repo: https://github.com/PyCQA/flake8 - rev: 6.1.0 + rev: 7.0.0 hooks: - id: flake8 args: [--max-line-length=88] From 8554d21e0aa7de6fa7140da3b47297d3b72ecf9a Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 2 Jul 2024 01:08:34 +0000 Subject: [PATCH 50/59] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/pre-commit/pre-commit-hooks: v4.5.0 → v4.6.0](https://github.com/pre-commit/pre-commit-hooks/compare/v4.5.0...v4.6.0) - [github.com/psf/black: 24.3.0 → 24.4.2](https://github.com/psf/black/compare/24.3.0...24.4.2) - [github.com/PyCQA/flake8: 7.0.0 → 7.1.0](https://github.com/PyCQA/flake8/compare/7.0.0...7.1.0) --- .pre-commit-config.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7cd6a56..50d10db 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.5.0 + rev: v4.6.0 hooks: - id: check-added-large-files - id: check-ast @@ -20,12 +20,12 @@ repos: - id: trailing-whitespace - repo: https://github.com/psf/black - rev: 24.3.0 + rev: 24.4.2 hooks: - id: black - repo: https://github.com/PyCQA/flake8 - rev: 7.0.0 + rev: 7.1.0 hooks: - id: flake8 args: [--max-line-length=88] From b2655509e02a1fc1f0bdf62289ad0c43c0488906 Mon Sep 17 00:00:00 2001 From: Leonardo Giordani Date: Tue, 2 Jul 2024 10:51:42 +0100 Subject: [PATCH 51/59] Avoid PyPI/Poetry problem with docutils --- pyproject.toml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 7797840..af0fc8f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -32,6 +32,8 @@ python = ">=3.7,<4.0" pelican = ">=4.5" markdown = {version = ">=3.2.2", optional = true} beautifulsoup4 = "^4.9.3" +# Avoid PyPI/Poetry problem: https://github.com/python-poetry/poetry/issues/9293 +docutils = "!=0.21.post1" [tool.poetry.dev-dependencies] black = {version = ">=22.3.0", allow-prereleases = true} From d7c2f2bf1f51287e23881417bda8fefd05e17797 Mon Sep 17 00:00:00 2001 From: Justin Mayer Date: Wed, 3 Jul 2024 22:45:20 +0200 Subject: [PATCH 52/59] Use PDM & Ruff instead of Poetry+Black+Flake8+isort --- .github/workflows/main.yml | 109 +++++++++++++++------------------ .gitignore | 3 +- .pre-commit-config.yaml | 21 ++----- pyproject.toml | 119 ++++++++++++++++++++++++------------- tasks.py | 75 ++++++++++++----------- tox.ini | 3 - 6 files changed, 171 insertions(+), 159 deletions(-) delete mode 100644 tox.ini diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 37ddfa7..ba41c23 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -7,102 +7,89 @@ env: 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"] + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] steps: - - uses: actions/checkout@v3 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + - uses: actions/checkout@v4 + + - name: Set up Python ${{ matrix.python-version }} & PDM + uses: pdm-project/setup-pdm@v4 with: python-version: ${{ matrix.python-version }} - - name: Set up Pip cache - uses: actions/cache@v3 - id: pip-cache - 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@v3 - id: poetry-cache - with: - path: ~/.cache/pypoetry/virtualenvs - key: poetry-${{ hashFiles('**/poetry.lock') }} - - name: Install dependencies - run: | - poetry run pip install --upgrade pip - poetry install - - name: Run tests - run: poetry run invoke tests + cache: true + cache-dependency-path: ./pyproject.toml + - name: Install dependencies + run: pdm install + + - name: Run tests + run: pdm run invoke tests lint: name: Lint runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 + - name: Validate links in Markdown files uses: JustinBeckwith/linkinator-action@v1 with: retry: true - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: "3.9" - - name: Set Poetry cache - uses: actions/cache@v3 - id: poetry-cache - 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 - - name: Install dependencies - run: | - poetry run pip install --upgrade pip - poetry install - - name: Run linters - run: poetry run invoke lint + - name: Set up Python & PDM + uses: pdm-project/setup-pdm@v4 + with: + python-version: "3.10" + + - name: Install dependencies + run: pdm install + + - name: Run linters + 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@v3 - - name: Setup Python - uses: actions/setup-python@v4 + - uses: actions/checkout@v4 with: - python-version: "3.9" + token: ${{ secrets.GH_TOKEN }} + + - name: Set up Python + uses: actions/setup-python@v5 + with: + 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.16.1 autopub - echo "##[set-output name=release;]$(autopub check)" + python -m pip install autopub httpx + python -m pip install https://github.com/scikit-build/github-release/archive/master.zip + 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 }} 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 c04bc49..12568d5 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -poetry.lock +.pdm-python +pdm.lock diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 50d10db..9cdbf84 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -10,6 +10,7 @@ repos: - 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,19 +20,9 @@ repos: - id: forbid-new-submodules - id: trailing-whitespace - - repo: https://github.com/psf/black - rev: 24.4.2 + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.5.0 hooks: - - id: black - - - repo: https://github.com/PyCQA/flake8 - rev: 7.1.0 - hooks: - - id: flake8 - args: [--max-line-length=88] - language_version: python3 - - - repo: https://github.com/PyCQA/isort - rev: 5.13.2 - hooks: - - id: isort + - id: ruff + - id: ruff-format + args: ["--check"] diff --git a/pyproject.toml b/pyproject.toml index 1c1dc0c..48209dd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,53 +1,63 @@ -[tool.poetry] +[project] name = "pelican-share-post" version = "1.1.0" description = "A Pelican plugin to create share URLs of article" -authors = ["Talha Mansoor ", "Justin Mayer "] -license = "MIT" +authors = [{name = "Talha Mansoor", email = "talha131@gmail.com"}, {name = "Justin Mayer", email = "entroP@gmail.com"}] +license = {text = "MIT"} readme = "README.md" keywords = ["pelican", "plugin", "social"] -repository = "https://github.com/pelican-plugins/share-post" -documentation = "https://docs.getpelican.com" -packages = [ - { include = "pelican" }, -] - classifiers = [ "Development Status :: 5 - Production/Stable", "Environment :: Console", "Framework :: Pelican", "Framework :: Pelican :: Plugins", "Intended Audience :: End Users/Desktop", + "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", "Topic :: Internet :: WWW/HTTP", "Topic :: Software Development :: Libraries :: Python Modules", ] +requires-python = ">=3.8.1,<4.0" +dependencies = [ + "pelican>=4.5", + "beautifulsoup4>=4.9.3", +] -[tool.poetry.urls] -"Funding" = "https://donate.getpelican.com/" +[project.urls] +Homepage = "https://github.com/pelican-plugins/share-post" "Issue Tracker" = "https://github.com/pelican-plugins/share-post/issues" +Funding = "https://donate.getpelican.com/" -[tool.poetry.dependencies] -python = ">=3.7,<4.0" -pelican = ">=4.5" -markdown = {version = ">=3.2.2", optional = true} -beautifulsoup4 = "^4.9.3" -# Avoid PyPI/Poetry problem: https://github.com/python-poetry/poetry/issues/9293 -docutils = "!=0.21.post1" +[project.optional-dependencies] +markdown = ["markdown>=3.4"] -[tool.poetry.dev-dependencies] -black = ">=22.3.0" -flake8 = "^3.9" -flake8-black = "^0.3" -invoke = "^2.1" -isort = "^5.4" -markdown = "^3.4" -pytest = "^6.0" -pytest-cov = "^2.8" -pytest-sugar = "^0.9.7" +[tool.pdm] -[tool.poetry.extras] -markdown = ["markdown"] +[tool.pdm.dev-dependencies] +lint = [ + "invoke>=2.2", + "ruff>=0.5.0,<0.6.0" +] +test = [ + "markdown>=3.4", + "pytest>=7.0", + "pytest-cov>=4.0", + "pytest-sugar>=1.0", +] + +[tool.pdm.build] +source-includes = [ + "CHANGELOG.md", + "CONTRIBUTING.md", +] +includes = ["pelican/"] +excludes = ["**/.DS_Store", "**/test_data/**", "tasks.py"] [tool.autopub] project-name = "Share Post" @@ -55,18 +65,45 @@ 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 method + "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 +] -# 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 f0fbc52..3a8b167 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 = "share_post" 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,50 @@ VENV_PATH = Path(ACTIVE_VENV) if ACTIVE_VENV else (VENV_HOME.expanduser() / PKG_ 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 = ("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 " 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, fix=False, diff=False): + """Run Ruff to ensure code meets project standards.""" + diff_flag, fix_flag = "", "" + if fix: + fix_flag = "--fix" if diff: diff_flag = "--diff" - c.run(f"{CMD_PREFIX}isort {check_flag} {diff_flag} .") + c.run(f"{CMD_PREFIX}ruff check {diff_flag} {fix_flag} .", pty=PTY) @task -def flake8(c): - """Check code for PEP8 compliance via Flake8.""" - c.run(f"{CMD_PREFIX}flake8 {PKG_PATH} tasks.py") - - -@task -def lint(c, diff=False): +def lint(c, 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, fix=fix, diff=diff) + format(c, check=(not fix), diff=diff) @task @@ -69,34 +68,34 @@ def tools(c): """Install development tools in the virtual environment if not already on PATH.""" for tool in TOOLS: if not which(tool): - print(f"** Installing {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`.""" - print("** Installing pre-commit hooks.") + """Install pre-commit hooks to .git/hooks/pre-commit.""" + logger.info("** Installing pre-commit hooks **") c.run(f"{PRECOMMIT} install") @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 897206b8b8b002b0af005901663e8328cfa63816 Mon Sep 17 00:00:00 2001 From: Justin Mayer Date: Wed, 3 Jul 2024 22:49:30 +0200 Subject: [PATCH 53/59] Adjust code to comply with Ruff code style rules --- pelican/plugins/share_post/__init__.py | 2 +- pelican/plugins/share_post/share_post.py | 8 +++----- pelican/plugins/share_post/test_share_post.py | 4 +--- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/pelican/plugins/share_post/__init__.py b/pelican/plugins/share_post/__init__.py index 4185ce8..40c66ed 100644 --- a/pelican/plugins/share_post/__init__.py +++ b/pelican/plugins/share_post/__init__.py @@ -1 +1 @@ -from .share_post import * # noqa +from .share_post import * # noqa: F403,PGH004,RUF100 diff --git a/pelican/plugins/share_post/share_post.py b/pelican/plugins/share_post/share_post.py index f779c15..c27ad79 100644 --- a/pelican/plugins/share_post/share_post.py +++ b/pelican/plugins/share_post/share_post.py @@ -1,6 +1,4 @@ -""" -Share Post -========== +"""Share Post plugin for Pelican. This plugin was originally created by Talha Mansoor @@ -111,10 +109,10 @@ def create_share_links(content): except AttributeError: sub_title = "" - title = quote(f"{main_title}{sub_title}".encode("utf-8")) + title = quote(f"{main_title}{sub_title}".encode()) site_url = content.settings["SITEURL"] - url = quote(f"{site_url}/{content.url}".encode("utf-8")) + url = quote(f"{site_url}/{content.url}".encode()) content.share_post = {} for func in _create_link_functions: diff --git a/pelican/plugins/share_post/test_share_post.py b/pelican/plugins/share_post/test_share_post.py index a35fc59..e973e70 100644 --- a/pelican/plugins/share_post/test_share_post.py +++ b/pelican/plugins/share_post/test_share_post.py @@ -1,7 +1,5 @@ import os -from share_post import run_plugin - from pelican.generators import ArticlesGenerator from pelican.tests.support import get_context, get_settings @@ -26,7 +24,7 @@ def test_share_post(tmp_folder): ) generator.generate_context() - run_plugin([generator]) + share_post.run_plugin([generator]) share_links = generator.articles[0].share_post From cfda0a315a0148719b5e6cc90151a08c7045f656 Mon Sep 17 00:00:00 2001 From: Justin Mayer Date: Wed, 3 Jul 2024 22:50:24 +0200 Subject: [PATCH 54/59] Clarify installation instructions in README --- .github/FUNDING.yml | 2 +- README.md | 3 +++ 2 files changed, 4 insertions(+), 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 diff --git a/README.md b/README.md index f76dab4..a1289af 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,7 @@ [![Build Status](https://img.shields.io/github/actions/workflow/status/pelican-plugins/share-post/main.yml?branch=main)](https://github.com/pelican-plugins/share-post/actions) [![PyPI Version](https://img.shields.io/pypi/v/pelican-share-post)](https://pypi.org/project/pelican-share-post/) +[![Downloads](https://img.shields.io/pypi/dm/pelican-share-post)](https://pypi.org/project/pelican-share-post/) ![License](https://img.shields.io/pypi/l/pelican-share-post?color=blue) Share Post is a Pelican plugin that creates share links in articles that allow site visitors to share the current article with others in a privacy-friendly manner. @@ -18,6 +19,8 @@ This plugin can be installed via: python -m pip install pelican-share-post +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 `share_post` 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. + Usage ----- From 491663a71c5ed19237d8b21b68dabc6fcb0b3f79 Mon Sep 17 00:00:00 2001 From: weeheavy Date: Fri, 17 Jan 2025 15:23:14 +0100 Subject: [PATCH 55/59] feat: Bluesky support (#32) * feat: Bluesky support * docs: add Bluesky * style: move import to original location --- README.md | 3 +++ pelican/plugins/share_post/share_post.py | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/README.md b/README.md index a1289af..8e26419 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,7 @@ article.share_post = { "mastodon": "", "reddit": "", "twitter": "", + "bluesky": "", } ``` @@ -61,6 +62,8 @@ You can then access those variables in your template. For example: RedditTwitter + ❄ + Bluesky

{% endif %} diff --git a/pelican/plugins/share_post/share_post.py b/pelican/plugins/share_post/share_post.py index c27ad79..6172904 100644 --- a/pelican/plugins/share_post/share_post.py +++ b/pelican/plugins/share_post/share_post.py @@ -96,6 +96,12 @@ def create_link_linkedin(title, url, content): ) +@create_link +def create_link_bluesky(title, url, content): + # https://docs.bsky.app/docs/advanced-guides/intent-links + return f"https://bsky.app/intent/compose?text={url}" + + def create_share_links(content): if isinstance(content, contents.Static): return From 167eec501575a61f61f4d74e4b62ad675b574815 Mon Sep 17 00:00:00 2001 From: Leonardo Giordani Date: Wed, 29 Jan 2025 21:44:37 +0000 Subject: [PATCH 56/59] Added release file (#33) --- RELEASE.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 RELEASE.md diff --git a/RELEASE.md b/RELEASE.md new file mode 100644 index 0000000..f3aa673 --- /dev/null +++ b/RELEASE.md @@ -0,0 +1,3 @@ +Release type: minor + +Add Bluesky support From 376cc12df901b4112af5f92f548a2540fbc466a3 Mon Sep 17 00:00:00 2001 From: botpub <52496925+botpub@users.noreply.github.com> Date: Wed, 29 Jan 2025 21:46:02 +0000 Subject: [PATCH 57/59] Release Share Post 1.2.0 --- CHANGELOG.md | 8 ++++++++ RELEASE.md | 3 --- pyproject.toml | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) delete mode 100644 RELEASE.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 7eb580f..088f6f7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,14 @@ CHANGELOG ========= +1.2.0 - 2025-01-29 +------------------ + +Add Bluesky support + +Contributed by [Leonardo Giordani](https://github.com/lgiordani) via [PR #33](https://github.com/pelican-plugins/share-post/pull/33/) + + 1.1.0 - 2023-08-31 ------------------ diff --git a/RELEASE.md b/RELEASE.md deleted file mode 100644 index f3aa673..0000000 --- a/RELEASE.md +++ /dev/null @@ -1,3 +0,0 @@ -Release type: minor - -Add Bluesky support diff --git a/pyproject.toml b/pyproject.toml index 48209dd..40ff79f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "pelican-share-post" -version = "1.1.0" +version = "1.2.0" description = "A Pelican plugin to create share URLs of article" authors = [{name = "Talha Mansoor", email = "talha131@gmail.com"}, {name = "Justin Mayer", email = "entroP@gmail.com"}] license = {text = "MIT"} From 35aec507f43f2c34d2ca4ff87d025797ae5708e3 Mon Sep 17 00:00:00 2001 From: Daniel Lemos Date: Sun, 23 Mar 2025 15:31:47 -0300 Subject: [PATCH 58/59] feat: Add title to bluesky (#34) * feat: Add title to bluesky * Add release file * Format to make the linter happy --------- Co-authored-by: Daniel Lemos --- RELEASE.md | 3 +++ pelican/plugins/share_post/share_post.py | 2 +- pelican/plugins/share_post/test_share_post.py | 5 +++++ 3 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 RELEASE.md diff --git a/RELEASE.md b/RELEASE.md new file mode 100644 index 0000000..e9d0cdf --- /dev/null +++ b/RELEASE.md @@ -0,0 +1,3 @@ +Release type: patch + +Add title to Bluesky \ No newline at end of file diff --git a/pelican/plugins/share_post/share_post.py b/pelican/plugins/share_post/share_post.py index 6172904..2f829c1 100644 --- a/pelican/plugins/share_post/share_post.py +++ b/pelican/plugins/share_post/share_post.py @@ -99,7 +99,7 @@ def create_link_linkedin(title, url, content): @create_link def create_link_bluesky(title, url, content): # https://docs.bsky.app/docs/advanced-guides/intent-links - return f"https://bsky.app/intent/compose?text={url}" + return f"https://bsky.app/intent/compose?text={title}%20{url}" def create_share_links(content): diff --git a/pelican/plugins/share_post/test_share_post.py b/pelican/plugins/share_post/test_share_post.py index e973e70..5ff33f9 100644 --- a/pelican/plugins/share_post/test_share_post.py +++ b/pelican/plugins/share_post/test_share_post.py @@ -61,3 +61,8 @@ def test_share_post(tmp_folder): share_links["reddit"] == "https://www.reddit.com/submit?url=/test-post.html&title=Test%20post" ) + + assert ( + share_links["bluesky"] + == "https://bsky.app/intent/compose?text=Test%20post%20/test-post.html" + ) From 7b77fb814395107b65c52aaa8b0b82b116489a6e Mon Sep 17 00:00:00 2001 From: botpub <52496925+botpub@users.noreply.github.com> Date: Sun, 23 Mar 2025 18:33:10 +0000 Subject: [PATCH 59/59] Release Share Post 1.2.1 --- CHANGELOG.md | 8 ++++++++ RELEASE.md | 3 --- pyproject.toml | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) delete mode 100644 RELEASE.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 088f6f7..a7c7fc0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,14 @@ CHANGELOG ========= +1.2.1 - 2025-03-23 +------------------ + +Add title to Bluesky + +Contributed by [Daniel Lemos](https://github.com/xspager) via [PR #34](https://github.com/pelican-plugins/share-post/pull/34/) + + 1.2.0 - 2025-01-29 ------------------ diff --git a/RELEASE.md b/RELEASE.md deleted file mode 100644 index e9d0cdf..0000000 --- a/RELEASE.md +++ /dev/null @@ -1,3 +0,0 @@ -Release type: patch - -Add title to Bluesky \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 40ff79f..90ed39b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "pelican-share-post" -version = "1.2.0" +version = "1.2.1" description = "A Pelican plugin to create share URLs of article" authors = [{name = "Talha Mansoor", email = "talha131@gmail.com"}, {name = "Justin Mayer", email = "entroP@gmail.com"}] license = {text = "MIT"}