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: preview r code in connect to read pin #223

Merged
merged 5 commits into from
Nov 20, 2023
Merged

Conversation

isabelizimm
Copy link
Collaborator

@isabelizimm isabelizimm commented Nov 17, 2023

parity to https://github.com/rstudio/pins-r/pull/806/files
closes #222

on preview in Posit Connect, users should be able to see how to load the data in R and Python if applicable.

@isabelizimm
Copy link
Collaborator Author

@@ -1123,6 +1123,12 @@ def prepare_pin_version(self, pin_dir_path, x, name: "str | None", *args, **kwar
# TODO(compat): set display none in index.html
context["data_preview"] = json.dumps({})

# do not show r code if not round-trip friendly
if meta.type in ["joblib"]:
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

type options are "csv", "arrow", "parquet", "joblib", or "json". we will hide the R code if the pin is of joblib type

Copy link
Member

@juliasilge juliasilge left a comment

Choose a reason for hiding this comment

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

Looking good!

@isabelizimm isabelizimm merged commit f656dcc into main Nov 20, 2023
@isabelizimm isabelizimm deleted the preview-in-connect branch November 20, 2023 14:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add R code to Connect preview HTML
2 participants