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:
- 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).
- A token for that app. You can find it in OAuth&Permissions
- 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
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file rapporteur-0.1.2.tar.gz.
File metadata
- Download URL: rapporteur-0.1.2.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
447af79fb6021fc9c567dd61cccf6825713a791c515c89b7296a675ecf382a46
|
|
| MD5 |
125818a955a4f92cde18b645fd7d510f
|
|
| BLAKE2b-256 |
d29b22f80fd3d86d09ec4d400e3db85006e40e01fd410d2cd500c7022d8fea2f
|
Provenance
The following attestation bundles were made for rapporteur-0.1.2.tar.gz:
Publisher:
publish.yml on breuleux/rapporteur
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rapporteur-0.1.2.tar.gz -
Subject digest:
447af79fb6021fc9c567dd61cccf6825713a791c515c89b7296a675ecf382a46 - Sigstore transparency entry: 646753788
- Sigstore integration time:
-
Permalink:
breuleux/rapporteur@1a0dc36e04047344a5130a9780530ba5cee40534 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/breuleux
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@1a0dc36e04047344a5130a9780530ba5cee40534 -
Trigger Event:
push
-
Statement type:
File details
Details for the file rapporteur-0.1.2-py3-none-any.whl.
File metadata
- Download URL: rapporteur-0.1.2-py3-none-any.whl
- Upload date:
- Size: 4.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
52389280bdccf743fdeb9929faf13a6c1bd9f7deb21aeb055ace4665ac6d6022
|
|
| MD5 |
474cfc115236df1a6fd8c7cd42a17369
|
|
| BLAKE2b-256 |
042135983aaaf74693abf00647e214801a0b388080f67ea78f383b51091e7712
|
Provenance
The following attestation bundles were made for rapporteur-0.1.2-py3-none-any.whl:
Publisher:
publish.yml on breuleux/rapporteur
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rapporteur-0.1.2-py3-none-any.whl -
Subject digest:
52389280bdccf743fdeb9929faf13a6c1bd9f7deb21aeb055ace4665ac6d6022 - Sigstore transparency entry: 646753809
- Sigstore integration time:
-
Permalink:
breuleux/rapporteur@1a0dc36e04047344a5130a9780530ba5cee40534 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/breuleux
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@1a0dc36e04047344a5130a9780530ba5cee40534 -
Trigger Event:
push
-
Statement type: