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

feat: Support templates with _template.json metadata #1631

Merged
merged 24 commits into from
Aug 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
20f21f3
feat: Support `_template.json` in template repos
gadenbuie Aug 22, 2024
8706e00
refactor: Add `express_available` property to `ShinyTemplate` class
gadenbuie Aug 22, 2024
ea11605
refactor: `copy_template_files()` now takes `ShinyTemplate` object
gadenbuie Aug 22, 2024
4479336
chore: Document internal templates, remove unused objects
gadenbuie Aug 22, 2024
fcfd07e
feat: external repos could have "package" templates also
gadenbuie Aug 22, 2024
c1d7589
tests: Update `shiny create` tests
gadenbuie Aug 22, 2024
7a4600c
refactor: Add `question_choose_template()`
gadenbuie Aug 22, 2024
8a0d862
feat: Add gnerative AI templates to `shiny create` menu
gadenbuie Aug 22, 2024
8ed50f2
feat: Support "next_steps" and "follow_up" in `_template.json`
gadenbuie Aug 23, 2024
ca39ab0
feat: Add next steps for the `basic-app` example
gadenbuie Aug 23, 2024
c774289
feat: improve documentation of ShinyTemplate
gadenbuie Aug 23, 2024
2fd80c4
chore: add next steps and follow up to remaining app-templates
gadenbuie Aug 26, 2024
8cc2c2c
feat: Add follow up actions to package templates
gadenbuie Aug 26, 2024
ca29148
chore: Apply suggestions from code review
gadenbuie Aug 27, 2024
deff209
chore: move chat templates into shiny/templates/chat
gadenbuie Aug 27, 2024
cf43149
chore: remove `-templates` suffix from `templates/{app,package}`
gadenbuie Aug 27, 2024
d3fa89c
tests: fix `templates/app` path in tests
gadenbuie Aug 27, 2024
9c2e471
chore: rename `"name"` field to `"id"`
gadenbuie Aug 27, 2024
86ac10a
docs: update ShinyInternalTemplates comments
gadenbuie Aug 27, 2024
c1564d0
fix: un-duplicate template id
gadenbuie Aug 27, 2024
88d4c9f
chore: only `basic-app` needs "in app directory" instruction
gadenbuie Aug 27, 2024
cdee598
Merged origin/main into feat/create-template-json
gadenbuie Aug 27, 2024
7ba15cc
docs: add changelog item
gadenbuie Aug 27, 2024
bda4010
Merge 'origin/main' into branch feat/create-template-json
gadenbuie Aug 27, 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 CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

* `shiny create` now supports a succinct format for specifying the GitHub repository via the `--github` flag, e.g. `--github posit-dev/py-shiny-templates`. You can now also use `--github` and `--template` together, in which case `--github` should point to a repository containing a directory matching the name provided in `--template`. (#1623)

* `shiny create` now identifies templates in external repositories using a `_template.json` metadata file. This file should contain at an `"id"` and optionally a `"title"` and `"description"`. When `shiny create` is called with the `--github` flag but without a `--template` flag, it will offer a menu listing all available templates in the repository. (#1631)

### Other changes

### Bug fixes
Expand Down
14 changes: 9 additions & 5 deletions shiny/_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -582,17 +582,21 @@ def create(
dir: Optional[Path | str] = None,
package_name: Optional[str] = None,
) -> None:
from ._main_create import use_template_github, use_template_internal

print(f"dir is {dir}")
from ._main_create import use_github_template, use_internal_template

if dir is not None:
dir = Path(dir)

if github is not None:
use_template_github(github, template=template, mode=mode, dest_dir=dir)
use_github_template(
github,
template_name=template,
mode=mode,
dest_dir=dir,
package_name=package_name,
)
else:
use_template_internal(template, mode, dir, package_name)
use_internal_template(template, mode, dir, package_name)


@main.command(
Expand Down
Loading
Loading