Is it possible to use a dependency/ library/ module?

I’m not sure how to use extra dependencies, modules or libraries in exercism.

Is it meant to be supported, or is exercism deliberately designed to only allow the base language to be used?

Specifially on the R track I would want to use the RStudio tidyverse tools. Is it possible that is already supported and I’ve just missed it? library(dplyr) for instance throws the (expected) error.

Two answers:

  1. The intention is generally to learn the core language not the full language ecosystem.
  2. In some languages using extra things outside the corelib is so normal that the maintainers have allowed for that. For example in Rust, these are allowed.

As the machines running the tests don’t have access to the internet, any extra dependencies need to be built into the test runner, which means a decision must be made ahead of runtime about which dependencies are allowed.

@ErikSchierboom will be able to tell you what the state is with the R track in particular, and if you feel there are dependencies that should be added, we’d accept a PR to add them.

1 Like

Thanks @iHiD , very clear :slight_smile:

1 Like

I’ve not actually built the R test runner, that was @jonmcalder’s work!
This is its Dockerfile:

FROM r-base:4.1.2

RUN apt-get update && \
    apt-get install -y jq && \
    apt-get purge --auto-remove -y && \
    apt-get clean && \
    rm -rf /var/lib/apt/lists/*

RUN Rscript -e 'install.packages("testthat")'

I don’t know which packages are in the base images, but other than that it looks like only the “testthat” package is installed.

1 Like

@ErikSchierboom thanks for the info.

If the ‘motivation’ to do solutions in the base language is the key to what exercism is aiming for then I think that’s a neat decision.

However, if there was interest in being slightly loose in that interpretation then I think the next most ‘core’ dependency would be tidyverse? It’s backed by the old rstudio, now posit, and is actually referred to in the existing exercism guidance on where to find help (sorry not at my machine to grab the ref).

If there was more interest in that I might be able to take a swing at the pr? (Not yet digested your os repo, so no idea where I’d start yet).

Anyone have any views on this inclusion? If the answer is ‘its against our goals’ that’s totally ok :+1:

1 Like

Thanks @DaveParr for raising this (and @iHiD & @ErikSchierboom for the clarification).

I must confess that I didn’t really give this much thought when implementing the test runner, but I agree that the tidyverse is ubiquitous and it probably makes sense to include the tidyverse packages in the test runner so that these can be utilised should one wish to do so.

I think the most elegant way to achieve this would be to build the test runner based on rocker/tidyverse to avoid having to install multiple packages & their dependencies. The rocker team is responsible for managing the (official) base R docker images too so I know they can be relied upon.

If you’d like to tackle the PR to update the test runner then please feel free to do so (but just let me know so that we don’t double up). Between @ErikSchierboom and/or myself we should be able to assist you with that. Otherwise I’m happy to address it over the weekend sometime.


Hi @jonmcalder , thanks for the input and offer. I’d quite like to have a go at this myself if thats ok? It won’t be this weekend for me but it sounds approachable, and I can look at this at the start of next week?

Great suggestion on the rocker image as well.

1 Like

@ErikSchierboom I’ve headed to the exercism repo because the readme in .github said to, however that repo now says to

For the time being we are triaging all issues from our forum. Please start a new topic there for your issue (presuming there isn’t one already). Issues opened here will be automatically closed and you will receive a message redirecting you to the forum.

from here, is there something that needs syncing up here with the use of the new forum?

@DaveParr The relevant repo is GitHub - exercism/r-test-runner

You’ll need to fork that repo, make your changes, then create a PR there.

You can safely ignore everything telling you that community contributions are closed. Tell is if your PR gets automatically closed and we’ll reopen it.


I’ve started work here: GitHub - DaveParr/r-test-runner at feature/tidyverse

Seems like this simple change has worked, existing golden tests for the repo work, as does my local solutions that already passed for Bob and Fizz-Buzz. I’m also able to pass those exercises locally now with library(dplyr) at the top of the submission.

I think next I probably need to write a test in r-test-runner/tests to check that tidyverse doesn’t get accidentally regressed against? It might be as simple as library(tidyverse) on line 1 of tests/example-success? Or I could make a standalone test? @jonmcalder , thoughts?

1 Like

Sorry for the delayed response!

Cool - I think it’s as simple as that :+1:
I wasn’t expecting a test so that would be a bonus.
Incorporating it as part of tests/example-success would be ok, but it might be best to have a separate test in order to isolate it as a separate source of failure. I think you can simply copy the tests/example-success folder and rename it example-tidyverse-success and then make the change there?

1 Like

No sweat @jonmcalder :slight_smile:

Got the test written and PR open here, though the bot stomped it as expected @iHiD

1 Like

Also, some of my prior comments have been moderated by the mod bot for spam?

1 Like

Ah ok. I reopened the PR but I can’t see your prior comments - I probably don’t have sufficient permissions.

“This new user tried to create multiple posts with links to the same domain. All posts from this user that include links should be reviewed.”

(I rejected the flags - sorry for the noise)

The R test runner was updated on Oct 3 and now supports packages from the tidyverse.

1 Like