Skip to main content

Jupyterpost: post from Jupyterhub to a Mattermost server

Installing

pip install jupyterpost

Enabling jupyterpost

  1. Create a bot user on your Mattermost server and get its token.
  2. Add the following at the end of your Jupyterhub config file.
from jupyterpost import configure_jupyterhub

configure_jupyterhub(
    c,
    mattermost_token="your mattermost token",
    mattermost_url="https://your.mattermost.server/api/v4/",
    mattermost_team="your mattermost team name",
    jupyterpost_url="https://services.your.jupyterhub/services/jupyterpost",
)

This will:

  • add a new service jupyterpost to your Jupyterhub
  • give all users and their servers access to this service
  • provide the service URL to the user's server as an environment variable JUPYTERPOST_URL

The function is somewhat fragile, but should work for standard Jupyterhub installations.

Using jupyterpost

from jupyterpost import post
from matplotlib import pyplot

pyplot.plot([0, 1])
post(
    message="Check out my plot",
    channel="my-channel",  # Or "@username"
    attachment=pyplot.gcf(),  # Or png bytes
)

Posting from outside of your Jupyterhub

  1. Get the variables JUPYTERPOST_URL and JPY_API_TOKEN from your Jupyterhub server.
  2. Provide them to jupyterpost.post as additional arguments and connect from anywhere!

Contributing

Contributions are welcome! Please open an issue or a pull request.

Specifically I would like to support more chat services, and more ways to post messages.

Tests would also be great huehuehue.

Metadata

Release files for jupyterpost 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for jupyterpost 0.0.1
File Size Uploaded
jupyterpost-0.0.1.tar.gz 5.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for jupyterpost 0.0.1
File Interpreter ABI Platform
jupyterpost-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 11.4 kB

Release files / jupyterpost-0.0.1.tar.gz

Download URL jupyterpost-0.0.1.tar.gz
Size 5.3 kB
Tags Source
SHA-256 checksum
How to use checksums
f24f5278b071b30bbf7201612d1e08edae7bef7a049ea68d70ec36573397f37f
BLAKE2b-256 checksum
How to use checksums
cb80d3d089c4e78b1a5acc35a40b67c1d9d072308bb75fd2a657aebdc03991f6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.28.2

Release files / jupyterpost-0.0.1-py3-none-any.whl

Download URL jupyterpost-0.0.1-py3-none-any.whl
Size 6.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0a99ca45e700cb2f41c3185cb6278b48265a58412422f4c6f0ab1921a15cd846
BLAKE2b-256 checksum
How to use checksums
0d3b1363b68920fad4bca49b8d52369c7af4a3844eaaa56c962d3f64999e6412
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.28.2

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page