Skip to main content

Add more granular signals to Pelican.

Project description

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:

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pelican-granular-signals-1.0.1.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

pelican_granular_signals-1.0.1-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

File details

Details for the file pelican-granular-signals-1.0.1.tar.gz.

File metadata

  • Download URL: pelican-granular-signals-1.0.1.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.10.4 Windows/10

File hashes

Hashes for pelican-granular-signals-1.0.1.tar.gz
Algorithm Hash digest
SHA256 40214fe5fb5deb9936182ff9b0ce89472c2673b7541c07a6b3938a43b5bd69c1
MD5 571671d5557733f9292dddd11a49cc1d
BLAKE2b-256 362537c4a182fde84033d7100a266b8e2c6b022f4d9e4294eaacb24a96506b76

See more details on using hashes here.

Provenance

File details

Details for the file pelican_granular_signals-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for pelican_granular_signals-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d2e3895332ce1abdc8371c76fbebfa9ed992c250bc97d62b6dfcbf3b60e479b3
MD5 c641fce4180d85ac0ae76e477ce37c34
BLAKE2b-256 53b5c8f4c1f1698c3074be294a24ce2688595b43fa5762446c2e7894fed57a61

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page