Add support for "sub apps"
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 25/100
Hướng nghiên cứu
Bắt đầu bằng cách xem xét các API composition của slack_bolt.App và slack_bolt.async_app.AsyncApp, sau đó đọc workaround được mô tả trong issue #236. So sánh hành vi add_app được yêu cầu với include_router của FastAPI và add_typer của Typer. Công việc hoàn tất khi các sub-app hoặc plugin được định nghĩa độc lập có thể được gắn vào cả hai biến thể app mà không cần truyền app cha theo cách thủ công hoặc gọi trực tiếp các decorator.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
When creating a large slack application it would be nice to be able to reuse components in a more pythonic way than what is possible right now.
A workaround is described in issue #236, but it requires passing the app object around and manually wiring up things by registering and calling decorators as functions directly.
I suggest adding a feature much like include_router in FastAPI or add_typer in Typer.
This feature will let us create sub-apps in separate files or even separate packages, like plugins that can be published on pypi.org separately.
Here is a small example illustrating what I mean:
main.py
Here is our main app, where we add a plugin from a separate package
import os
from slack_bolt import App
from my_plugin import my_plugin
# Initializes your app with your bot token and signing secret
app = App(
token=os.environ.get("SLACK_BOT_TOKEN"),
signing_secret=os.environ.get("SLACK_SIGNING_SECRET")
)
app.add_app(my_plugin)
my_plugin.py
A simple plugin that just creates a slack_bolt app, but without any config
from slack_bolt import App
my_plugin = App()
@my_plugin.message("hello")
def message_hello(message, say):
say("Hello world")
Category
- slack_bolt.App and/or its core components
- slack_bolt.async_app.AsyncApp and/or its core components
- Adapters in slack_bolt.adapter
- Others
- Ngôn ngữ chính
- Python
- Star
- 1.3k
- Fork
- 288
- Merge trung bình
- 1 ngày 8 giờ
- Pull request đã merge (30 ngày)
- 10
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của slackapi/bolt-python
-
docs enhancement server-side
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
slackapi/bolt-python#1576 · 1 bình luận ·
-
auto-triage-skip bug security semver:major
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
slackapi/bolt-python#1447 · 9 bình luận ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 65/100
slackapi/bolt-python#1577 ·
-
area:async auto-triage-skip dependencies
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 65/100
slackapi/bolt-python#1472 · 1 bình luận · 1 reaction ·
-
auto-triage-skip enhancement
slackapi/bolt-python#1346 · 2 bình luận · 1 người được giao ·
Tất cả issue của slackapi/bolt-python
Issue tương tự
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 90/100
learningequality/ricecooker#747 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
BSData/horus-heresy-3rd-edition#3171 ·
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
run-llama/llama_index#23199 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
KhronosGroup/glTF-Blender-IO#2769 ·