diff --git a/.coveragerc b/.coveragerc index fdd2cad6..6347d80b 100644 --- a/.coveragerc +++ b/.coveragerc @@ -1,2 +1,4 @@ [report] -omit = pelican/tests/* +omit = + pelican/tests/* + pelican/signals.py diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs index 0d92c9d9..df6e6f61 100644 --- a/.git-blame-ignore-revs +++ b/.git-blame-ignore-revs @@ -5,3 +5,17 @@ cabdb26cee66e1173cf16cb31d3fe5f9fa4392e7 ecd598f293161a52564aa6e8dfdcc8284dc93970 # Apply Ruff and pyupgrade to Jinja templates db241feaa445375dc05e189e69287000ffe5fa8e +# Change pre-commit to run ruff and ruff-format with fixes +6d8597addb17d5fa3027ead91427939e8e4e89ec +# Upgrade Ruff from 0.1.x to 0.4.x +0bd02c00c078fe041b65fbf4eab13601bb42676d +# Apply more Ruff checks to code +9d30c5608a58d202b1c02d55651e6ac746bfb173 +# Apply yet more Ruff checks to code +7577dd7603f7cb3a09922d1edb65b6eafb6e2ac7 +# Indent Jinja templates, HTML, CSS, and JS via DjHTML +4af40e80772a58eac8969360e5caeb99e3e26e78 +# Ruff UP031: Use F-string format specifiers instead of percent format +30bde3823f50b9ba8ac5996c1c46bb72031aa6b8 +# Upgrade Ruff to 0.12.x & comply with new rules +4dedf1795831db99d18941c707923ba48cc28ce7 diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 00000000..0fbd850c --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1 @@ +.github/workflows/github_pages.yml @seanh diff --git a/.github/ISSUE_TEMPLATE/---bug-report.md b/.github/ISSUE_TEMPLATE/---bug-report.md index c0f9dec6..6825b61c 100644 --- a/.github/ISSUE_TEMPLATE/---bug-report.md +++ b/.github/ISSUE_TEMPLATE/---bug-report.md @@ -17,11 +17,15 @@ assignees: '' - [ ] I have read the [Filing Issues](https://docs.getpelican.com/en/latest/contribute.html#filing-issues) and subsequent “How to Get Help” sections of the documentation. +- [ ] I can reproduce this problem with stock/default settings file, theme, and sample content (as described in above “How to Get Help” sections of the documentation). - [ ] I have searched the [issues](https://github.com/getpelican/pelican/issues?q=is%3Aissue) (including closed ones) and believe that this is not a duplicate. - **OS version and name**: diff --git a/.github/ISSUE_TEMPLATE/---everything-else.md b/.github/ISSUE_TEMPLATE/---everything-else.md index fd2a58ae..23a3f7bd 100644 --- a/.github/ISSUE_TEMPLATE/---everything-else.md +++ b/.github/ISSUE_TEMPLATE/---everything-else.md @@ -8,7 +8,11 @@ assignees: '' --- - [ ] I have searched the [issues](https://github.com/getpelican/pelican/issues?q=is%3Aissue) (including closed ones) and believe that this is not a duplicate. - [ ] I have searched the [documentation](https://docs.getpelican.com/) and believe that my question is not covered. +- [ ] I have carefully read the [How to Get Help](https://docs.getpelican.com/en/latest/contribute.html#how-to-get-help) section of the documentation. ## Issue diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index 9e240bd9..a07de4ab 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -1,6 +1,6 @@ --- # Ref: https://help.github.com/en/github/building-a-strong-community/configuring-issue-templates-for-your-repository#configuring-the-template-chooser -blank_issues_enabled: true +blank_issues_enabled: false contact_links: - name: '💬 Pelican IRC Channel' url: https://web.libera.chat/?#pelican diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000..4fed5330 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,9 @@ +# See https://docs.github.com/en/free-pro-team@latest/ +# github/administering-a-repository/enabling-and-disabling-version-updates +--- +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "monthly" diff --git a/.github/workflows/github_pages.yml b/.github/workflows/github_pages.yml index ccf172b4..9c279ab1 100644 --- a/.github/workflows/github_pages.yml +++ b/.github/workflows/github_pages.yml @@ -1,3 +1,4 @@ +# Workflow for building the site and (optionally) publishing it to GitHub Pages. name: Deploy to GitHub Pages on: workflow_call: @@ -16,39 +17,83 @@ on: default: "output/" description: "Where to output the generated files (`pelican`'s `--output` option)" type: string + theme: + required: false + default: "" + description: "The GitHub repo URL of a custom theme to use, for example: 'https://github.com/seanh/sidecar.git'" + type: string + python: + required: false + default: "3.12" + description: "The version of Python to use, for example: '3.12' (to use the most recent version of Python 3.12, this is faster) or '3.12.1' (to use an exact version, slower)" + type: string + siteurl: + required: false + default: "" + description: "The base URL of your web site (Pelican's SITEURL setting). If not passed this will default to the URL of your GitHub Pages site, which is correct in most cases." + type: string + feed_domain: + required: false + default: "" + description: "The domain to be prepended to feed URLs (Pelican's FEED_DOMAIN setting). If not passed this will default to the URL of your GitHub Pages site, which is correct in most cases." + type: string + deploy: + required: false + default: true + description: "Whether to deploy the site. If true then build the site and deploy it. If false then just test that the site builds successfully but don't deploy anything." + type: boolean permissions: contents: read pages: write id-token: write -concurrency: - group: "pages" - cancel-in-progress: false jobs: build: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: - python-version: "3.11" + python-version: ${{ inputs.python }} + - name: Checkout theme + if: ${{ inputs.theme }} + run: git clone '${{ inputs.theme }}' .theme - name: Configure GitHub Pages id: pages - uses: actions/configure-pages@v3 + uses: actions/configure-pages@v5 - name: Install requirements run: pip install ${{ inputs.requirements }} - name: Build Pelican site + shell: python run: | - pelican \ - --settings "${{ inputs.settings }}" \ - --extra-settings SITEURL='"${{ steps.pages.outputs.base_url }}"' \ - --output "${{ inputs.output-path }}" + import subprocess + + cmd = "pelican" + cmd += " --settings ${{ inputs.settings }}" + cmd += " --extra-settings" + cmd += """ SITEURL='"${{ inputs.siteurl || steps.pages.outputs.base_url }}"'""" + cmd += """ FEED_DOMAIN='"${{ inputs.feed_domain || steps.pages.outputs.base_url }}"'""" + cmd += " --output ${{ inputs.output-path }}" + + if "${{ inputs.theme }}": + cmd += " --theme-path .theme" + + subprocess.run(cmd, shell=True, check=True) + - name: Fix permissions + run: | + chmod -c -R +rX "${{ inputs.output-path }}" | while read line; do + echo "::warning title=Invalid file permissions automatically fixed::$line" + done - name: Upload artifact - uses: actions/upload-pages-artifact@v2 + uses: actions/upload-pages-artifact@v3 with: path: ${{ inputs.output-path }} deploy: + concurrency: + group: "pages" + cancel-in-progress: false + if: ${{ inputs.deploy }} environment: name: github-pages url: ${{ steps.deployment.outputs.page_url }} @@ -57,4 +102,4 @@ jobs: steps: - name: Deploy to GitHub Pages id: deployment - uses: actions/deploy-pages@v2 + uses: actions/deploy-pages@v4 diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c29a08c2..9e5a877b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -15,17 +15,15 @@ jobs: strategy: matrix: os: [ubuntu, macos, windows] - python: ["3.10", "3.11", "3.12"] + python: ["3.10", "3.11", "3.12", "3.13"] include: - - os: ubuntu - python: "3.8" - os: ubuntu python: "3.9" steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python }} cache: "pip" @@ -52,10 +50,10 @@ jobs: name: Lint runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: pdm-project/setup-pdm@v3 + - uses: actions/checkout@v4 + - uses: pdm-project/setup-pdm@v4 with: - python-version: 3.9 + python-version: "3.11" cache: true cache-dependency-path: ./pyproject.toml - name: Install dependencies @@ -64,16 +62,16 @@ jobs: - name: Run linters run: pdm lint --diff - name: Run pre-commit checks on all files - uses: pre-commit/action@v3.0.0 + uses: pre-commit/action@v3.0.1 build: name: Test build runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: pdm-project/setup-pdm@v3 + - uses: actions/checkout@v4 + - uses: pdm-project/setup-pdm@v4 with: - python-version: 3.9 + python-version: "3.11" cache: true cache-dependency-path: ./pyproject.toml - name: Install dependencies @@ -88,11 +86,11 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: - python-version: "3.9" + python-version: "3.11" cache: "pip" cache-dependency-path: "**/requirements/*" - name: Install tox @@ -100,7 +98,7 @@ jobs: - name: Check run: tox -e docs - name: cache the docs for inspection - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: docs path: docs/_build/html/ @@ -110,21 +108,21 @@ jobs: environment: Deployment needs: [test, lint, docs, build] runs-on: ubuntu-latest - if: github.ref=='refs/heads/master' && github.event_name!='pull_request' && github.repository == 'getpelican/pelican' + if: github.ref=='refs/heads/main' && github.event_name!='pull_request' && github.repository == 'getpelican/pelican' permissions: contents: write id-token: write steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: token: ${{ secrets.GH_TOKEN }} - name: Set up Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: - python-version: "3.9" + python-version: "3.11" - name: Check release id: check_release diff --git a/.gitignore b/.gitignore index 473efea2..6ea22c9c 100644 --- a/.gitignore +++ b/.gitignore @@ -4,7 +4,7 @@ *.pyc .DS_Store docs/_build -docs/fr/_build +docs/*/_build build dist tags @@ -17,4 +17,13 @@ samples/output *.pem *.lock .pdm-python +.vale .venv +**/LC_MESSAGES/*.mo + +# direnv +.envrc + +# IDE cruft +.idea +.vscode diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 333bc3c0..38287df9 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.5.0 + rev: v5.0.0 hooks: - id: check-added-large-files - id: check-ast @@ -13,11 +13,18 @@ repos: - id: end-of-file-fixer - id: forbid-new-submodules - id: trailing-whitespace - - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.1.5 - hooks: - - id: ruff - - id: ruff-format - args: ["--check"] -exclude: ^pelican/tests/output/ + - repo: https://github.com/astral-sh/ruff-pre-commit + # ruff version should match the one in pyproject.toml + rev: v0.12.2 + hooks: + - id: ruff-check + args: [--fix, --exit-non-zero-on-fix] + - id: ruff-format + + - repo: https://github.com/rtts/djhtml + rev: '3.0.8' + hooks: + - id: djhtml + - id: djcss + - id: djjs diff --git a/.vale.ini b/.vale.ini new file mode 100644 index 00000000..aad18229 --- /dev/null +++ b/.vale.ini @@ -0,0 +1,10 @@ +StylesPath = .vale/styles + +Vocab = Pelican + +MinAlertLevel = suggestion + +Packages = proselint, alex + +[*] +BasedOnStyles = Vale, proselint, alex diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 4faace91..5ac5f0ad 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -24,7 +24,7 @@ Before you ask for help, please make sure you do the following: 3. Try reproducing the issue in a clean environment, ensuring you are using: -* latest Pelican release (or an up-to-date Git clone of Pelican master) +* latest Pelican release (or an up-to-date Git clone of Pelican ``main`` branch) * latest releases of libraries used by Pelican * no plugins or only those related to the issue @@ -87,7 +87,7 @@ Using Git and GitHub -------------------- * `Create a new branch`_ specific to your change (as opposed to making - your commits in the master branch). + your commits in the ``main`` branch). * **Don't put multiple unrelated fixes/features in the same branch / pull request.** For example, if you're working on a new feature and find a bugfix that doesn't *require* your new feature, **make a new distinct branch and pull diff --git a/README.rst b/README.rst index 3f708242..0e3577ec 100644 --- a/README.rst +++ b/README.rst @@ -64,8 +64,8 @@ Why the name “Pelican”? .. _`Pelican's internals`: https://docs.getpelican.com/en/latest/internals.html .. _`hosted on GitHub`: https://github.com/getpelican/pelican -.. |build-status| image:: https://img.shields.io/github/actions/workflow/status/getpelican/pelican/main.yml?branch=master - :target: https://github.com/getpelican/pelican/actions/workflows/main.yml?query=branch%3Amaster +.. |build-status| image:: https://img.shields.io/github/actions/workflow/status/getpelican/pelican/main.yml?branch=main + :target: https://github.com/getpelican/pelican/actions/workflows/main.yml?query=branch%3Amain :alt: GitHub Actions CI: continuous integration status .. |pypi-version| image:: https://img.shields.io/pypi/v/pelican.svg :target: https://pypi.org/project/pelican/ diff --git a/docs/_templates/page.html b/docs/_templates/page.html index 233f43ad..0fbfdf7d 100644 --- a/docs/_templates/page.html +++ b/docs/_templates/page.html @@ -1,201 +1,201 @@ {% extends "base.html" %} {% block body -%} -{{ super() }} -{% include "partials/icons.html" %} + {{ super() }} + {% include "partials/icons.html" %} - - - - + + + + -{% if theme_announcement -%} -