-
Notifications
You must be signed in to change notification settings - Fork 100
Update @add_examples()
to work with Express, avoid Express docs example errors for now
#1073
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
Merged
Merged
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
45d35a6
ex(page_sidebar): remove `@output` decorator
gadenbuie b17f0f6
expressify: api-examples/page_sidebar
gadenbuie 37f1fe9
expressify: api-examples/sidebar
gadenbuie 5ff52bb
expressify: api-examples/layout_column_wrap
gadenbuie efd57b2
expressify: api-examples/layout_columns
gadenbuie 6c09496
expressify: api-examples/layout_sidebar
gadenbuie d941199
expressify: api-examples/markdown
gadenbuie 930759c
expressify: api-examples/panel_absolute
gadenbuie 81f0314
expressify: api-examples/panel_conditional
gadenbuie 4023397
Apply suggestions from code review
gadenbuie 4f602f8
Update shiny/api-examples/panel_conditional/app-express.py
gadenbuie 9c5a87c
Linting
e24d44e
expressify-input-examples (#1057)
3dd8257
Update `@add_examples()` to work with split core/express docs
gadenbuie 2b77b14
Merge branch 'docs/expressify/api-examples' into add-examples-express…
gadenbuie c2c3f43
Add `@no_example_express()` re-decorator
gadenbuie 14b0836
Use `@no_example_express()` in a few places
gadenbuie 63b8bf2
Merge branch 'split-api-docs' into add-examples-express-split
gadenbuie f9c9ddd
Rename app.py examples to app-core.py (#1076)
4abf8f7
Expressify reactive examples (#1078)
524fb6a
temp: `add_examples()` warns about missing docs
gadenbuie 20b0dff
don't error in quarto build step if in express docs build
gadenbuie 0d30827
import os
gadenbuie 7bb5f33
fix comment
gadenbuie 03d1e69
don't need gha group around `quartodoc interlinks`
gadenbuie d827837
Merge remote-tracking branch 'origin/split-api-docs' into add-example…
gadenbuie File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import asyncio | ||
|
||
from shiny import reactive | ||
from shiny.express import input, render, ui | ||
|
||
ui.input_action_button("button", "Compute") | ||
|
||
|
||
@render.text | ||
@reactive.event(input.button) | ||
async def compute(): | ||
with ui.Progress(min=1, max=15) as p: | ||
p.set(message="Calculation in progress", detail="This may take a while...") | ||
|
||
for i in range(1, 15): | ||
p.set(i, message="Computing") | ||
await asyncio.sleep(0.1) | ||
# Normally use time.sleep() instead, but it doesn't yet work in Pyodide. | ||
# https://github.com/pyodide/pyodide/issues/2354 | ||
|
||
return "Done computing!" |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
14 changes: 7 additions & 7 deletions
14
shiny/api-examples/Value/app.py → shiny/api-examples/Value/app-core.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
from shiny import reactive | ||
from shiny.express import input, render, ui | ||
|
||
val = reactive.Value(0) | ||
|
||
|
||
@reactive.effect | ||
@reactive.event(input.minus) | ||
def _(): | ||
newVal = val.get() - 1 | ||
val.set(newVal) | ||
|
||
|
||
@reactive.effect | ||
@reactive.event(input.plus) | ||
def _(): | ||
newVal = val.get() + 1 | ||
val.set(newVal) | ||
|
||
|
||
with ui.sidebar(): | ||
ui.input_action_button("minus", "-1") | ||
ui.input_action_button("plus", "+1") | ||
|
||
|
||
@render.text | ||
def value(): | ||
return str(val.get()) |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import random | ||
import time | ||
|
||
from shiny import reactive | ||
from shiny.express import input, render, ui | ||
|
||
|
||
@reactive.calc | ||
def first(): | ||
input.first() | ||
p = ui.Progress() | ||
for i in range(30): | ||
p.set(i / 30, message="Computing, please wait...") | ||
time.sleep(0.1) | ||
p.close() | ||
return random.randint(1, 1000) | ||
|
||
|
||
@reactive.calc | ||
def second(): | ||
input.second() | ||
return random.randint(1, 1000) | ||
|
||
|
||
with ui.card(): | ||
with ui.layout_columns(): | ||
ui.input_action_button("first", "Invalidate first (slow) computation") | ||
ui.input_action_button("second", "Invalidate second (fast) computation") | ||
|
||
@render.text | ||
def result(): | ||
return first() + second() |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Import here, avoid circular import
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.
Oof, this still gave me a circular import error
I'm going to leave this alone for now