Skip to main content

Squarebot

Squarebot is the nexus service for ChatOps and event-driven bots for Rubin Observatory. As a Slack app, Squarebot receives events from Slack and publishes them into specific Square Events Kafka topics in the Roundtable Kubernetes cluster. Other applications on Roundtable can consume these events and act on them, such as by posting messages back to Slack or by performing some other background automation.

flowchart LR
    subgraph Slack
    message[Slack message]
    interaction[Slack interaction]
    end
    subgraph sqrbot ["Squarebot"]
    eventapi["/slack/event"]
    interactionapi["/slack/interaction"]
    message -->|HTTP POST| eventapi
    interaction -->|HTTP POST| interactionapi
    end
    subgraph kafka ["Kafka Topics"]
    topicmention["lsst.square-events.squarebot.slack.app.mention"]
    topicchannel["lsst.square-events.squarebot.slack.message.channel"]
    topicgroup["lsst.square-events.squarebot.slack.message.group"]
    topicim["lsst.square-events.squarebot.slack.message.im"]
    topicmpim["lsst.square-events.squarebot.slack.message.mpim"]
    topicinteraction["lsst.square-events.squarebot.slack.interaction"]
    end
    eventapi --> topicmention
    eventapi --> topicchannel
    eventapi --> topicgroup
    eventapi --> topicim
    eventapi --> topicmpim
    interactionapi --> topicinteraction
    subgraph backends ["Backends"]
    backend1["Backend 1"]
    backend2["Backend 2"]
    end
    topicchannel --> backend1
    topicgroup --> backend1
    topicmention --> backend2
    topicinteraction --> backend2

Slack integration is implemented at the time. We plan to add support for other event sources, such as GitHub, in the future.

Squarebot is built on top of FastAPI, a modern Python web framework, with the Rubin/SQuaRE Safir library. Squarebot uses FastStream to publish messages to Kafka with the aiokafka library.

Development set up

Squarebot uses Python 3.12 or later.

You'll need nox to run the development environment:

pip install nox

Then you can set up a virtual environment with the development dependencies:

nox -s venv-init`

(If you already have a virtual environment, you can activate it and run nox -s init instead).

The tests require a local Kafka broker. If you have Docker, you can deploy a Kafka broker with Docker Compose:

docker-compose -f kafka-compose.yaml up

To run all linters, type checking, and tests, run:

nox

While developing and running tests, you can inspect messages produced to Kafka with Kafdrop at http://localhost:9000.

You can run individual sessions with nox -s <session-name>. See nox -l for a list of available sessions.

To tear down the Kafka broker, run:

docker-compose -f kafka-compose.yaml down

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rubin_squarebot-0.10.3.tar.gz (13.8 kB view details)

Uploaded Source

Built Distribution

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

rubin_squarebot-0.10.3-py3-none-any.whl (10.9 kB view details)

Uploaded Python 3

File details

Details for the file rubin_squarebot-0.10.3.tar.gz.

File metadata

  • Download URL: rubin_squarebot-0.10.3.tar.gz
  • Upload date:
  • Size: 13.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.29 {"installer":{"name":"uv","version":"0.11.29","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for rubin_squarebot-0.10.3.tar.gz
Algorithm Hash digest
SHA256 9f82c917d67123f0a6b2448555311e17c812a5648afe8ed7fbae6bc76c032838
MD5 195a51bac676b8418ebfae7a069d48fe
BLAKE2b-256 ba2dc15d3e508ec504accf9b48c9ea8fb776dafefe2db509ecdbf6779394039e

See more details on using hashes here.

File details

Details for the file rubin_squarebot-0.10.3-py3-none-any.whl.

File metadata

  • Download URL: rubin_squarebot-0.10.3-py3-none-any.whl
  • Upload date:
  • Size: 10.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.29 {"installer":{"name":"uv","version":"0.11.29","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for rubin_squarebot-0.10.3-py3-none-any.whl
Algorithm Hash digest
SHA256 188c53b29a055a98ee8e75360db9a5c2366efb09ca65f3af2b8e6faf20f4b8f8
MD5 04050e24b7993cfe946e91715c0637a7
BLAKE2b-256 c4b3ca7a15b79a50951552f1a91bc61c4b89def6be18f1ce6c5fd189fbb32673

See more details on using hashes here.

Supported by

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