Skip to content

Commit a3afc69

Browse files
authored
Merge branch 'main' into devmode
2 parents 94bb453 + 3b742a2 commit a3afc69

File tree

147 files changed

+6417
-3310
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

147 files changed

+6417
-3310
lines changed

CHANGELOG.md

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,43 @@ All notable changes to Shiny for Python will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8-
## [UNRELEASED] - YYYY-MM-DD
8+
## [UNRELEASED]
99

1010
### Breaking Changes
1111

12-
* `@render.data_frame` return values of `DataTable` and `DataGrid` had their parameter of `row_selection: Literal["single", "multiple"]` become deprecated. Please use `mode="row_single"` or `mode="row_multiple"` instead. (#1198)
12+
### New features
13+
14+
* Added support for creating modules using Shiny Express syntax, and using modules in Shiny Express apps. (#1220)
15+
16+
* `ui.page_*()` functions gain a `theme` argument that allows you to replace the Bootstrap CSS file with a new CSS file. `theme` can be a local CSS file, a URL, or a [shinyswatch](https://posit-dev.github.io/py-shinyswatch) theme. In Shiny Express apps, `theme` can be set via `express.ui.page_opts()`. (#1334)
17+
18+
### Bug fixes
19+
20+
* Fixed an issue that prevented Shiny from serving the `font.css` file referenced in Shiny's Bootstrap CSS file. (#1342)
21+
22+
### Other changes
23+
24+
* `Session` is now an abstract base class, and `AppSession` is a concrete subclass of it. Also, `ExpressMockSession` has been renamed `ExpressStubSession` and is a concrete subclass of `Session`. (#1331)
25+
26+
* The `Session` class now has a method `is_stub_session()`. For `ExpressStubSession`, this method returns `True` for , and `AppSession` objects it returns `False`. (#1331)
27+
28+
* Closed #1293: The error console would display error messages if an app was disconnected and the user changed an input. (#1339)
29+
30+
* Fixed an issue where some CSS files were larger than necessary because they had source maps embedded in them. (#1339)
31+
32+
## [0.9.0] - 2024-04-16
33+
34+
### Breaking Changes
35+
36+
* `@render.data_frame` return values of `DataTable` and `DataGrid` had their parameter of `row_selection: Literal["single", "multiple"]` become deprecated. Please use `selection_mode="row"` or `selection_mode="rows"` instead. (#1198)
1337

1438
* The `col_widths` argument of `ui.layout_columns()` now sets the `sm` breakpoint by default, rather than the `md` breakpoint. For example, `col_widths=(12, 6, 6)` is now equivalent to `{"sm": (12, 6, 6)}` rather than `{"md": (12, 6, 6)}`. (#1222)
1539

1640
### New features
1741

1842
* `Session` objects now have a `set_message_handler(name, fn)` method that allows you to register a message handler function that will be called when a request message with the given name is received from the client (via `Shiny.shinyapp.makeRequest()` (JS)). (#1253)
1943

20-
* Experimental: `@render.data_frame` return values of `DataTable` and `DataGrid` support `mode="edit"` to enable editing of the data table cells. (#1198)
44+
* Experimental: `@render.data_frame` return values of `DataTable` and `DataGrid` support `editable=True` to enable editing of the data table cells. (#1198)
2145

2246
* `ui.card()` and `ui.value_box()` now take an `id` argument that, when provided, is used to report the full screen state of the card or value box to the server. For example, when using `ui.card(id = "my_card", full_screen = TRUE)` you can determine if the card is currently in full screen mode by reading the boolean value of `input.my_card_full_screen()`. (#1215, #1266)
2347

@@ -27,6 +51,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2751

2852
* Added an error console which displays errors in the browser's UI. This is enabled by default when running applications locally, and can be disabled with `shiny run --no-dev-mode`. It is not enabled for applications that are deployed to a server. (#1060)
2953

54+
* `shiny create` was updated to include some additional templates as well as an option to choose from the new [templates website](https://shiny.posit.co/py/templates/). (#1273, #1277, #1274)
55+
56+
* `shiny.express.ui.page_opts()` now accepts additional keyword arguments that are passed to the underlying page layout chosen by `shiny.ui.page_auto()`. (#1314)
57+
3058
### Bug fixes
3159

3260
* On Windows, Shiny Express app files are now read in as UTF-8. (#1203)

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,13 +148,13 @@ clean-js: FORCE
148148
# Default `SUB_FILE` to empty
149149
SUB_FILE:=
150150
PYTEST_BROWSERS:= --browser webkit --browser firefox --browser chromium
151+
PYTEST_DEPLOYS_BROWSERS:= --browser chromium
151152
install-playwright: FORCE
152153
playwright install --with-deps
153154

154155
install-trcli: FORCE
155156
$(if $(shell which trcli), @echo -n, $(shell pip install trcli))
156157

157-
# Installs the main version of rsconnect till pypi version supports shiny express
158158
install-rsconnect: FORCE
159159
pip install git+https://github.com/rstudio/rsconnect-python.git#egg=rsconnect-python
160160

@@ -164,7 +164,7 @@ playwright-shiny: install-playwright
164164

165165
# end-to-end tests on deployed apps with playwright; (SUB_FILE="" within tests/playwright/deploys/)
166166
playwright-deploys: install-playwright install-rsconnect
167-
pytest tests/playwright/deploys/$(SUB_FILE) $(PYTEST_BROWSERS)
167+
pytest tests/playwright/deploys/$(SUB_FILE) $(PYTEST_DEPLOYS_BROWSERS)
168168

169169
# end-to-end tests on all py-shiny examples with playwright; (SUB_FILE="" within tests/playwright/examples/)
170170
playwright-examples: install-playwright

examples/dataframe/app.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ def app_ui(req):
2020
"Selection mode",
2121
{
2222
"none": "(None)",
23-
"row": "Single",
24-
"rows": "Multiple",
23+
"row": "Single row",
24+
"rows": "Multiple rows",
2525
},
2626
selected="multiple",
2727
),
@@ -66,12 +66,6 @@ def server(input: Inputs, output: Outputs, session: Session):
6666
def update_df():
6767
return df.set(sns.load_dataset(req(input.dataset())))
6868

69-
@reactive.calc
70-
def selection_mode():
71-
if input.editable():
72-
return "edit"
73-
return input.selection_mode()
74-
7569
@render.data_frame
7670
def grid():
7771
height = 350
@@ -82,15 +76,17 @@ def grid():
8276
width=width,
8377
height=height,
8478
filters=input.filters(),
85-
selection_mode=selection_mode(),
79+
editable=input.editable(),
80+
selection_mode=input.selection_mode(),
8681
)
8782
else:
8883
return render.DataTable(
8984
df(),
9085
width=width,
9186
height=height,
9287
filters=input.filters(),
93-
selection_mode=selection_mode(),
88+
editable=input.editable(),
89+
selection_mode=input.selection_mode(),
9490
)
9591

9692
@reactive.effect

examples/model-score/app.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@ def df():
4848
params=[150],
4949
)
5050
# Convert timestamp to datetime object, which SQLite doesn't support natively
51-
tbl["timestamp"] = pd.to_datetime(tbl["timestamp"], utc=True)
51+
tbl["timestamp"] = pd.to_datetime(
52+
tbl["timestamp"], utc=True, format="%Y-%m-%d %H:%M:%S.%f"
53+
)
5254
# Create a short label for readability
5355
tbl["time"] = tbl["timestamp"].dt.strftime("%H:%M:%S")
5456
# Reverse order of rows
@@ -64,7 +66,9 @@ def read_time_period(from_time, to_time):
6466
params=[from_time, to_time],
6567
)
6668
# Treat timestamp as a continuous variable
67-
tbl["timestamp"] = pd.to_datetime(tbl["timestamp"], utc=True)
69+
tbl["timestamp"] = pd.to_datetime(
70+
tbl["timestamp"], utc=True, format="%Y-%m-%d %H:%M:%S.%f"
71+
)
6872
tbl["time"] = tbl["timestamp"].dt.strftime("%H:%M:%S")
6973

7074
return tbl

examples/moduleapp/app.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66
# ============================================================
77
@module.ui
88
def counter_ui(label: str = "Increment counter") -> ui.TagChild:
9-
return ui.div(
10-
{"style": "border: 1px solid #ccc; border-radius: 5px; margin: 5px 0;"},
9+
return ui.card(
1110
ui.h2("This is " + label),
1211
ui.input_action_button(id="button", label=label),
1312
ui.output_text_verbatim(id="out"),

js/build.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ async function bundle_helper(
3636

3737
if (options.metafile) {
3838
// Save metafile
39-
const dataframe_results = result;
39+
const data_frame_results = result;
4040
await fs.writeFile(
4141
"esbuild-metadata.json",
42-
JSON.stringify(dataframe_results.metafile)
42+
JSON.stringify(data_frame_results.metafile)
4343
);
4444
console.log("Metadata file written to esbuild-metadata.json");
4545
}
@@ -51,7 +51,7 @@ async function bundle_helper(
5151

5252
const opts: Array<BuildOptions> = [
5353
{
54-
entryPoints: { "dataframe/dataframe": "dataframe/index.tsx" },
54+
entryPoints: { "data-frame/data-frame": "data-frame/index.tsx" },
5555
plugins: [sassPlugin({ type: "css-text", sourceMap: false })],
5656
metafile: true,
5757
},
File renamed without changes.

0 commit comments

Comments
 (0)