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

Host cmdstanr on 'drat' for use in CRAN packages before release #168

Closed
paul-buerkner opened this issue May 15, 2020 · 20 comments
Closed

Host cmdstanr on 'drat' for use in CRAN packages before release #168

paul-buerkner opened this issue May 15, 2020 · 20 comments
Milestone

Comments

@paul-buerkner
Copy link
Contributor

I am in the process of supporting cmdstanr in brms and would love to support in already in a CRAN releasable version even if cmdstanr is not yet on CRAN. I found a possible solution using the 'drat' package, which is explained in

https://stackoverflow.com/questions/33335321/include-non-cran-package-in-cran-package

and

https://github.com/ghrr/drat

Hosting cmdstanr on drat should be easy to achieve by simpling uploading the packages' source version on https://github.com/ghrr/drat (after opening an issue there).

Would this be an option for you or do you have other suggestions how to support cmdstanr in CRAN packages before its own CRAN release?

@rok-cesnovar
Copy link
Member

rok-cesnovar commented May 15, 2020

That seems simple to achieve and I would be for it. I have limited experience with CRAN and R packages so I think @jgabry should say what he thinks. I would gladly help!

@paul-buerkner
Copy link
Contributor Author

Thank you! I have no experience with drat but it is maintained by someone well known in the R community so it should probably work out well. We would also need to store posterior there cmdstanr depends on it.

I would not include cmdstanr in any tests so that nothing can fail because cmdstanr changes. It just needs to be findable by CRAN so that it doesn't complain that a package is suggested but not available for checking.

@jgabry
Copy link
Member

jgabry commented May 18, 2020

I think this seems like a good option. Maybe we do it when we do the beta release?

@paul-buerkner
Copy link
Contributor Author

paul-buerkner commented May 18, 2020 via email

@paul-buerkner
Copy link
Contributor Author

paul-buerkner commented May 18, 2020 via email

@jgabry
Copy link
Member

jgabry commented May 18, 2020 via email

@paul-buerkner
Copy link
Contributor Author

paul-buerkner commented May 18, 2020 via email

@jgabry
Copy link
Member

jgabry commented May 18, 2020

Sure, thanks!

@dpastoor
Copy link

Hey guys, just FYI, drat is not a "place" rather it is a package that simplifies the creation/management of CRAN-like repositories. so you use drat to create your own repositories that R tooling like install.packages() understands.

As such the commitment is the completely on you to decide what/how to support.

You can see how other groups, like ropensci does it. An old blog post: https://ropensci.org/blog/2015/08/04/a-drat-repository-for-ropensci/

We have some tooling you can poke around in that helps even further:

https://github.com/metrumresearchgroup/pkgpub

For example, this function https://github.com/metrumresearchgroup/pkgpub/blob/master/R/release.R#L4

will allow you to build a CRAN-like repository given you have just tagged your repository.

At somepoint, if you want to automate it, you can get some inspiration from our CI system, where we autopublish packages on tag https://github.com/metrumresearchgroup/pkgpub/blob/master/.drone.yml#L49

Hope this gives some breadcrumbs of help

@paul-buerkner
Copy link
Contributor Author

Thank you @dpastoor! This is super helpful!

@rok-cesnovar
Copy link
Member

rok-cesnovar commented Jun 9, 2020

Lets just start with a Github-hosted repository and add posterior & cmdstanr for now. If we end up having a bunch of packages and the repo becomes unmanagable we can move to a self-hosted solution as I mentioned in the proposal.

@jgabry when you have a few minutes, can you create a new repository on stan-dev and give me permissions to it? I will take care of the rest. We can name it /rpackages-repo or whatever. I already talked to Nic and he can setup a subdomain redirect for https://packages.mc-stan.org to that location (I am guessing no one opposes that).

The first step will be to publish packages manually then make a Github Action that will enable publishing an R package when a commit on the repository is tagged.

@rok-cesnovar
Copy link
Member

Also, I can probably publish posterior 0.0.3 right? That is current master (commit stan-dev/posterior@74dd173).

@paul-buerkner
Copy link
Contributor Author

paul-buerkner commented Jun 9, 2020 via email

@jgabry
Copy link
Member

jgabry commented Jun 9, 2020

Ok cool, will create the repo now!

@jgabry
Copy link
Member

jgabry commented Jun 9, 2020

@rok-cesnovar @paul-buerkner Just created https://github.com/stan-dev/r-packages and added a placeholder readme (feel free to replace). You should both have permissions (let me know if not).

@rok-cesnovar
Copy link
Member

Ok, that was easier than I thought. Posterior is live:

install.packages("posterior", repos = c("https://mc-stan.org/r-packages"))
For now, its only a source package, need to setup Github Actions to build Win/Mac binaries.

@jgabry
Copy link
Member

jgabry commented Jun 9, 2020

@rok-cesnovar Do we also need to remove the Remotes: jgabry/posterior field from cmdstanr's description file now that we have Additional_repositories?

@rok-cesnovar
Copy link
Member

Yes, good call, removed it just now.

@karldw
Copy link

karldw commented Jun 9, 2020

I just tried this out for cmdstanr, and it works nicely! Can I recommend adding getOption("repos")? install.packages only considers the repositories specified in repos = .... For instance, I didn't have the dependency vroom installed, so my first attempt failed.

Demo:

install.packages("cmdstanr", repos = c("https://mc-stan.org/r-packages/", getOption("repos")))

@rok-cesnovar
Copy link
Member

Fantastic. Thanks @karldw!

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

No branches or pull requests

5 participants