Skip to content

Commit 88d54a5

Browse files
committed
quarto: adjust manifest construction
* multi-file project according to files.input * automatic ignores according to files.input * documentation for '**' fixes #552 fixes #553 fixes #551
1 parent 18bfc5a commit 88d54a5

File tree

3 files changed

+39
-19
lines changed

3 files changed

+39
-19
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77
## Pending Next Release
88

99
### Changed
10+
1011
- When deploying Shiny for Python applications on servers using a version of
1112
Connect prior to 2024.01.0, there is an incompatibility with
1213
`starlette>=0.35.0`. When deploying to these servers, the starlette version
1314
is now automatically set to `starlette<0.35.0`.
1415

16+
### Fixed
17+
18+
- Quarto content is marked as a "site" only when there are multiple input
19+
files. (#552)
20+
21+
- Quarto content automatically ignores `name.html` and `name_files` when
22+
`name.md`, `name.ipynb`, `name.Rmd`, or `name.qmd` is an input. (#553)
23+
1524
## [1.22.0] - 2024-01-23
1625

1726
### Added

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,15 @@ The following shows an example of an extra file taking precedence:
319319
rsconnect deploy dash --exclude “*.csv” dash-app/ important_data.csv
320320
```
321321

322+
The "`**`" glob pattern will recursively match all files and directories,
323+
while "`*`" only matches files. The "`**`" pattern is useful with complicated
324+
project hierarchies where enumerating the _included_ files is simpler than
325+
listing the _exclusions_.
326+
327+
```bash
328+
rsconnect deploy quarto . _quarto.yml index.qmd requirements.txt --exclude "**"
329+
```
330+
322331
Some directories are excluded by default, to prevent bundling and uploading files that are not needed or might interfere with the deployment process:
323332

324333
```

rsconnect/bundle.py

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -94,12 +94,10 @@ def __init__(
9494
"version": quarto_inspection.get("quarto", {}).get("version", "99.9.9"),
9595
"engines": quarto_inspection.get("engines", []),
9696
}
97-
project_config = quarto_inspection.get("config", {}).get("project", {})
98-
render_targets = project_config.get("render", [])
99-
if len(render_targets):
100-
self.data["metadata"]["primary_rmd"] = render_targets[0]
101-
project_type = project_config.get("type", None)
102-
if project_type or len(render_targets) > 1:
97+
98+
files_data = quarto_inspection.get("files", {})
99+
files_input_data = files_data.get("input", [])
100+
if len(files_input_data) > 1:
103101
self.data["metadata"]["content_category"] = "site"
104102

105103
if environment:
@@ -325,12 +323,10 @@ def make_source_manifest(
325323
"version": quarto_inspection.get("quarto", {}).get("version", "99.9.9"),
326324
"engines": quarto_inspection.get("engines", []),
327325
}
328-
project_config = quarto_inspection.get("config", {}).get("project", {})
329-
render_targets = project_config.get("render", [])
330-
if len(render_targets):
331-
manifest["metadata"]["primary_rmd"] = render_targets[0]
332-
project_type = project_config.get("type", None)
333-
if project_type or len(render_targets) > 1:
326+
327+
files_data = quarto_inspection.get("files", {})
328+
files_input_data = files_data.get("input", [])
329+
if len(files_input_data) > 1:
334330
manifest["metadata"]["content_category"] = "site"
335331

336332
if environment:
@@ -1303,13 +1299,19 @@ def make_quarto_manifest(
13031299
output_dir = project_config.get("output-dir", None)
13041300
if output_dir:
13051301
excludes = excludes + [output_dir]
1306-
else:
1307-
render_targets = project_config.get("render", [])
1308-
for target in render_targets:
1309-
t, _ = splitext(target)
1310-
# TODO: Single-file inspect would give inspect.formats.html.pandoc.output-file
1311-
# For foo.qmd, we would get an output-file=foo.html, but foo_files is not available.
1312-
excludes = excludes + [t + ".html", t + "_files"]
1302+
1303+
files_data = quarto_inspection.get("files", {})
1304+
files_input_data = files_data.get("input", [])
1305+
# files.input is a list of absolute paths to input (rendered)
1306+
# files. Automatically ignore the most common derived files for
1307+
# those inputs.
1308+
#
1309+
# These files are ignored even when the project has an output
1310+
# directory, as Quarto may create these files while a render is
1311+
# in-flight.
1312+
for each in files_input_data:
1313+
t, _ = splitext(os.path.relpath(each, file_or_directory))
1314+
excludes = excludes + [t + ".html", t + "_files/**"]
13131315

13141316
# relevant files don't need to include requirements.txt file because it is
13151317
# always added to the manifest (as a buffer) from the environment contents

0 commit comments

Comments
 (0)