Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create two different api doc folders, one for Core and one for Express #1053

Merged
merged 52 commits into from
Jan 26, 2024
Merged
Show file tree
Hide file tree
Changes from 43 commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
189807e
Create two different api doc folders, one for Core and one for Express
jcheng5 Jan 23, 2024
45d35a6
ex(page_sidebar): remove `@output` decorator
gadenbuie Jan 16, 2024
b17f0f6
expressify: api-examples/page_sidebar
gadenbuie Jan 16, 2024
37f1fe9
expressify: api-examples/sidebar
gadenbuie Jan 16, 2024
5ff52bb
expressify: api-examples/layout_column_wrap
gadenbuie Jan 16, 2024
efd57b2
expressify: api-examples/layout_columns
gadenbuie Jan 16, 2024
6c09496
expressify: api-examples/layout_sidebar
gadenbuie Jan 16, 2024
d941199
expressify: api-examples/markdown
gadenbuie Jan 16, 2024
930759c
expressify: api-examples/panel_absolute
gadenbuie Jan 16, 2024
81f0314
expressify: api-examples/panel_conditional
gadenbuie Jan 16, 2024
4023397
Apply suggestions from code review
gadenbuie Jan 24, 2024
4f602f8
Update shiny/api-examples/panel_conditional/app-express.py
gadenbuie Jan 24, 2024
9c5a87c
Linting
Jan 25, 2024
e24d44e
expressify-input-examples (#1057)
Jan 25, 2024
147aaa3
Introduce a express/core specific quartodoc renderer
cpsievert Jan 25, 2024
fbe7726
First pass at grooming Express function reference
cpsievert Jan 25, 2024
a16fbd8
Merge branch 'main' into split-api-docs
cpsievert Jan 25, 2024
3dd8257
Update `@add_examples()` to work with split core/express docs
gadenbuie Jan 25, 2024
5dd552d
Merge branch 'main' into split-api-docs
cpsievert Jan 25, 2024
2b77b14
Merge branch 'docs/expressify/api-examples' into add-examples-express…
gadenbuie Jan 25, 2024
c7b2c85
Update doc's `make quartodoc` to make a combined objects.json file
schloerke Jan 25, 2024
42414f7
Merge branch 'split-api-docs' of https://github.com/posit-dev/py-shin…
schloerke Jan 25, 2024
c2c3f43
Add `@no_example_express()` re-decorator
gadenbuie Jan 25, 2024
14b0836
Use `@no_example_express()` in a few places
gadenbuie Jan 25, 2024
63b8bf2
Merge branch 'split-api-docs' into add-examples-express-split
gadenbuie Jan 25, 2024
f9c9ddd
Rename app.py examples to app-core.py (#1076)
Jan 26, 2024
4abf8f7
Expressify reactive examples (#1078)
Jan 26, 2024
524fb6a
temp: `add_examples()` warns about missing docs
gadenbuie Jan 26, 2024
20b0dff
don't error in quarto build step if in express docs build
gadenbuie Jan 26, 2024
0d30827
import os
gadenbuie Jan 26, 2024
79543e8
Use shortened description; Only add `...` if title is too long
schloerke Jan 26, 2024
8978926
Add old `output_transformer` to docs
schloerke Jan 26, 2024
dbf501a
docs: suspend_display -> ui.hold
schloerke Jan 26, 2024
971b57e
Add docs for `as_fillable_container()`
schloerke Jan 26, 2024
7bb5f33
fix comment
gadenbuie Jan 26, 2024
36094cc
Use first paragraph for summary description
schloerke Jan 26, 2024
03d1e69
don't need gha group around `quartodoc interlinks`
gadenbuie Jan 26, 2024
d827837
Merge remote-tracking branch 'origin/split-api-docs' into add-example…
gadenbuie Jan 26, 2024
b6c4435
Merge remote-tracking branch 'origin/main' into split-api-docs
gadenbuie Jan 26, 2024
457020d
docs: consolidate renderer back into one file
gadenbuie Jan 26, 2024
dfc9a13
split quartodoc target into a series of smaller targets
gadenbuie Jan 26, 2024
dacd74e
Add create_doc_example_{core,express}_fixture()
gadenbuie Jan 26, 2024
cae09c4
tests: Test all example apps that are `app.py` or start with `app-*.py`
gadenbuie Jan 26, 2024
b1a6044
fix poll example
gadenbuie Jan 26, 2024
5123342
temp: ignore sidebar max_height_mobile warning
gadenbuie Jan 26, 2024
37bf76e
Apply suggestions from code review
gadenbuie Jan 26, 2024
2bba14a
improve makefile target list a little more
gadenbuie Jan 26, 2024
c50fb2c
One `@no_example()` decorator
gadenbuie Jan 26, 2024
9e53f64
update docstring
gadenbuie Jan 26, 2024
8fd7e50
no_example: rename param `mode`
gadenbuie Jan 26, 2024
a119844
remove custom example (we'll come back to this)
gadenbuie Jan 26, 2024
7f001bd
Update docs/_renderer.py
gadenbuie Jan 26, 2024
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: 2 additions & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ _sidebar.yml
/.quarto/
objects.json
site_libs/
_objects_core.json
_objects_express.json
Comment on lines +8 to +9
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@schloerke is it useful to keep these around? Or should we remove them as a part of python _combine_objects_json.py?

29 changes: 26 additions & 3 deletions docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,35 @@ deps: $(PYBIN) ## Install build dependencies
$(PYBIN)/pip install pip --upgrade
$(PYBIN)/pip install -e ..[doc]

quartodoc: $(PYBIN) ## Build qmd files for API docs
quartodoc_post: $(PYBIN) ## Post-process qmd files for API docs
. $(PYBIN)/activate \
&& python _combine_objects_json.py

quartodoc: quartodoc_build_core quartodoc_build_express quartodoc_post

quartodoc_interlinks: $(PYBIN) ## Create interlinks for API docs
. $(PYBIN)/activate \
&& quartodoc interlinks

quartodoc_build_core: $(PYBIN) quartodoc_interlinks ## Build core API docs
$(eval export SHINY_ADD_EXAMPLES=true)
$(eval export IN_QUARTODOC=true)
$(eval export SHINY_MODE=core)
. $(PYBIN)/activate \
&& echo "::group::quartodoc build core docs" \
&& quartodoc build --config _quartodoc-core.yml --verbose \
&& mv objects.json _objects_core.json \
&& echo "::endgroup::"

quartodoc_build_express: $(PYBIN) quartodoc_interlinks ## Build express API docs
$(eval export SHINY_ADD_EXAMPLES=true)
$(eval export IN_QUARTODOC=true)
$(eval export SHINY_MODE=express)
. $(PYBIN)/activate \
&& quartodoc interlinks \
&& quartodoc build --config _quartodoc.yml --verbose
&& echo "::group::quartodoc build express docs" \
&& quartodoc build --config _quartodoc-express.yml --verbose \
&& mv objects.json _objects_express.json \
&& echo "::endgroup::"

site: ## Build website
. $(PYBIN)/activate \
Expand Down
64 changes: 64 additions & 0 deletions docs/_combine_objects_json.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import json
from dataclasses import asdict, dataclass
from typing import Literal, TypedDict


@dataclass
class QuartodocObject:
project: str
version: str
count: int
items: list["QuartodocObjectItem"]


@dataclass
class QuartodocObjectItem:
name: str
domain: str

# function: "shiny.ui.page_sidebar"
# class: "shiny.render.renderer._renderer.Renderer"
# attribute: "shiny.render.renderer._renderer.Renderer.output_id"
role: Literal["function", "class", "attribute", "module"]
priority: str
uri: str
dispname: str


def read_objects_file(path: str) -> QuartodocObject:
with open(path) as file:
content = json.load(file)
items = [QuartodocObjectItem(**item) for item in content.pop("items")]
return QuartodocObject(**content, items=items)


def write_objects_file(objects: QuartodocObject, path: str) -> None:
with open(path, "w") as file:
json.dump(objects, file, indent=4, default=lambda dc: dc.__dict__)


print("\nCombinging objects json files...")
gadenbuie marked this conversation as resolved.
Show resolved Hide resolved
objects_core = read_objects_file("_objects_core.json")
objects_express = read_objects_file("_objects_express.json")

items_map: dict[str, QuartodocObjectItem] = {}

for item in [*objects_core.items, *objects_express.items]:
if item.name in items_map:
continue
items_map[item.name] = item

objects_ret = QuartodocObject(
project="shiny",
version="1",
count=len(items_map.values()),
items=[*items_map.values()],
)


print("Core:", objects_core.count)
print("Express:", objects_express.count)
print("Combined:", objects_ret.count)

# Save combined objects file info
write_objects_file(objects_ret, "objects.json")
6 changes: 4 additions & 2 deletions docs/_quarto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ website:
pinned: true
search: true
left:
- text: "API"
file: api/index.qmd
- text: "Express API"
file: api/express/index.qmd
- text: "Core API"
file: api/core/index.qmd
right:
- icon: github
href: https://github.com/posit-dev/py-shiny
Expand Down
5 changes: 3 additions & 2 deletions docs/_quartodoc.yml → docs/_quartodoc-core.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
quartodoc:
style: pkgdown
dir: api
dir: api/core
out_index: index.qmd
package: shiny
rewrite_all_pages: false
sidebar: api/_sidebar.yml
sidebar: api/core/_sidebar.yml
dynamic: true
renderer:
style: _renderer.py
Expand Down Expand Up @@ -374,6 +374,7 @@ quartodoc:
- ui.panel_main
- ui.panel_sidebar
- ui.nav
- render.transformer.output_transformer
- render.transformer.resolve_value_fn
- title: Experimental
desc: "These methods are under consideration and are considered unstable. However, if there is a method you are excited about, please let us know!"
Expand Down
177 changes: 177 additions & 0 deletions docs/_quartodoc-express.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,177 @@
quartodoc:
style: pkgdown
dir: api/express
out_index: index.qmd
package: shiny
rewrite_all_pages: false
sidebar: api/express/_sidebar.yml
dynamic: true
renderer:
style: _renderer.py
show_signature_annotations: false
sections:
- title: Input components
desc: Gather user input.
contents:
- express.ui.input_select
- express.ui.input_selectize
- express.ui.input_slider
- express.ui.input_date
- express.ui.input_date_range
- express.ui.input_checkbox
- express.ui.input_checkbox_group
- express.ui.input_switch
- express.ui.input_radio_buttons
- express.ui.input_numeric
- express.ui.input_text
- express.ui.input_text_area
- express.ui.input_password
- express.ui.input_action_button
- express.ui.input_action_link
- title: Output components
desc: Reactively render output.
contents:
- express.render.plot
- express.render.table
- express.render.DataTable
- express.render.data_frame
- express.render.DataGrid
- express.render.text
- express.render.ui
- express.render.download
- express.render.image
- express.render.express
- title: Layouts and other UI tools
desc: Tools for creating, arranging, and styling UI components.
contents:
- express.ui.page_opts
- express.ui.sidebar
- express.ui.layout_columns
- express.ui.layout_column_wrap
- express.ui.card
- express.ui.card_header
- express.ui.card_footer
- express.ui.value_box
- express.ui.value_box_theme
- express.ui.popover
- express.ui.tooltip
- express.ui.accordion
- express.ui.accordion_panel
- express.ui.layout_sidebar
- title: Navigate multiple panels
desc: Create a set of panels that can be navigated between.
contents:
- express.ui.nav_panel
- express.ui.navset_card_underline
- express.ui.navset_card_tab
- express.ui.navset_card_pill
- express.ui.nav_spacer
- express.ui.nav_menu
- express.ui.nav_control
- express.ui.navset_bar
- express.ui.navset_tab
- express.ui.navset_pill
- express.ui.navset_underline
- express.ui.navset_pill_list
- express.ui.navset_hidden
- title: Reactive programming
desc: Create reactive functions and dependencies.
contents:
- reactive.calc
- reactive.effect
- reactive.value
- reactive.event
- reactive.isolate
- reactive.invalidate_later
- reactive.flush
- reactive.poll
- reactive.file_reader
- reactive.lock
- req
- title: Reusable Express code
desc: Create reusable Express code.
contents:
- express.ui.hold
- express.expressify
- title: Update inputs
desc: Programmatically update input values.
contents:
- name: express.ui.update_select
dynamic: true
- name: express.ui.update_selectize
dynamic: true
- name: express.ui.update_slider
dynamic: true
- ui.update_date
- name: express.ui.update_date_range
dynamic: true
- name: express.ui.update_checkbox
dynamic: true
- name: express.ui.update_checkbox_group
dynamic: true
- name: express.ui.update_switch
dynamic: true
- name: express.ui.update_radio_buttons
dynamic: true
- name: express.ui.update_numeric
dynamic: true
- ui.update_text
- name: express.ui.update_text_area
dynamic: "shiny.ui.update_text"
- name: express.ui.update_navs
dynamic: true
- title: Update UI Layouts
desc: ""
contents:
- express.ui.update_sidebar
- express.ui.update_tooltip
- express.ui.update_popover
- express.ui.update_accordion
- express.ui.update_accordion_panel
- express.ui.insert_accordion_panel
- express.ui.remove_accordion_panel
- title: Display messages
desc: Display messages to the user.
contents:
- express.ui.help_text
- express.ui.notification_show
- express.ui.notification_remove
- express.ui.modal
- express.ui.modal_show
- express.ui.modal_remove
- express.ui.modal_button
- express.ui.Progress # uses class.rst
- title: UI panels
desc: Visually group together a section of UI components.
contents:
- express.ui.panel_absolute
- express.ui.panel_fixed
- express.ui.panel_title
- express.ui.panel_well
- title: Dynamic UI
desc: Dynamically show/hide UI elements.
contents:
- express.ui.panel_conditional
- express.ui.insert_ui
- express.ui.remove_ui
- title: UI as HTML
desc: Tools for creating HTML/CSS/JS
contents:
- express.ui.markdown
- express.ui.include_css
- express.ui.include_js
- express.ui.HTML # uses justattributes.rst template
- name: express.ui.tags # uses tags.rst template
children: embedded
- express.ui.TagList # uses class.rst template
# TODO: should these be included?
# - express.ui.fill.as_fillable_container
# - express.ui.fill.as_fill_item
# - express.ui.fill.remove_all_fill
# - express.ui.css.as_css_unit
# - express.ui.css.as_css_padding
- title: Express developer tooling
desc:
contents:
- express.is_express_app
- express.wrap_express_app
Loading
Loading