-
Notifications
You must be signed in to change notification settings - Fork 276
Add Advanced Sections to documentation #104
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Advanced Sections to documentation #104
Conversation
| - **`user_id`** only when using `user_token`. | ||
| </div> | ||
|
|
||
| ```python |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the only sample I haven't run locally because I couldn't get the version with the authorize function added. I'm guessing there's some mistakes. I will test this code sample and fix it in the near future.
| margin: 1em 0 0 33%; | ||
| padding-bottom: 2em; | ||
| font-size: 1em; | ||
| line-height: 1.5em; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's some funky line-height stuff happening. I don't know why this was ever 1.5 because that's not how other docs are.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ooof it's still doing it when it builds on github pages. I'll look into styling
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shaydewael Sorry, I didn't mention this but I made the changes. I'd like to address this line-spacing issue in the tutorial docs. I'm not sure why it doesn't happen to Bolt for JS. Can you adjust this or keep this change as-is?
The issue
Current
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ooof it's still doing it when it builds on github pages. I'll look into styling
@shaydewael I have been observing the configuration of Jekyll in this project may have some issues. Sometimes I have to delete _site directory to completely refresh the pages.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great! Thanks a lot.
Codecov Report
@@ Coverage Diff @@
## main #104 +/- ##
=======================================
Coverage 90.03% 90.03%
=======================================
Files 135 135
Lines 3842 3842
=======================================
Hits 3459 3459
Misses 383 383 Continue to review full report at Codecov.
|
seratch
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shaydewael Thanks a lot for the amazing work! I really appreciate your efforts to polish the existing ones (including my English 🙏 ).
|
|
||
| However, apps running on FaaS or similar runtimes that don't allow you to run threads or processes after returning an HTTP response cannot follow this pattern. Instead, you should set the `process_before_response` flag to `true`. This allows you to call ack() and handle the event in seperate threads or processes. For events that do not require acknowledgement, you can create the listener as you normally would. | ||
|
|
||
| Rather than acting as a decorator, lazy listeners take two keyword args: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then, we can mention why you should use lazy in the case. The original one says To deal with this possible timeout issue, you can use ackandlazy functions for a listener. but something similar is fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this accurate now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, it looks almost done. I added a suggestion above.
| ```python | ||
|
|
||
| # The open_modal shortcut opens a plain old modal | ||
| # The open_modal shortcut listens to a shortcut with the callback_id "open_modal" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch 👍
Co-authored-by: Kazuhiro Sera <seratch@gmail.com>
Co-authored-by: Kazuhiro Sera <seratch@gmail.com>
Co-authored-by: Kazuhiro Sera <seratch@gmail.com>
Co-authored-by: Kazuhiro Sera <seratch@gmail.com>
Co-authored-by: Kazuhiro Sera <seratch@gmail.com>
Co-authored-by: Kazuhiro Sera <seratch@gmail.com>
Co-authored-by: Kazuhiro Sera <seratch@gmail.com>
Co-authored-by: Kazuhiro Sera <seratch@gmail.com>
Co-authored-by: Kazuhiro Sera <seratch@gmail.com>
docs/_advanced/authorization.md
Outdated
| ] | ||
|
|
||
| def authorize(enterprise_id, team_id, logger): | ||
| logger.info(f"{enterprise_id},{team_id}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can remove this line
docs/_advanced/lazy_listener.md
Outdated
|
|
||
| Typically you'd call `ack()` as the first step of your listener functions. Calling `ack()` tells Slack that you've received the event and are handling it in within reasonable amount of time (3 seconds). | ||
|
|
||
| However, apps running on FaaS or similar runtimes that don't allow you to run threads or processes after returning an HTTP response cannot follow this pattern. Instead, you should set the `process_before_response` flag to `True`. This allows you to create a listener that calls `ack()` and handles the event in seperate threads or processes, though you still need to complete everything within 3 seconds. For events that do not require acknowledgement, you can create listeners as you normally would. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about changing this way? Technically, it uses a thread internally but the more important point here is that process_before_response guarantees the completion of all the processes in a listener. Also, please polish the sentence for Events API. (NOTE: this is not Bolt Python specific - Bolt JS has the same limitation)
| However, apps running on FaaS or similar runtimes that don't allow you to run threads or processes after returning an HTTP response cannot follow this pattern. Instead, you should set the `process_before_response` flag to `True`. This allows you to create a listener that calls `ack()` and handles the event in seperate threads or processes, though you still need to complete everything within 3 seconds. For events that do not require acknowledgement, you can create listeners as you normally would. | |
| However, apps running on FaaS or similar runtimes that don't allow you to run threads or processes after returning an HTTP response cannot follow this pattern. Instead, you should set the `process_before_response` flag to `True`. This allows you to create a listener that calls `ack()` and handles the event safely, though you still need to complete everything within 3 seconds. For events, while a listener doesn't need `ack()` method call as you normally would, the listener needs to complete within 3 seconds, too. |
|
|
||
| However, apps running on FaaS or similar runtimes that don't allow you to run threads or processes after returning an HTTP response cannot follow this pattern. Instead, you should set the `process_before_response` flag to `true`. This allows you to call ack() and handle the event in seperate threads or processes. For events that do not require acknowledgement, you can create the listener as you normally would. | ||
|
|
||
| Rather than acting as a decorator, lazy listeners take two keyword args: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, it looks almost done. I added a suggestion above.
|
@shaydewael I left a few comments. Once you resolve those, we can merge these documents. Thanks for your amazing work here 👍 |
Co-authored-by: Kazuhiro Sera <seratch@gmail.com>
Co-authored-by: Kazuhiro Sera <seratch@gmail.com>
Co-authored-by: Kazuhiro Sera <seratch@gmail.com>
Co-authored-by: Kazuhiro Sera <seratch@gmail.com>
Co-authored-by: Kazuhiro Sera <seratch@gmail.com>
Co-authored-by: Kazuhiro Sera <seratch@gmail.com>
Co-authored-by: Kazuhiro Sera <seratch@gmail.com>
seratch
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks - all looks great. We can squash commits and merge now.




This adds advanced concepts to the documentation. I'm still working through some of the explanations for sections based on my understanding, but the code is in a state that's ready for review
Live preview: https://shaydewael.github.io/bolt-python/concepts
Category (place an
xin each of the[ ])slack_bolt.Appand/or its core componentsslack_bolt.async_app.AsyncAppand/or its core componentsslack_bolt.adapter/docsRequirements (place an
xin each[ ])Please read the Contributing guidelines and Code of Conduct before creating this issue or pull request. By submitting, you are agreeing to those rules.
./scripts/install_all_and_run_tests.shafter making the changes.