Name | pelican-granular-signals JSON |
Version |
1.2.0
JSON |
| download |
home_page | None |
Summary | Add more granular signals to Pelican. |
upload_time | 2024-09-09 21:50:03 |
maintainer | None |
docs_url | None |
author | Kurt McKee |
requires_python | >=3.9 |
license | MIT |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
.. This file is part of the pelican-granular-signals plugin.
.. Copyright 2021-2024 Kurt McKee <contactme@kurtmckee.org>
.. Released under the MIT license.
pelican-granular-signals
************************
*Ensure that your Pelican plugin is called at the right time, every time.*
----
Love `Pelican`_ but hate that your finalization plugin isn't always called in the right order?
Don't let your plugin get lost in the shuffle of the ``finalized`` signal!
**pelican-granular-signals** adds new finalization signals
that guarantee your plugin is called at the right time, every time.
New Pelican signals
===================
When **pelican-granular-signals** is installed,
the following signals will be called immediately after the ``finalized`` signal:
* ``sitemap``
* ``optimize``
* ``minify``
* ``compress``
* ``deploy``
Each signal will be sent with the same argument that is sent to the ``finalized`` signal.
Connecting to granular signals
==============================
Your plugin must register with `blinker`_ directly.
Here's a complete example:
.. code-block:: python
import blinker
import pelican.plugins.granular_signals
def register():
# This line is highly recommended so users
# don't have to update their configurations.
pelican.plugins.granular_signals.register()
# Connect your awesome plugin to a granular signal.
blinker.signal("deploy").connect(deploy_site)
# -----------------------------------------------------
# Put your awesome plugin code here.
import subprocess
def deploy_site(instance):
subprocess.run(instance.settings["DEPLOY_COMMAND"])
Helping users out
=================
To make life easier for users, consider taking these two steps:
1. List **pelican-granular-signals** as a dependency so it will be automatically installed with your plugin.
2. When Pelican calls your plugin's ``register()`` function, call ``pelican.plugins.granular_signals.register()``.
Pelican 4.5 introduced a new, automatic plugin loading feature
and **pelican-granular-signals** is designed to work with this feature!
Unfortunately, if a user specifies which plugins to load in their configuration file
then automatic plugin loading will be disabled.
It is therefore recommended that you call ``pelican.plugins.granular_signals.register()``
in your plugin's ``register()`` function.
``pelican.plugins.granular_signals.register()`` can be called multiple times without creating any problems.
.. Links
.. =====
.. _Pelican: https://getpelican.com/
.. _blinker: https://github.com/pallets-eco/blinker
Raw data
{
"_id": null,
"home_page": null,
"name": "pelican-granular-signals",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": null,
"author": "Kurt McKee",
"author_email": "contactme@kurtmckee.org",
"download_url": "https://files.pythonhosted.org/packages/ca/49/41dfe41f7196378861b5d8b96d7827ccaabca058320994983cd844ba4e02/pelican_granular_signals-1.2.0.tar.gz",
"platform": null,
"description": ".. This file is part of the pelican-granular-signals plugin.\n.. Copyright 2021-2024 Kurt McKee <contactme@kurtmckee.org>\n.. Released under the MIT license.\n\npelican-granular-signals\n************************\n\n*Ensure that your Pelican plugin is called at the right time, every time.*\n\n----\n\nLove `Pelican`_ but hate that your finalization plugin isn't always called in the right order?\nDon't let your plugin get lost in the shuffle of the ``finalized`` signal!\n**pelican-granular-signals** adds new finalization signals\nthat guarantee your plugin is called at the right time, every time.\n\n\n\nNew Pelican signals\n===================\n\nWhen **pelican-granular-signals** is installed,\nthe following signals will be called immediately after the ``finalized`` signal:\n\n* ``sitemap``\n* ``optimize``\n* ``minify``\n* ``compress``\n* ``deploy``\n\nEach signal will be sent with the same argument that is sent to the ``finalized`` signal.\n\n\n\nConnecting to granular signals\n==============================\n\nYour plugin must register with `blinker`_ directly.\nHere's a complete example:\n\n.. code-block:: python\n\n import blinker\n\n import pelican.plugins.granular_signals\n\n\n def register():\n # This line is highly recommended so users\n # don't have to update their configurations.\n pelican.plugins.granular_signals.register()\n\n # Connect your awesome plugin to a granular signal.\n blinker.signal(\"deploy\").connect(deploy_site)\n\n\n # -----------------------------------------------------\n # Put your awesome plugin code here.\n\n import subprocess\n\n def deploy_site(instance):\n subprocess.run(instance.settings[\"DEPLOY_COMMAND\"])\n\n\n\nHelping users out\n=================\n\nTo make life easier for users, consider taking these two steps:\n\n1. List **pelican-granular-signals** as a dependency so it will be automatically installed with your plugin.\n2. When Pelican calls your plugin's ``register()`` function, call ``pelican.plugins.granular_signals.register()``.\n\nPelican 4.5 introduced a new, automatic plugin loading feature\nand **pelican-granular-signals** is designed to work with this feature!\nUnfortunately, if a user specifies which plugins to load in their configuration file\nthen automatic plugin loading will be disabled.\nIt is therefore recommended that you call ``pelican.plugins.granular_signals.register()``\nin your plugin's ``register()`` function.\n\n``pelican.plugins.granular_signals.register()`` can be called multiple times without creating any problems.\n\n\n\n\n.. Links\n.. =====\n\n.. _Pelican: https://getpelican.com/\n.. _blinker: https://github.com/pallets-eco/blinker\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Add more granular signals to Pelican.",
"version": "1.2.0",
"project_urls": null,
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "6b307d1e06d2736749b8dbc7cd8e34aced8a324d13b45f7ca48d74ca45e57693",
"md5": "ff64bcf09b3573b82be347bbc8a2be1b",
"sha256": "6f45efc040481a33cf9acdeac7949eddad4923a67fe52b4668bab9f534ff7b72"
},
"downloads": -1,
"filename": "pelican_granular_signals-1.2.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "ff64bcf09b3573b82be347bbc8a2be1b",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 3879,
"upload_time": "2024-09-09T21:50:02",
"upload_time_iso_8601": "2024-09-09T21:50:02.175152Z",
"url": "https://files.pythonhosted.org/packages/6b/30/7d1e06d2736749b8dbc7cd8e34aced8a324d13b45f7ca48d74ca45e57693/pelican_granular_signals-1.2.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "ca4941dfe41f7196378861b5d8b96d7827ccaabca058320994983cd844ba4e02",
"md5": "6371545049da58ff338b45da12826747",
"sha256": "6b087d491fe8499937c1b291c3457523d9267382e8e9632102367480948403e0"
},
"downloads": -1,
"filename": "pelican_granular_signals-1.2.0.tar.gz",
"has_sig": false,
"md5_digest": "6371545049da58ff338b45da12826747",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 3355,
"upload_time": "2024-09-09T21:50:03",
"upload_time_iso_8601": "2024-09-09T21:50:03.080278Z",
"url": "https://files.pythonhosted.org/packages/ca/49/41dfe41f7196378861b5d8b96d7827ccaabca058320994983cd844ba4e02/pelican_granular_signals-1.2.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-09-09 21:50:03",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "pelican-granular-signals"
}