Skip to main content

Report run status and results to Slack and others

Project description

Rapporteur

A simple package to log the result of the execution of a program, as well as status updates, to Slack (and possibly other backends).

Install

pip install rapporteur
# or #
uv add rapporteur

Getting the information you need

To make rapporteur work, you need:

  1. A Slack app installed in the workspace (https://api.slack.com/apps). Make sure that it has the scope to write to channels. Then, add it to the relevant channels (Edit Settings for the channel, go to Integrations, Add App, then select the app).
  2. A token for that app. You can find it in OAuth&Permissions
  3. The channel ID. If you click on the name of a channel, you can see its Channel ID at the bottom, which typically starts with C. If you are in a browser, it is also the last part of the URL.

Basic usage

from rapporteur.report import Report
from rapporteur.slack import SlackReporter

report = Report(
    description="My test report",
    reporters=[
        SlackReporter(token="xoxb-your-token", channel="C12345678")
    ],
)
with report:
    logger.info("Hello, world!")
    logger.error("oh no!")  # Will be in the Slack report

With serieux

The configuration for a report can be stored in a file and deserialized using serieux (>=0.2.9).

Configuration

description: "test test test"
reporters:
  - $class: rapporteur.slack:SlackReporter
    token: "xoxb-your-token"
    show_logs: 5   # Show last 5 error logs
    channel: "C12345678"

To encrypt the token using PASSWORD, set the $SERIEUX_PASSWORD environment variable to PASSWORD and run:

serieux patch -m rapporteur.report:Report -f path/to/config.yaml

The above command will patch the config inplace to replace the token with an encrypted version of the token, using the provided password. The argument to -m is a reference to the model for the whole configuration file, so you may want to adjust it if the report config is part of a bigger config.

Code

import os
from serieux import deserialize
from serieux.features.encrypt import EncryptionKey

# You can omit EncryptionKey if it's not encrypted
report = deserialize(Report, Path("path/to/config.yaml"), EncryptionKey(os.environ[SERIEUX_PASSWORD]))
with report:
    logger.info("Hello, world!")
    logger.error("oh no!")  # Will be in the Slack report

    # Optional: set a custom message to be displayed at the end
    report.set_message("It is done.")

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

rapporteur-0.1.3.tar.gz (3.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rapporteur-0.1.3-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file rapporteur-0.1.3.tar.gz.

File metadata

  • Download URL: rapporteur-0.1.3.tar.gz
  • Upload date:
  • Size: 3.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for rapporteur-0.1.3.tar.gz
Algorithm Hash digest
SHA256 ea014456d5117045c3989d546bafc75375e1b44ab01fe2620c876e7dc44bc84a
MD5 0fde2465920b4852235b4cbb79173eac
BLAKE2b-256 0ac5c6f97517701a6a717e14bd336869e7616bf19fd248ec21e73bc82074b19d

See more details on using hashes here.

Provenance

The following attestation bundles were made for rapporteur-0.1.3.tar.gz:

Publisher: publish.yml on breuleux/rapporteur

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rapporteur-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: rapporteur-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 5.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for rapporteur-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 2b0ab926b92ae2e135a49b04198e8242d74aedb7b0f91e28be980e7898f61acf
MD5 d920d7fe2488221243de44541eec71f8
BLAKE2b-256 01d9e1117d08880890c715891049595be781b6b56e89e79cc258c9bb944b0d7c

See more details on using hashes here.

Provenance

The following attestation bundles were made for rapporteur-0.1.3-py3-none-any.whl:

Publisher: publish.yml on breuleux/rapporteur

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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