Skip to content

quarto: adjust manifest construction #554

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

Merged
merged 2 commits into from
Mar 25, 2024
Merged

quarto: adjust manifest construction #554

merged 2 commits into from
Mar 25, 2024

Conversation

aronatkins
Copy link
Collaborator

@aronatkins aronatkins commented Mar 19, 2024

Intent

  • multi-file project according to files.input
  • automatic ignores according to files.input
  • glob handling allows posix OS path separators (/ and optionally \\)
  • documentation for '**'

fixes #552
fixes #553
fixes #551
fixes #320

Type of Change

  • Bug Fix
  • New Feature
  • Breaking Change

Approach

Actively iterating and deploying different types of Quarto content; filed each of the linked issues based on observations.

Automated Tests

  • Expanded Quarto single-file, simple project and multi-file project tests. Confirm that intermediate and rendered output is ignored, that simple projects are not classified as sites.
  • Expanded glob tests to test using "/" and host-specific ("/" and "\") path separators.

Directions for Reviewers

If your content is within a Git repository, Quarto may create a .gitignore file.
If it exists, .gitignore will show up in the manifest.json for projects.

Simple Quarto document

mkdir simple
cd simple
touch index.qmd
rsconnect write-manifest quarto index.qmd
# confirm that this is quarto-static content and only index.qmd is a target file

Simple Quarto document, rendered

mkdir simple-rendered
cd simple-rendered
touch index.qmd
quarto render index.qmd
rsconnect write-manifest quarto index.qmd
# confirm that this is quarto-static content and only index.qmd is a target file

Simple Quarto project

mkdir simple-project
cd simple-project
echo "project:\n  type: default" > _quarto.yml
touch index.qmd
rsconnect write-manifest quarto .
# confirm that this is quarto-static content with _quarto.yml and index.qmd target files

Simple Quarto project, rendered

mkdir simple-project-rendered
cd simple-project-rendered
echo "project:\n  type: default" > _quarto.yml
touch index.qmd
quarto render
rsconnect write-manifest quarto .
# confirm that this is quarto-static content with _quarto.yml and index.qmd target files

Simple Quarto website

mkdir simple-website
cd simple-website
echo "project:\n  type: website" > _quarto.yml
touch index.qmd
touch about.qmd
rsconnect write-manifest quarto .
# confirm that this is quarto-static content with _quarto.yml, index.qmd, about.qmd target files
# confirm that this is marked as a "site"

Simple Quarto project, rendered

mkdir simple-website-rendered
cd simple-website-rendered
echo "project:\n  type: website" > _quarto.yml
touch index.qmd
touch about.qmd
quarto render
rsconnect write-manifest quarto .
# confirm that this is quarto-static content with _quarto.yml, index.qmd, about.qmd target files
# confirm that this is marked as a "site"

Checklist

  • I have updated CHANGELOG.md to cover notable changes.
  • I have updated all related GitHub issues to reflect their current state.

Copy link

github-actions bot commented Mar 20, 2024

☂️ Python Coverage

current status: ✅

Overall Coverage

Lines Covered Coverage Threshold Status
4556 3282 72% 0% 🟢

New Files

No new covered files...

Modified Files

File Coverage Status
rsconnect/bundle.py 81% 🟢
rsconnect/models.py 84% 🟢
TOTAL 82% 🟢

updated for commit: 4cad083 by action🐍

@aronatkins aronatkins force-pushed the aron-quarto-play branch 7 times, most recently from afd0eba to 01a3ba2 Compare March 20, 2024 17:12
@aronatkins aronatkins marked this pull request as ready for review March 21, 2024 14:13
project_config = quarto_inspection.get("config", {}).get("project", {})
render_targets = project_config.get("render", [])
if len(render_targets):
self.data["metadata"]["primary_rmd"] = render_targets[0]
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we not need to set primary_rmd?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It's not used by Connect for Quarto content, today.

With R Markdown and Jupyter content, we tell the tool the specific file that we want to render, and the output file is written to the .index file.

This path only applies for projects, and we want to always rely on the Quarto discovery rules in that case. Only projects have the config.project.render structure in the output from quarto inspect.

For Quarto standalone documents, there is a stronger case for communicating the primary document/entrypoint. Connect currently transforms content into a project and then has Quarto use its default discovery rules. If the primary file is deployed along with secondary Markdown files, those would need to be named _filename.md to be ignored during rendering. Otherwise, Quarto could render both primary.qmd and do-not-render.qmd. They could also deploy a _quarto.yml file alongside the file, and deploy it as a simple "project". Both of those options feel OK, right now.

We may want to eventually annotate the manifest with metadata.entrypoint, but I'd like to see if we can avoid it.

@@ -163,6 +163,7 @@ class GlobMatcher(object):
"""

def __init__(self, pattern):
pattern = pathlib.PurePath(pattern).as_posix()
Copy link
Contributor

Choose a reason for hiding this comment

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

+1 for Pathlib!

@kgartland-rstudio
Copy link
Contributor

Validated!
✅ Tested all scenarios above
✅ Tested on Windows + MacOS
✅ Tested inside and oustide target directory
✅ Subdirectories are created with proper path
✅ Excluding with wildcards work as expected (test.txt, .txt, subdir/, subdir//.txt, subdir//)

* multi-file project according to files.input
* automatic ignores according to files.input
* documentation for '**'

fixes #552
fixes #553
fixes #551
@aronatkins aronatkins merged commit f4f61a0 into master Mar 25, 2024
@aronatkins aronatkins deleted the aron-quarto-play branch March 25, 2024 20:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants