Skip to content

Commit 3d455d5

Browse files
author
Gordon Shotwell
authored
Rename shiny/examples to shiny/api-examples (and X/examples to X/api-examples) (#627)
1 parent ef75c0e commit 3d455d5

File tree

124 files changed

+12
-19
lines changed

Some content is hidden

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

124 files changed

+12
-19
lines changed

MANIFEST.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ recursive-include docs *.rst conf.py Makefile make.bat *.jpg *.png *.gif
88

99
recursive-include shiny/www *
1010
recursive-include shiny/experimental/www *
11-
recursive-include shiny/examples *
11+
recursive-include shiny/api-examples *
1212
recursive-include shiny/ui/dataframe/js/dist *

e2e/README.md

Lines changed: 1 addition & 1 deletion

e2e/conftest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,9 +194,9 @@ def create_example_fixture(example_name: str, scope: str = "module"):
194194

195195

196196
def create_doc_example_fixture(example_name: str, scope: str = "module"):
197-
"""Used to create app fixtures from apps in py-shiny/shiny/examples"""
197+
"""Used to create app fixtures from apps in py-shiny/shiny/api-examples"""
198198
return create_app_fixture(
199-
here / "../shiny/examples" / example_name / "app.py", scope
199+
here / "../shiny/api-examples" / example_name / "app.py", scope
200200
)
201201

202202

e2e/cpuinfo/test_app.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# pyright: reportUnknownMemberType=false
22

3-
# TODO-barret; Convert test into loop that tests all examples to make sure they load
3+
# TODO-karan; Convert test into loop that tests all examples to make sure they load
44

55
import re
66

e2e/examples/test_examples.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def get_apps(path: str) -> typing.List[str]:
2424

2525
example_apps: typing.List[str] = [
2626
*get_apps("../../examples"),
27-
*get_apps("../../shiny/examples"),
27+
*get_apps("../../shiny/api-examples"),
2828
]
2929

3030
app_idle_wait = {"duration": 300, "timeout": 5 * 1000}
@@ -36,6 +36,8 @@ def get_apps(path: str) -> typing.List[str]:
3636
"SafeException": True,
3737
"global_pyplot": True,
3838
"static_plots": ["PlotnineWarning", "RuntimeWarning"],
39+
# https://github.com/rstudio/py-shiny/issues/611#issuecomment-1632866419
40+
"penguins": ["UserWarning", "plt.tight_layout"],
3941
}
4042
app_allow_js_errors: typing.Dict[str, typing.List[str]] = {
4143
"brownian": ["Failed to acquire camera feed:"],

examples/penguins/app.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
# TODO-future: Add filter of X varaible to reduce the data? (Here we would show "Gentoo" has count 0, rather than remove if no data exists)
22
# TODO-future: Add brushing to zoom into the plot. The counts should represent the data in the zoomed area. (Single click would zoom out)
33

4-
import warnings
54
from pathlib import Path
65
from typing import List
76

8-
import matplotlib
97
import pandas as pd
108
import seaborn as sns
119
import shinyswatch
@@ -14,13 +12,6 @@
1412
import shiny.experimental as x
1513
from shiny import App, Inputs, Outputs, Session, reactive, render, req, ui
1614

17-
# There is a matplotlib bug which causes CI failures
18-
# see https://github.com/rstudio/py-shiny/issues/611#issuecomment-1632866419
19-
if matplotlib.__version__ == "3.7.2":
20-
warnings.filterwarnings(
21-
"ignore", category=UserWarning, message="The figure layout has changed to tight"
22-
)
23-
2415
sns.set_theme()
2516

2617
www_dir = Path(__file__).parent.resolve() / "www"

pyrightconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"ignore": [
3-
"shiny/examples",
3+
"shiny/api-examples",
44
"examples",
55
"build",
66
"dist",

shiny/_docstring.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import os
55
from typing import Any, Callable, Literal, TypeVar
66

7-
ex_dir: str = os.path.join(os.path.dirname(os.path.abspath(__file__)), "examples")
7+
ex_dir: str = os.path.join(os.path.dirname(os.path.abspath(__file__)), "api-examples")
88

99
FuncType = Callable[..., Any]
1010
F = TypeVar("F", bound=FuncType)
@@ -32,7 +32,7 @@ def add_example(
3232
Add an example to the docstring of a function, method, or class.
3333
3434
This decorator must, at the moment, be used on a function, method, or class whose
35-
``__name__`` matches the name of directory under ``shiny/examples/``, and must
35+
``__name__`` matches the name of directory under ``shiny/api-examples/``, and must
3636
also contain a ``app.py`` file in that directory.
3737
3838
Parameters

shiny/_main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ def create(appdir: str) -> None:
422422
app_dir.mkdir()
423423

424424
shutil.copyfile(
425-
Path(__file__).parent / "examples" / "template" / "app.py", app_path
425+
Path(__file__).parent / "api-examples" / "template" / "app.py", app_path
426426
)
427427

428428
print(f"Created Shiny app at {app_dir / 'app.py'}")
File renamed without changes.

0 commit comments

Comments
 (0)