Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ recursive-include docs *.rst conf.py Makefile make.bat *.jpg *.png *.gif

recursive-include shiny/www *
recursive-include shiny/experimental/www *
recursive-include shiny/examples *
recursive-include shiny/api-examples *
recursive-include shiny/ui/dataframe/js/dist *
2 changes: 1 addition & 1 deletion e2e/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ tests against their apps.)
The actual tests are in subdirectories. Each subdirectory contains one or more Pytest
files (`test_*.py`) containing [Playwright](https://playwright.dev/python/) assertions,
and optionally, a single app (`app.py`) that the assertions test against. (The app is
optional, because the tests may also be for apps in the `../examples` or `../shiny/examples` directory.)
optional, because the tests may also be for apps in the `../examples` or `../shiny/api-examples` directory.)

## Running tests

Expand Down
4 changes: 2 additions & 2 deletions e2e/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,9 @@ def create_example_fixture(example_name: str, scope: str = "module"):


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


Expand Down
2 changes: 1 addition & 1 deletion e2e/cpuinfo/test_app.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# pyright: reportUnknownMemberType=false

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

import re

Expand Down
4 changes: 3 additions & 1 deletion e2e/examples/test_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def get_apps(path: str) -> typing.List[str]:

example_apps: typing.List[str] = [
*get_apps("../../examples"),
*get_apps("../../shiny/examples"),
*get_apps("../../shiny/api-examples"),
]

app_idle_wait = {"duration": 300, "timeout": 5 * 1000}
Expand All @@ -36,6 +36,8 @@ def get_apps(path: str) -> typing.List[str]:
"SafeException": True,
"global_pyplot": True,
"static_plots": ["PlotnineWarning", "RuntimeWarning"],
# https://github.com/rstudio/py-shiny/issues/611#issuecomment-1632866419
"penguins": ["UserWarning", "plt.tight_layout"],
}
app_allow_js_errors: typing.Dict[str, typing.List[str]] = {
"brownian": ["Failed to acquire camera feed:"],
Expand Down
9 changes: 0 additions & 9 deletions examples/penguins/app.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
# 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)
# TODO-future: Add brushing to zoom into the plot. The counts should represent the data in the zoomed area. (Single click would zoom out)

import warnings
from pathlib import Path
from typing import List

import matplotlib
import pandas as pd
import seaborn as sns
import shinyswatch
Expand All @@ -14,13 +12,6 @@
import shiny.experimental as x
from shiny import App, Inputs, Outputs, Session, reactive, render, req, ui

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

sns.set_theme()

www_dir = Path(__file__).parent.resolve() / "www"
Expand Down
2 changes: 1 addition & 1 deletion pyrightconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"ignore": [
"shiny/examples",
"shiny/api-examples",
"examples",
"build",
"dist",
Expand Down
4 changes: 2 additions & 2 deletions shiny/_docstring.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import os
from typing import Any, Callable, Literal, TypeVar

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

FuncType = Callable[..., Any]
F = TypeVar("F", bound=FuncType)
Expand Down Expand Up @@ -32,7 +32,7 @@ def add_example(
Add an example to the docstring of a function, method, or class.

This decorator must, at the moment, be used on a function, method, or class whose
``__name__`` matches the name of directory under ``shiny/examples/``, and must
``__name__`` matches the name of directory under ``shiny/api-examples/``, and must
also contain a ``app.py`` file in that directory.

Parameters
Expand Down
2 changes: 1 addition & 1 deletion shiny/_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ def create(appdir: str) -> None:
app_dir.mkdir()

shutil.copyfile(
Path(__file__).parent / "examples" / "template" / "app.py", app_path
Path(__file__).parent / "api-examples" / "template" / "app.py", app_path
)

print(f"Created Shiny app at {app_dir / 'app.py'}")
Expand Down
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.
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.
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.