GithubHelp home page GithubHelp logo

miraisolutions / techguides Goto Github PK

View Code? Open in Web Editor NEW
13.0 9.0 3.0 1.04 MB

Technical guidelines around R programming

Home Page: https://mirai-solutions.ch/techguides/

License: Other

R 100.00%
shiny roxygen r excel bookdown renv docker

techguides's Introduction

techguides

CI-CD

techguides is an open source project to collect technical guidelines and best practices. At Mirai Solutions we envision techguides as a dynamic and evolving project where we can share with the community some of the experience we gather in our daily work.

The current version of techguides, a bookdown website served via GitHub Pages, can be browsed at https://mirai-solutions.ch/techguides.

techguides's People

Contributors

chargothrond avatar dependabot[bot] avatar fvitalini avatar gmartinezmirai avatar guidomaggio avatar riccardoporreca avatar rolandasc avatar stefgehring avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

techguides's Issues

Fix missing alt text

We currently ignore missing img alt text when using HTMLProofer, due to a former issue that is probably resolved by now: see #13 (comment)

Meaningful alt texts should included and the --empty-alt-ignore removed from the Actions WF

Fix broken rocker-project links

Some rocker-project links don't exist anymore and the htmlproofer step in the CI / CD fails.

To investigate updates on rocker-project in general to see how to best resolve this.

Cleanup renv exclusion

We should not need to explicitly exclude the renv directory when deploying via rsconnect

# exclude hidden files and renv directory (if present)
appFiles = setdiff(list.files(), "renv")

This was introduced in riccardoporreca/ShinyCICD@6afa989 and implicitly also excludes .Rprofile.

This is not necessary with recent versions of rsconnect via rstudio/rsconnect#367 and rstudio/rsconnect#462

Simplification to be first tried in https://github.com/miraisolutions/ShinyCICD

Explicit book_filename and git-ignored .rds

The file _main.rds was also changed. I did not commit that yet as it seems to be automatically generated by bookdown.
It looks like we should delete this file from version control and put it into .gitignore. What is your opinion on this @riccardoporreca ?

Indeed @Chargothrond, this was committed not so long ago in 4389743, I believe accidentally. The behavior is referred to in rstudio/bookdown#430, and I agree we should git-ignore it, probably after defining an explicit book_filename in _bookdown.yml. Will create a separate Issue / PR.

Originally posted by @riccardoporreca in #20 (comment)

Customize the rendered book

The techguides don't have any Mirai specific styling yet and some other details can be improved as well:

  • Quite a few entries in the table of contents on the left hand side are shortened with "..." due to their length.

GitHub repo link

In relation to the useR!2021 submission / presentation as open source project, we may also want to link back to the repository in the generated bookdown.
This should be just a matter of configuration, creating a GH icon at the top-right alongside the "social" links (to be possibly reviewed as well).

Review shiny / CI CD / renv / private dependencies

While #14 put github actions in the foreground instead of travis CI, there is still some further restructuring to consider:

  • The shiny CI CD chapter has grown and it makes sense to try to split different topics better.
  • The part about renv could be extended, leveraging on what we did in the Covid19 app and what was discussed / described in #17
  • The information about the private / non-CRAN dependencies can also be formulated more clearly which will take care of #18 apart from the Docker component.
    • Open question: Should we consider to include information about Docker in the context of private repos for shiny apps?

Location of option() statement when using {renv}.

techguides/renv.Rmd

Lines 52 to 74 in 5f0ffe4

### Control packages version
As a note, if the `DESCRIPTION` file does not request a specific package version, the `renv` initialization will pick the version currently available in the user library when the snapshot of the packages was created. However, it is advisable to have a stricter control over the version of the packages used in a project. To do so, one can set the option to install dependencies from a specific MRAN repo, therefore fixing the version for all available packages.
```{r , echo = TRUE, eval = FALSE}
# Install all dependencies from a specific MRAN date repo
options(repos = "https://mran.microsoft.com/snapshot/2020-11-15")
```
One can then install the dependencies of a package via:
```{r , echo = TRUE, eval = FALSE}
renv::install("remotes")
(deps <- remotes::dev_package_deps(dependencies = TRUE))
renv::install(with(deps, sprintf("%s@%s", package[diff!=0], available[diff!=0])))
```
To create a snapshot of the package dependencies and update the `renv.lock` file:
```{r , echo = TRUE, eval = FALSE}
# Create a snapshot to track dependencies in the lockfile
renv::snapshot()
```

That is a great suggestion! On the other hand, where do you put the option() statement? Are you using a project-level .Rprofile file tracked on GitHub?

Switch CI-CD to rely on built-in actions/deploy-pages

Note that this new approach to deployment requires changing the Pages settings to rely on Actions workflows at https://github.com/miraisolutions/techguides/settings/pages


With this, there is no need to rely on JamesIves/github-pages-deploy-action, as originally intended:

This is a more common actions used e.g. in r-lib/actions/examples

See existing TODO in the code

# TODO: consider switching to JamesIves/github-pages-deploy-action
# uses: JamesIves/[email protected]
# with:
# branch: gh-pages
# folder: _book

Renv and rsconnect updates

There few new things to update in the technical guide.

https://rstudio.github.io/renv/news/index.html

  • renv::init() now uses Posit Public Package Manager by default
  • snapshot.type = "explicit" is not sufficient anymore, because Suggests packages must be in renv lock
  • renv::install()call required to install development packages if the project is "explicit"
  • settings.dcf is not created anymore, there is a json file
  • New renv::checkout() installing the latest-available packages from a repository. For example, renv::checkout(date = "2023-02-08") will install the packages available on 2023-02-08 from the Posit Package Manager repository. 3.2.1 of tech guides to be updated
  • Handling of development dependencies has been refined. renv::snapshot() and renv::status() no longer track development dependencies. To check if something must be written
  • mention renv::dependencies()? check if worth
  • Deployment with rsconnect, changed from rsconnect 1.0.2. rsconnect must be part of the renv project (init "implicit").
  • rsconnect::writeManifest() required for Posit Connect

Something more:

  • mran is retired (3.2.1)
renv::install("remotes")
(deps <- remotes::dev_package_deps(dependencies = TRUE))
renv::install(with(deps, sprintf("%s@%s", package[diff!=0], available[diff!=0])))

Installs all latest packages, there can be issues with new releases of renv and rsconnect

4.2.1.3 Deployment
options(rsconnect.pkrat = FALSE) or TRUE depending if deployment should happen with renv

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.