Skip to content

Commit 63b8bf2

Browse files
authored
Merge branch 'split-api-docs' into add-examples-express-split
2 parents 14b0836 + 42414f7 commit 63b8bf2

File tree

8 files changed

+83
-6
lines changed

8 files changed

+83
-6
lines changed

.github/py-shiny/setup/action.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ runs:
2525
shell: bash
2626
run: |
2727
pip install https://github.com/rstudio/py-htmltools/tarball/main
28+
pip install https://github.com/posit-dev/py-shinylive/tarball/main
2829
make install-deps
2930
3031
- name: Install

.github/workflows/build-docs.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
run: |
3535
cd docs
3636
make ../venv
37-
. ../venv/bin/activate && pip install https://github.com/rstudio/py-htmltools/tarball/main
37+
. ../venv/bin/activate && pip install https://github.com/posit-dev/py-htmltools/tarball/main https://github.com/posit-dev/py-shinylive/tarball/main
3838
make deps
3939
4040
- name: Run quartodoc

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ 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

88

9-
## [UNRELEASED]
9+
## [0.7.0] - 2024-01-25
1010

1111
### Breaking Changes
1212

docs/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@ _sidebar.yml
55
/.quarto/
66
objects.json
77
site_libs/
8+
_objects_core.json
9+
_objects_express.json

docs/Makefile

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,23 @@ deps: $(PYBIN) ## Install build dependencies
4646
$(PYBIN)/pip install pip --upgrade
4747
$(PYBIN)/pip install -e ..[doc]
4848

49-
quartodoc: $(PYBIN) ## Build qmd files for API docs
49+
50+
# `quartodoc interlinks` creates links in `_inv`
51+
quartodoc_impl: $(PYBIN) ## Build qmd files for API docs
5052
$(eval export SHINY_ADD_EXAMPLES=true)
5153
$(eval export IN_QUARTODOC=true)
5254
. $(PYBIN)/activate \
5355
&& quartodoc interlinks \
5456
&& SHINY_MODE="core" quartodoc build --config _quartodoc-core.yml --verbose \
55-
&& SHINY_MODE="express" quartodoc build --config _quartodoc-express.yml --verbose
57+
&& mv objects.json _objects_core.json \
58+
&& SHINY_MODE="express" quartodoc build --config _quartodoc-express.yml --verbose \
59+
&& mv objects.json _objects_express.json
60+
61+
quartodoc_post: $(PYBIN) ## Post-process qmd files for API docs
62+
. $(PYBIN)/activate \
63+
&& python _combine_objects_json.py
64+
65+
quartodoc: quartodoc_impl quartodoc_post
5666

5767
site: ## Build website
5868
. $(PYBIN)/activate \

docs/_combine_objects_json.py

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
import json
2+
from dataclasses import asdict, dataclass
3+
from typing import Literal, TypedDict
4+
5+
6+
@dataclass
7+
class QuartodocObject:
8+
project: str
9+
version: str
10+
count: int
11+
items: list["QuartodocObjectItem"]
12+
13+
14+
@dataclass
15+
class QuartodocObjectItem:
16+
name: str
17+
domain: str
18+
19+
# function: "shiny.ui.page_sidebar"
20+
# class: "shiny.render.renderer._renderer.Renderer"
21+
# attribute: "shiny.render.renderer._renderer.Renderer.output_id"
22+
role: Literal["function", "class", "attribute", "module"]
23+
priority: str
24+
uri: str
25+
dispname: str
26+
27+
28+
def read_objects_file(path: str) -> QuartodocObject:
29+
with open(path) as file:
30+
content = json.load(file)
31+
items = [QuartodocObjectItem(**item) for item in content.pop("items")]
32+
return QuartodocObject(**content, items=items)
33+
34+
35+
def write_objects_file(objects: QuartodocObject, path: str) -> None:
36+
with open(path, "w") as file:
37+
json.dump(objects, file, indent=4, default=lambda dc: dc.__dict__)
38+
39+
40+
print("\nCombinging objects json files...")
41+
objects_core = read_objects_file("_objects_core.json")
42+
objects_express = read_objects_file("_objects_express.json")
43+
44+
items_map: dict[str, QuartodocObjectItem] = {}
45+
46+
for item in [*objects_core.items, *objects_express.items]:
47+
if item.name in items_map:
48+
continue
49+
items_map[item.name] = item
50+
51+
objects_ret = QuartodocObject(
52+
project="shiny",
53+
version="1",
54+
count=len(items_map.values()),
55+
items=[*items_map.values()],
56+
)
57+
58+
59+
print("Core:", objects_core.count)
60+
print("Express:", objects_express.count)
61+
print("Combined:", objects_ret.count)
62+
63+
# Save combined objects file info
64+
write_objects_file(objects_ret, "objects.json")

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ doc =
102102
jupyter
103103
jupyter_client < 8.0.0
104104
tabulate
105-
shinylive @ git+https://github.com/posit-dev/py-shinylive.git
105+
shinylive
106106
pydantic==1.10
107107
quartodoc==0.7.2
108108
griffe==0.33.0

shiny/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""A package for building reactive web applications."""
22

3-
__version__ = "0.6.1.9007"
3+
__version__ = "0.7.0"
44

55
from ._shinyenv import is_pyodide as _is_pyodide
66

0 commit comments

Comments
 (0)