A fast way to build Block Kit interfaces in Python.
Project description
blockkit
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
Project details
Release history Release notifications | RSS feed
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.3.tar.gz
(11.3 kB
view details)
Built Distribution
File details
Details for the file blockkit-0.10.3.tar.gz
.
File metadata
- Download URL: blockkit-0.10.3.tar.gz
- Upload date:
- Size: 11.3 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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 464f757edd8dc01d491f6e66a35e0cea4150ec00e2743d3f32c309e6120ee532 |
|
MD5 | 212150702f5b4d3dc6cfa52161f888ae |
|
BLAKE2b-256 | 0e1fe03c4e9a47d2cff5627c2f2c1561016c0fb68fb7bcd92b91322a6885542d |
File details
Details for the file blockkit-0.10.3-py2.py3-none-any.whl
.
File metadata
- Download URL: blockkit-0.10.3-py2.py3-none-any.whl
- Upload date:
- Size: 11.7 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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9bfb5875799c65a2e8c45fdb9be86d2931c5692d6f88dba2548a11c4267ba598 |
|
MD5 | 4fed0058ce32de68ba819aa98a29534e |
|
BLAKE2b-256 | 0eae7bea9715361261d40a10523ad40c67ede3886abd9ecaf4386aa6d601be82 |