WillKoehrsen / Data-Analysis

Data Science Using Python

Home Page:https://medium.com/@williamkoehrsen/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Slack magic?

psychemedia opened this issue · comments

Have you looked at creating some IPython line or block magic (%slack or %%slack) to support issuing Slack commands from notebook code cells?

I'm think that your Interacting with Slack.ipynb probably contains many of the necessary ingredients already?

That is a brilliant idea! It doesn't appear to be very hard to write your own cell magic so I'll give it a shot. Thanks for the recommendation!

@WillKoehrsen This magic — https://github.com/catherinedevlin/ipython-sql — is quite a rich one (I think a Slack magic could be easier), but it demonstrates a feature that might be useful for a Slack magic, specifically persisting the connection so that you only need to set it once.

I've also wondered about a complementary approach - defining a Slack slash command that could send a code fragment to a Jupyter kernel launched on Binderhub, and get the response back into Slack? Something like the ThebeLab js package might provide a clue as to how to do this?

Here's another thought on the side... In terms of notification-style working, jupyter-notify provides "Jupyter magic for browser notifications of cell completion". Just prefix a long running cell with %%notify and you'll get a notification when it completes via a browser push notification.

So if a browser notification, why not a Slack channel notification?