Coder Social home page Coder Social logo

nb-slack's Introduction

install with python setup.py develop

nb-slack

Jupyter notebook extension for sending slack notifications from long running notebooks

Installation

You'll need Python 3

pip install https://github.com/flowmatters/nb-slack/archive/master.zip

At this stage we haven't tagged releases so you just install from the latest version.

To upgrade, uninstall the one you've got, then install again

pip uninstall nb-slack
pip install https://github.com/flowmatters/nb-slack/archive/master.zip

Setup

You'll need a webhook configured in you Slack team. Most likely you'll want the webhook configured to send a private message to you, rather than one of the broader channels.

To set up a new webhook, go to https://my.slack.com/services/new/incoming-webhook/, and select the channel you want to post to from Jupyter. Then click 'Add Incoming WebHooks integration'.

You'll then be presented with a Webhook URL, and a lot of options that you can ignore in the first instance. The Webhook URL is all you need - it's in the form of:

https://hooks.slack.com/services/LETTERS/AND/NUMBERS

Copy the URL into your notebook as a variable:

webhook='https://hooks.slack.com/services/LETTERS/AND/NUMBERS'

Usage

Once you've got the webhook and the URL, you're ready to use nbslack:

import nbslack

# Initialise notifications - 
nbslack.notifying('Username that will appear in slack',webhook)
# The call to notifying doesn't send any notifications itself, but it does
# setup the functions notify and done and an IPython hook for unhandled exceptions

# Send a notification
nbslack.notify("I've gotten past the tricky bit")

# Notifications sent on unhandled exceptions
assert False

# Send one final notification and disable further notifications (including exceptions)
nbslack.done('Woohoo!')

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.