Skip to content

Commit

Permalink
Update shiny create calls for Shiny v1.1.0 (#209)
Browse files Browse the repository at this point in the history
* fix: remove griffe version pin

* chore: Update `shiny create` commands (requires shiny v1.1.0)

* chore: Standardize and review `shiny create` uses

* chore(templates): Update `shiny create` and links

* chore(templates): `shiny create` are bash commands, not python code
  • Loading branch information
gadenbuie authored Sep 5, 2024
1 parent 30433e4 commit 28cd058
Show file tree
Hide file tree
Showing 22 changed files with 173 additions and 200 deletions.
18 changes: 9 additions & 9 deletions components/display-messages/chat/index.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -63,43 +63,43 @@ Once you've choosen a provider, copy/paste the `shiny create` terminal command t
### LangChain with OpenAI

```bash
shiny create -g https://github.com/posit-dev/py-shiny/tree/main/examples/chat/hello-providers/langchain
shiny create --template chat-ai-langchain
```

### OpenAI

```bash
shiny create -g https://github.com/posit-dev/py-shiny/tree/main/examples/chat/hello-providers/openai
shiny create --template chat-ai-openai
```

### Anthropic

```bash
shiny create -g https://github.com/posit-dev/py-shiny/tree/main/examples/chat/hello-providers/anthropic
shiny create --template chat-ai-anthropic
```

### Google

```bash
shiny create -g https://github.com/posit-dev/py-shiny/tree/main/examples/chat/hello-providers/gemini
shiny create --template chat-ai-gemini
```

### Ollama

```bash
shiny create -g https://github.com/posit-dev/py-shiny/tree/main/examples/chat/hello-providers/ollama
shiny create --template chat-ai-ollama
```

### OpenAI via Azure

```bash
shiny create -g https://github.com/posit-dev/py-shiny/tree/main/examples/chat/enterprise/azure-openai
shiny create --template chat-ai-azure-openai
```

### Anthropic via AWS Bedrock

```bash
shiny create -g https://github.com/posit-dev/py-shiny/tree/main/examples/chat/enterprise/aws-bedrock-anthropic
shiny create --template chat-ai-anthropic-aws
```

:::
Expand Down Expand Up @@ -227,7 +227,7 @@ Remember that you can get a full working template in the [Generative AI quick st
Also, for another more advanced example of dynamic system messages, check out this example:

```bash
shiny create -g https://github.com/posit-dev/py-shiny/tree/main/examples/chat/playground
shiny create --github posit-dev/py-shiny:examples/chat/playground
```

## Message trimming
Expand Down Expand Up @@ -300,7 +300,7 @@ A more compelling transform would be to allow the user to enter a URL to a websi
For a concrete example, this template allows you to enter a URL to a website that contains a recipe, and then the assistant will extract the ingredients and instructions from that recipe in a structured format:

```bash
shiny create -g https://github.com/posit-dev/py-shiny/tree/main/examples/chat/RAG/recipes
shiny create --github posit-dev/py-shiny:examples/chat/RAG/recipes
```

![](/images/chat-recipes.mp4){class="rounded shadow"}
Expand Down
6 changes: 3 additions & 3 deletions docs/custom-components-pkg.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,13 @@ Your component may look very different, but at the end of the day it just needs
::: {.callout-tip}
## What about an output binding?

This article touches on building an input component. However, it's also possible to build output components. The process and project structure is very similar to inputs. Throughout this article look for the "What about an output binding?" tips for more information on how to build an output binding. You can generate an output template with `shiny create -t js-output`.
This article touches on building an input component. However, it's also possible to build output components. The process and project structure is very similar to inputs. Throughout this article look for the "What about an output binding?" tips for more information on how to build an output binding. You can generate an output template with `shiny create --template js-output`.
:::


## The quick version

If you just want to get up and running with the code, you can start with one of the available templates available with the `shiny create -t js-react` command and then run the commands provided after the template is created. You can also see the full list of JavaScript extension templates with `shiny create -t js-component`.
If you just want to get up and running with the code, you can start with one of the available templates available with the `shiny create --template js-react` command and then run the commands provided after the template is created. You can also see the full list of JavaScript extension templates with `shiny create --template js-component`.



Expand Down Expand Up @@ -315,7 +315,7 @@ def output_color(id: str):
)
```

Make sure you add these to your `__init__.py` file so they are exposed to users of your package. Again, there is an output binding template in the `Shiny create` menu that can get you up and running quickly.
Make sure you add these to your `__init__.py` file so they are exposed to users of your package. Again, there is an output binding template in the `shiny create` menu that can get you up and running quickly.
:::

#### `__init__.py`
Expand Down
2 changes: 1 addition & 1 deletion docs/install-create-run.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ shiny create
::: callout-tip
### Copy/paste examples

If you find an example on this site that you want to run/edit locally, you can use `shiny create -t basic-app -m express` to get a basic app template, and then copy/paste the code from the example into the template.
If you find an example on this site that you want to run/edit locally, you can use `shiny create --template basic-app -m express` to get a basic app template, and then copy/paste the code from the example into the template.
:::


Expand Down
2 changes: 1 addition & 1 deletion docs/overview.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@ For a more in-depth look at reactivity, check out the [reactivity article](react
Once you've [installed](install-create-run.qmd) Shiny, the `shiny create` CLI command provides access to a collection of useful starter templates. This command walks you through a series of prompts to help you get started quickly with a helpful example. One great option is the dashboard template, which can be created with:

```bash
shiny create -t dashboard
shiny create --template dashboard
```

![The resulting dashboard generated by the dashboard template](assets/dashboard-template.png){class="img-shadow"}
Expand Down
3 changes: 2 additions & 1 deletion docs/shinylive.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,10 @@ pip install shinylive
Next, create a directory with a Shiny application. We'll use the `shiny create` command to create a basic application in a directory called `myapp/`.

```bash
shiny create myapp
shiny create --dir myapp
```

Pick a Shiny app template to create in the `myapp` directory.
Next, create the distribution with shinylive:

```bash
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ plotly
shinywidgets
ipyleaflet==0.17.4
favicons
griffe<1.0.0 # FIXME remove after posit-dev/py-shiny#1636
griffe
18 changes: 8 additions & 10 deletions templates/basic-app-plot/index.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,12 @@ sourceurl: https://github.com/posit-dev/py-shiny-templates/tree/main/basic-ap

::: {.panel-tabset .shiny-mode-tabset group="shiny-app-mode"}
## Express
``` python
shiny create -m express \
-g https://github.com/posit-dev/py-shiny-templates/tree/main/basic-app-plot
``` bash
shiny create --template basic-app-plot --mode express --github posit-dev/py-shiny-templates
```
## Core
``` python
shiny create -m core \
-g https://github.com/posit-dev/py-shiny-templates/tree/main/basic-app-plot
``` bash
shiny create --template basic-app-plot --mode core --github posit-dev/py-shiny-templates
```
:::

Expand All @@ -32,14 +30,14 @@ A basic example of changing a histogram based on a select input control.
::: {.g-col-6}
**Components:**

* [Select input](/components/inputs/select-single)
* [Plot output](/components/outputs/plot-seaborn)
* [Select input](/components/inputs/select-single/index.qmd)
* [Plot output](/components/outputs/plot-seaborn/index.qmd)
:::

::: {.g-col-6}
**Packages:**
**Packages:**

* `seaborn`
* `seaborn`
:::

::::
Expand Down
24 changes: 11 additions & 13 deletions templates/basic-navigation/index.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,12 @@ sourceurl: https://github.com/posit-dev/py-shiny-templates/tree/main/basic-na

::: {.panel-tabset .shiny-mode-tabset group="shiny-app-mode"}
## Express
``` python
shiny create -m express \
-g https://github.com/posit-dev/py-shiny-templates/tree/main/basic-navigation
``` bash
shiny create --template basic-navigation --mode express --github posit-dev/py-shiny-templates
```
## Core
``` python
shiny create -m core \
-g https://github.com/posit-dev/py-shiny-templates/tree/main/basic-navigation
``` bash
shiny create --template basic-navigation --mode core --github posit-dev/py-shiny-templates
```
:::

Expand All @@ -33,18 +31,18 @@ On both card panels is a select input to choose the plot/data to display.
::: {.g-col-6 .g-col-sm-4}
**Components:**

- [Select input](/components/inputs/select-single)
- [Plot output](/components/outputs/plot-seaborn)
- [Data grid output](/components/outputs/data-grid)
- [Select input](/components/inputs/select-single/index.qmd)
- [Plot output](/components/outputs/plot-seaborn/index.qmd)
- [Data grid output](/components/outputs/data-grid/index.qmd)
:::
::: {.g-col-6 .g-col-sm-4}
**Layouts:**
**Layouts:**

- [Navbars](https://shiny.posit.co/py/layouts/navbars)
- [Tabs](https://shiny.posit.co/py/layouts/tabs)
- [Navbars](/layouts/navbars/index.qmd)
- [Tabs](/layouts/tabs/index.qmd)
:::
::: {.g-col-6 .g-col-sm-4}
**Packages:**
**Packages:**

- `pandas`
- `seaborn`
Expand Down
18 changes: 8 additions & 10 deletions templates/basic-sidebar/index.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,12 @@ sourceurl: https://github.com/posit-dev/py-shiny-templates/tree/main/basic-si

::: {.panel-tabset .shiny-mode-tabset group="shiny-app-mode"}
## Express
``` python
shiny create -m express \
-g https://github.com/posit-dev/py-shiny-templates/tree/main/basic-sidebar
``` bash
shiny create --template basic-sidebar --mode express --github posit-dev/py-shiny-templates
```
## Core
``` python
shiny create -m core \
-g https://github.com/posit-dev/py-shiny-templates/tree/main/basic-sidebar
``` bash
shiny create --template basic-sidebar --mode core --github posit-dev/py-shiny-templates
```
:::

Expand All @@ -34,15 +32,15 @@ Place numerous input controls in a sidebar and use them to control a plot in the
::: {.g-col-6 .g-col-sm-4}
**Components:**

* [Select input](/components/inputs/select-single)
* [Switch input](/components/inputs/switch)
* [Plot output](/components/outputs/plot-seaborn)
* [Select input](/components/inputs/select-single/index.qmd)
* [Switch input](/components/inputs/switch/index.qmd)
* [Plot output](/components/outputs/plot-seaborn/index.qmd)

:::
::: {.g-col-6 .g-col-sm-4}
**Layouts:**

* [Sidebar](https://shiny.posit.co/py/layouts/sidebars)
* [Sidebar](/layouts/sidebars/index.qmd)

:::
::: {.g-col-6 .g-col-sm-4}
Expand Down
26 changes: 12 additions & 14 deletions templates/dashboard-tips/index.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,12 @@ sourceurl: https://github.com/posit-dev/py-shiny-templates/tree/main/dashboar

::: {.panel-tabset .shiny-mode-tabset group="shiny-app-mode"}
## Express
``` python
shiny create -m express \
-g https://github.com/posit-dev/py-shiny-templates/tree/main/dashboard-tips
``` bash
shiny create --template dashboard-tips --mode express --github posit-dev/py-shiny-templates
```
## Core
``` python
shiny create -m core \
-g https://github.com/posit-dev/py-shiny-templates/tree/main/dashboard-tips
``` bash
shiny create --template dashboard-tips --mode core --github posit-dev/py-shiny-templates
```
:::

Expand All @@ -34,13 +32,13 @@ Another notable difference is the use of `plotly` for interactive plots.
::: {.g-col-6 .g-col-sm-4}
**Components:**

* [Slider input](/components/inputs/slider)
* [Checkbox group input](/components/inputs/checkbox-group)
* [Action button](/components/inputs/action-button)
* [Popover](https://shiny.posit.co/py/api/core/ui.popover.html)
* [Value box](/components/outputs/value-box)
* [Plotly output](/components/outputs/plot-plotly)
* [Data grid output](/components/outputs/data-grid)
* [Slider input](/components/inputs/slider/index.qmd)
* [Checkbox group input](/components/inputs/checkbox-group/index.qmd)
* [Action button](/components/inputs/action-button/index.qmd)
* [Popover](/api/core/ui.popover.qmd)
* [Value box](/components/outputs/value-box/index.qmd)
* [Plotly output](/components/outputs/plot-plotly/index.qmd)
* [Data grid output](/components/outputs/data-grid/index.qmd)

:::
::: {.g-col-6 .g-col-sm-4}
Expand All @@ -59,4 +57,4 @@ Another notable difference is the use of `plotly` for interactive plots.
* `plotly`
* `shinywidgets`
:::
::::
::::
10 changes: 4 additions & 6 deletions templates/dashboard/index.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,12 @@ sourceurl: https://github.com/posit-dev/py-shiny-templates/tree/main/dashboar

::: {.panel-tabset .shiny-mode-tabset group="shiny-app-mode"}
## Express
``` python
shiny create -m express \
-g https://github.com/posit-dev/py-shiny-templates/tree/main/dashboard
``` bash
shiny create --template dashboard --mode express --github posit-dev/py-shiny-templates
```
## Core
``` python
shiny create -m core \
-g https://github.com/posit-dev/py-shiny-templates/tree/main/dashboard
``` bash
shiny create --template dashboard --mode core --github posit-dev/py-shiny-templates
```
:::

Expand Down
19 changes: 9 additions & 10 deletions templates/database-explorer/index.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -10,38 +10,37 @@ sourceurl: https://github.com/posit-dev/py-shiny-templates/tree/main/database

::: {.panel-tabset .shiny-mode-tabset}
## Core
``` python
shiny create -m core \
-g https://github.com/posit-dev/py-shiny-templates/tree/main/database-explorer
``` bash
shiny create --template database-explorer --mode core --github posit-dev/py-shiny-templates
```
:::


Run queries on an SQL database and view the results in a data grid.
This app demonstrates how to initialize, populate, and connect to an SQL database using the `duckdb` package.
It also shows how to run SQL queries and display results in an interactive data grid.
Note also the use of Shiny [modules](/docs/modules.html) to encapsulate and reuse the logic behind each card.
Note also the use of Shiny [modules](/docs/modules.qmd) to encapsulate and reuse the logic behind each card.

:::: {.grid .tags}

::: {.g-col-6 .g-col-sm-4}
**Components:**

* [Action button](/components/inputs/action-button)
* [Text area input](/components/inputs/text-area)
* [Data grid output](/components/outputs/data-grid)
* [Action button](/components/inputs/action-button/index.qmd)
* [Text area input](/components/inputs/text-area/index.qmd)
* [Data grid output](/components/outputs/data-grid/index.qmd)

:::
::: {.g-col-6 .g-col-sm-4}
**Layouts:**

* [Sidebar](/layouts/sidebars)
* [Grid layout](/layouts/arrange)
* [Sidebar](/layouts/sidebars/index.qmd)
* [Grid layout](/layouts/arrange/index.qmd)
:::
::: {.g-col-6 .g-col-sm-4}
**Packages:**

* `duckdb`
* `pandas`
:::
::::
::::
Loading

0 comments on commit 28cd058

Please sign in to comment.