Skip to main content

A fast way to build Block Kit interfaces in Python.

Project description

blockkit

Build Status PyPI version Downloads

A fast way to build Block Kit interfaces in Python

Installation

Use the package manager pip to install blockkit.

pip install blockkit

Usage

from blockkit import Message, Section, Actions, MarkdownText, Button


message = Message(
    blocks=[
        Section(MarkdownText("You have a new request")),
        Section(
            fields=[
                MarkdownText("*Type:*\nComputer (laptop)"),
                MarkdownText("*When:*\nSubmitted Aut 10"),
                MarkdownText("*Last Update:*\nMar 10, 2015 (3 years, 5 months)"),
                MarkdownText("*Reason:*\nAll vowel keys aren't working."),
                MarkdownText("*Specs:*\nCheetah Pro 15 - Fast, really fast"),
            ],
        ),
        Actions(
            [
                Button("Approve", style=Button.primary, action_id="approve"),
                Button("Decline", style=Button.danger, action_id="decline"),
                Button("Discuss", action_id="discuss"),
            ]
        ),
    ]
)

message = message.build()

Viewing Blocks in Block UI Builder

Visualize in the Slack's Block Kit Builder:

message = Message(
    blocks=[Section(text="Hello, world!")]
)

create_block_kit_builder_url(message)
"""
outputs:
Block kit builder example/validation:  
	https://app.slack.com/block-kit-builder/#%7B%22blocks%22:%20%5B%7B%22type%22:%20%22section%22%2C%20%22text%22:%20%7B%22text%22:%20%22HELLLOOOO%20WORLD%21%22%2C%20%22type%22:%20%22plain_text%22%2C%20%22emoji%22:%20true%7D%7D%5D%7D
"""

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT

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

blockkit-0.10.2.tar.gz (11.1 kB view details)

Uploaded Source

Built Distribution

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

blockkit-0.10.2-py2.py3-none-any.whl (11.4 kB view details)

Uploaded Python 2Python 3

File details

Details for the file blockkit-0.10.2.tar.gz.

File metadata

  • Download URL: blockkit-0.10.2.tar.gz
  • Upload date:
  • Size: 11.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.11

File hashes

Hashes for blockkit-0.10.2.tar.gz
Algorithm Hash digest
SHA256 8a3ade71d1aff9399b7869ce9b30571f43a746f7325b5a4de9d45c29f30aee3c
MD5 46b447dc6ad929a9f212376ff06f0655
BLAKE2b-256 a7d73f19ffc9658bca7dde5060d58ff84703337dd5db83a2d436cb882ffbe023

See more details on using hashes here.

File details

Details for the file blockkit-0.10.2-py2.py3-none-any.whl.

File metadata

  • Download URL: blockkit-0.10.2-py2.py3-none-any.whl
  • Upload date:
  • Size: 11.4 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.11

File hashes

Hashes for blockkit-0.10.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 ddbc354960fcafd20c9616c6b480e3941fd5643cf7aaaf065e20706d7244501b
MD5 e6dbbf77814d3a9fc7e007ae228e88a4
BLAKE2b-256 ecf79f2aecca9f3d35e15c4c66b2a18ba58ea6388ff8019f599459b4cd2e6ef5

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 Pingdom Monitoring Sentry Error logging StatusPage Status page