Skip to content

Commit

Permalink
Merge branch 'main' into drop_fn_session_param
Browse files Browse the repository at this point in the history
* main: (24 commits)
  Use dynamic version of py-shiny for deploy tests (#970)
  Add underscores to hide some imports (#978)
  Add rsconnect json files(shinyapps.io tests) and folium tests (#928)
  Express' `value_box()` no longer includes named positional args (#966)
  Include `tooltip()` and `popover()` in express (#949)
  Remove extra call to run_express()
  Call `tagify()` early to intercept `AttributeErrors` (#941)
  Don't pass sidebar twice to navbar_page
  Update changelog
  Update changelog
  Switch from `requests` to `urllib` (#940)
  Bump version to 0.6.1.1
  Fix docstring for page_opts
  Fix API doc sections for Express
  Smarter, lazier, and more complete page default/api for express (#893)
  Change `express.layout` to `express.ui` (#904)
  Remove `@output` from examples (#790)
  feat: Allow for `App` `server=` to take `input` only (#920)
  Add fixes for type stub generation (#828)
  Move quarto express docs to bottom
  ...
  • Loading branch information
schloerke committed Jan 8, 2024
2 parents 6e03710 + 6ed505b commit 1ca6917
Show file tree
Hide file tree
Showing 101 changed files with 2,685 additions and 1,273 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pytest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Run example app tests
- name: Run tests for deploys
env:
DEPLOY_CONNECT_SERVER_URL: "https://rsc.radixu.com/"
DEPLOY_CONNECT_SERVER_API_KEY: "${{ secrets.DEPLOY_CONNECT_SERVER_API_KEY }}"
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -113,3 +113,4 @@ docs/source/reference/

# Developer scratch area
_dev/
tests/playwright/deploys/apps/*/requirements.txt
14 changes: 13 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,24 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [UNRELEASED]



## [0.6.1.1] - 2023-12-22

### Bug fixes

* Fixed #935: `shiny create` required the `requests` package, but it was not listed as a dependency. It now uses `urllib` instead, which is part of the Python standard library. (#940)


## [0.6.1] - 2023-12-18

### New features

* `shiny create` now allows you to select from a list of template apps.
* `shiny create` provides templates which help you build your own custom JavaScript components.
* Closed #814: The functions `reactive.Calc` and `reactive.Effect` have been changed to have lowercase names: `reactive.calc`, and `reactive.effect`. The old capitalized names are now aliases to the new lowercase names, so existing code will continue to work. Similarly, the class `reactive.Value` has a new alias, `reactive.value`, but in this case, since the original was a class, it keeps the original capitalized name as the primary name. The examples have not been changed yet, but will be changed in a future release. (#822)
* Added `ui.layout_columns()` for creating responsive column-forward layouts based on Bootstrap's 12-column CSS Grid. (#856)
* Added support for Shiny Express apps, which has a simpler, easier-to-use API than the existing API (Shiny Core). Please note that this API is still experimental and may change. (#767)

### Bug fixes

Expand All @@ -34,7 +46,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### New features
* `shiny run` now takes `reload-includes` and `reload-excludes` to allow you to define which files trigger a reload (#780).
* `shiny.run` now passes keyword arguments to `uvicorn.run` (#780).
* The `@output` decorator is no longer required for rendering functions; `@render.xxx` decorators now register themselves automatically. You can still use `@output` explicitly if you need to set specific output options (#747).
* The `@output` decorator is no longer required for rendering functions; `@render.xxx` decorators now register themselves automatically. You can still use `@output` explicitly if you need to set specific output options (#747, #790).
* Added support for integration with Quarto (#746).
* Added `shiny.render.renderer_components` decorator to help create new output renderers (#621).
* Added `shiny.experimental.ui.popover()`, `update_popover()`, and `toggle_popover()` for easy creation (and server-side updating) of [Bootstrap popovers](https://getbootstrap.com/docs/5.3/components/popovers/). Popovers are similar to tooltips, but are more persistent, and should primarily be used with button-like UI elements (e.g. `input_action_button()` or icons) (#680).
Expand Down
67 changes: 44 additions & 23 deletions docs/_quartodoc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,6 @@ quartodoc:
style: _renderer.py
show_signature_annotations: false
sections:
- title: Shiny Express
desc: Functions for Shiny Express applications
contents:
- express.layout.set_page
- express.layout.p
- express.layout.div
- express.layout.span
- express.layout.pre
- express.layout.sidebar
- express.layout.layout_columns
- express.layout.layout_column_wrap
- express.layout.column
- express.layout.row
- express.layout.card
- express.layout.accordion
- express.layout.accordion_panel
- express.layout.navset
- express.layout.navset_card
- express.layout.nav_panel
- express.layout.page_fluid
- express.layout.page_fixed
- express.layout.page_fillable
- express.layout.page_sidebar
- title: Page containers
desc: Create a user interface page container.
contents:
Expand All @@ -42,6 +19,8 @@ quartodoc:
- ui.page_fluid
- ui.page_fixed
- ui.page_bootstrap
- ui.page_auto
- ui.page_output
- title: UI Layouts
desc: Control the layout of multiple UI components.
contents:
Expand Down Expand Up @@ -303,6 +282,48 @@ quartodoc:
- types.SilentException
- types.SilentCancelOutputException
- types.SafeException
- title: Shiny Express
desc: Functions for Shiny Express applications
contents:
- kind: page
path: ContextManagerComponents
summary:
name: "Context manager components"
desc: ""
flatten: true
contents:
- express.ui.sidebar
- express.ui.layout_sidebar
- express.ui.layout_column_wrap
- express.ui.layout_columns
- express.ui.card
- express.ui.accordion
- express.ui.accordion_panel
- express.ui.nav_panel
- express.ui.nav_control
- express.ui.nav_menu
- express.ui.navset_bar
- express.ui.navset_card_pill
- express.ui.navset_card_tab
- express.ui.navset_card_underline
- express.ui.navset_hidden
- express.ui.navset_pill
- express.ui.navset_pill_list
- express.ui.navset_tab
- express.ui.navset_underline
- express.ui.value_box
- express.ui.panel_well
- express.ui.panel_conditional
- express.ui.panel_fixed
- express.ui.panel_absolute
- kind: page
path: PageFunctions
summary:
name: "Page functions"
desc: ""
flatten: true
contents:
- express.ui.page_opts
- title: Deprecated
desc: ""
contents:
Expand Down
3 changes: 0 additions & 3 deletions examples/annotation-export/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ def _():
df = df.loc[:, ["date", "temp_c", "annotation"]]
annotated_data.set(df)

@output
@render.plot
def time_series():
fig, ax = plt.subplots()
Expand All @@ -76,7 +75,6 @@ def time_series():
out.tick_params(axis="x", rotation=30)
return out.get_figure()

@output
@render.ui
def annotator():
if input.time_series_brush() is not None:
Expand Down Expand Up @@ -104,7 +102,6 @@ def annotator():
)
return out

@output
@render.data_frame
def annotations():
df = annotated_data().copy()
Expand Down
1 change: 0 additions & 1 deletion examples/duckdb/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ def query_output_ui(remove_id, qry="SELECT * from weather LIMIT 10"):
def query_output_server(
input, output, session, con: duckdb.DuckDBPyConnection, remove_id
):
@output
@render.data_frame
def results():
# In order to avoid the query re-running with each keystroke we
Expand Down
10 changes: 5 additions & 5 deletions examples/express/accordion_app.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import matplotlib.pyplot as plt
import numpy as np

from shiny import render, ui
from shiny.express import input, layout
from shiny import render
from shiny.express import input, ui

with layout.accordion(open=["Panel 1", "Panel 2"]):
with layout.accordion_panel("Panel 1"):
with ui.accordion(open=["Panel 1", "Panel 2"]):
with ui.accordion_panel("Panel 1"):
ui.input_slider("n", "N", 1, 100, 50)

with layout.accordion_panel("Panel 2"):
with ui.accordion_panel("Panel 2"):

@render.text
def txt():
Expand Down
4 changes: 2 additions & 2 deletions examples/express/basic_app.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from shiny import render, ui
from shiny.express import input
from shiny import render
from shiny.express import input, ui

ui.input_slider("n", "N", 1, 100, 50)

Expand Down
12 changes: 6 additions & 6 deletions examples/express/column_wrap_app.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
import matplotlib.pyplot as plt
import numpy as np

from shiny import render, ui
from shiny.express import input, layout
from shiny import render
from shiny.express import input, ui

with layout.layout_column_wrap(width=1 / 2):
with layout.card():
with ui.layout_column_wrap(width=1 / 2):
with ui.card():
ui.input_slider("n", "N", 1, 100, 50)

with layout.card():
with ui.card():

@render.plot
def histogram():
np.random.seed(19680801)
x = 100 + 15 * np.random.randn(437)
plt.hist(x, input.n(), density=True)

with layout.card():
with ui.card():

@render.plot
def histogram2():
Expand Down
18 changes: 9 additions & 9 deletions examples/express/nav_app.py
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
import matplotlib.pyplot as plt
import numpy as np

from shiny import render, ui
from shiny.express import input, layout
from shiny import render
from shiny.express import input, ui

with layout.layout_column_wrap(width=1 / 2):
with layout.navset():
with layout.nav_panel(title="One"):
with ui.layout_column_wrap(width=1 / 2):
with ui.navset_underline():
with ui.nav_panel(title="One"):
ui.input_slider("n", "N", 1, 100, 50)

with layout.nav_panel(title="Two"):
with ui.nav_panel(title="Two"):

@render.plot
def histogram():
np.random.seed(19680801)
x = 100 + 15 * np.random.randn(437)
plt.hist(x, input.n(), density=True)

with layout.navset_card():
with layout.nav_panel(title="One"):
with ui.navset_card_underline():
with ui.nav_panel(title="One"):
ui.input_slider("n2", "N", 1, 100, 50)

with layout.nav_panel(title="Two"):
with ui.nav_panel(title="Two"):

@render.plot
def histogram2():
Expand Down
4 changes: 2 additions & 2 deletions examples/express/plot_app.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import matplotlib.pyplot as plt
import numpy as np

from shiny import render, ui
from shiny.express import input
from shiny import render
from shiny.express import input, ui

ui.input_slider("n", "N", 1, 100, 50)

Expand Down
4 changes: 2 additions & 2 deletions examples/express/shared_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
import numpy as np
import shared

from shiny import reactive, render, ui
from shiny.express import input
from shiny import reactive, render
from shiny.express import input, ui


@render.plot
Expand Down
6 changes: 3 additions & 3 deletions examples/express/sidebar_app.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import matplotlib.pyplot as plt
import numpy as np

from shiny import render, ui
from shiny.express import input, layout
from shiny import render
from shiny.express import input, ui

with layout.sidebar():
with ui.sidebar():
ui.input_slider("n", "N", 1, 100, 50)


Expand Down
2 changes: 0 additions & 2 deletions examples/moduleapp/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ def counter_server(
def _():
count.set(count() + 1)

@output
@render.text
def out() -> str:
return f"Click count is {count()}"
Expand All @@ -44,7 +43,6 @@ def counter_wrapper_ui() -> ui.TagChild:
def counter_wrapper_server(
input: Inputs, output: Outputs, session: Session, label: str = "Increment counter"
):
@output()
@render.ui()
def dynamic_counter():
return counter_ui("counter", label)
Expand Down
3 changes: 0 additions & 3 deletions examples/typed_inputs/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,21 +42,18 @@ def r():
# thinks the return type of input.n() is Any, so we don't get type checking here.
# The function is returning the wrong value here: it returns an int instead of a
# string, but this error is not flagged.

@render.text
async def txt():
return input.n() * 2

# In contrast, input.n2() is declared to return an int, so the type check does flag
# this error -- the `render.text()` is underlined in red.

@render.text
async def txt2():
return input.n2() * 2

# This is a corrected version of the function above. It returns a string, and is not
# marked in red.

@render.text
async def txt3():
return str(input.n2() * 2)
Expand Down
3 changes: 2 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ install_requires =
starlette>=0.17.1
websockets>=10.0
python-multipart
htmltools @ git+https://github.com/posit-dev/py-htmltools.git
htmltools>=0.5.1
click>=8.1.4
markdown-it-py>=1.1.0
# This is needed for markdown-it-py. Without it, when loading shiny/ui/_markdown.py,
Expand Down Expand Up @@ -83,6 +83,7 @@ test =
missingno
rsconnect-python
scikit-learn
folium

dev =
black>=23.1.0
Expand Down
2 changes: 1 addition & 1 deletion shiny/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""A package for building reactive web applications."""

__version__ = "0.6.0.9001"
__version__ = "0.6.1.9000"

from ._shinyenv import is_pyodide as _is_pyodide

Expand Down
Loading

0 comments on commit 1ca6917

Please sign in to comment.