Skip to main content

IPython magic for sending slack notifications

Project description

Installation

$ pip install ipyslack

Usage

  1. Load the extension:

    %load_ext ipyslack
  2. Configure Slack API:

    %slack_setup -t <api_token> -c <target_channel>

    To obtain the API token visit this page. The <target_channel> parameter may either denote a channel (e.g. #general) or a user (e.g. @me).

    Adding the option -u to %slack_setup will make yourself the sender of all messages. Otherwise (default) the messages originate from slackbot.

  3. Now adding:

    %%slack_notify <message>

    at the top of any cell will send <message> to <target_channel> whenever cell execution is completed.

    The patterns {out} and {err} within <message> will be substituted with stdout or stderr from the cell’s execution. The pattern {exc} denotes the exception (if any was thrown). The string \n denotes a new line.

    Example:

    %%slack_notify *Completed!* :heavy_plus_sign:\nStdout: {out}\nStderr: {err}\nException: {exc}
  4. In addition, the line-magic %slack_send <message> lets you send notifications about partial results. E.g.:

    %%slack_notify All done. {exc}
    ... computation ...
    %slack_send Half-way!
    ... computation ...

See also

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

ipyslack-1.0.zip (6.5 kB view hashes)

Uploaded Source

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