quarto-dev / quarto-r

R interface to quarto-cli
https://quarto-dev.github.io/quarto-r/
140 stars 20 forks source link

quarto publish wrapper #101

Open jjcurtin opened 1 year ago

jjcurtin commented 1 year ago

I have successfully published a quarto presentation to rpubs.com (meet_faculty.qmd) using the following code in RStudio IDE quarto::quarto_publish_doc("./2023/meet_faculty/meet_faculty.qmd", server = "rpubs.com")

However, when I try to use the same function to publish to quartopub.com, I get a 404 error (see below). I am using this code quarto::quarto_publish_doc("./2023/meet_faculty/meet_faculty.qmd", server = "quartopub.com")
Does this function work with quartopub.com? I do have an account at quartopub.com and am using same method as for rpubs.com (e.g., I am signed into quartopub.com in my default browser - chrome). The error I get is below. Thanks for any help.

Error: HTTP 404 POST https://quartopub.com/__api__/tokens

404

jkylearmstrong commented 11 months ago

Agree, it would be helpful if the there was functionality to publish to quarto.

cderv commented 5 months ago

To clarify this topic: the quarto publish command is aimed to be used mostly interactively, at least the first time.

For example, using quarto publish quarto-pub the first time will throw this error is not done interactively.

No _publish.yml file available (_publish.yml specifying a destination required for non-interactive publish)

non-interactive mode is required if we try to call quarto publish from R.

So we could imagine some wrapper that checks when or when not it can be run in non-interactive. but this is probably a bit too much to maintain or adapt over time. We don't want the Quarto R package to duplicate what the Quarto CLI does.

If some function can be useful to be called from R, maybe quarto publish is among the one that may not require a wrapper and just to be used in the terminal ? 🤷

or we could to a basic wrapper that just call the CLI and error as it would when passing --no-prompt. Though it would probably be quite confusing to users...

@jjcurtin @jkylearmstrong isn't quarto publish command enough to call in the terminal when you need to publish ?

jjcurtin commented 5 months ago

When I wrote this, I wasnt using the commands in the terminal. I've since switched to doing all rendering, publishing, etc in the terminal interactively and that resolved my issue. Thanks!

davidkane9 commented 2 months ago

If some function can be useful to be called from R, maybe quarto publish is among the one that may not require a wrapper and just to be used in the terminal ?

It all depends on the user sophistication level that you expect/require.

I teach beginner students for whom the command line is a scary place.

The easiest way for them to publish something on the web is to use RStudio buttons. (It would be great if there were a button for Quarto Pub, along with those for Rpubs, Posit Cloud and so on. The Rpubs button works great!)

The second easiest way for them to publish something is use R commands from the Console, like quarto_publish_doc(). (It would be great for this worked for Quarto Pub just like it works for Rpubs.)

The hardest way is using the command line. It is especially confusing for them to use a bunch of R commands, like quarto_preview() and then switch to the command line for just the publish command.

cderv commented 2 months ago

It would be great if there were a button for Quarto Pub, along with those for Rpubs, Posit Cloud and so on. The Rpubs button works great!

best thing would be to open an issue on https://github.com/rstudio/rstudio about this idea

The second easiest way for them to publish something is use R commands from the Console, like quarto_publish_doc(). (It would be great for this worked for Quarto Pub just like it works for Rpubs.)

I believe it depends where they would publish. I believe rsconnect package (https://rstudio.github.io/rsconnect/) knows how to handle Posit Cloud for example (which is open to all contract to Posit Connect option which pro product)

The hardest way is using the command line. It is especially confusing for them to use a bunch of R commands, like quarto_preview() and then switch to the command line for just the publish command.

The quarto R package has not been thought as first thing to use for users. It exists mainly to allow easy scripting in R and calling quarto CLI in the process.

I understand it could be useful to learn this to call quarto in R, though CLI command are the main things to use, and IDE like RStudio or VSCODE offers some integration to ease the process.

Though this gives me a good use case, so I'll see to add a wrapper for next version

davidkane9 commented 2 months ago

Thanks for your comments!

open an issue

Turns out there is one already. For now, I will have my students use the command line, as you recommend.