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

Provide submission export for R notebooks #369

Closed
chrispyles opened this issue Sep 1, 2021 · 9 comments · Fixed by #370
Closed

Provide submission export for R notebooks #369

chrispyles opened this issue Sep 1, 2021 · 9 comments · Fixed by #370
Labels
enhancement New feature or request
Milestone

Comments

@chrispyles
Copy link
Member

Provide functionality like otter.Notebook.export but for R notebooks.

@chrispyles chrispyles added the enhancement New feature or request label Sep 1, 2021
@chrispyles chrispyles added this to the v3.1.0 milestone Sep 1, 2021
@dbroockman
Copy link

dbroockman commented Sep 1, 2021

Per our conversation, just posting some more detail here so you have it.

You suggested an interim fix, which is to add an R cell like this to the bottom of the notebook:

nb_name <- "Test_Assignment.ipynb"
system(paste0("python3 -c 'import otter; otter.Notebook(\"", nb_name, "\").export()'"))
fp = tail(sort(Sys.glob("*.zip")), n=1)
IRdisplay::display_html(paste0("<a href='", fp, "' download='", fp, "'>Download your submission</a>"))

I've tested this and this does work on Gradescope. I'll be using this in my class for now.

I also tried a version where I put lines 2-4 of the above in a separate .R file to hide some of the ugliness for students. However, that approach does not work on Gradescope, and yields these errors.

Screen Shot 2021-08-31 at 10 23 01 PM

Screen Shot 2021-08-31 at 10 22 01 PM

@dbroockman
Copy link

dbroockman commented Sep 1, 2021

P.S. In the long run, would be nice to have the R notebook submit itself to Gradescope without students having to upload the .zip file manually, which is what I understand the Python notebooks do.

@chrispyles
Copy link
Member Author

Implemented ottr::export in ucbds-infra/ottr#9

@chrispyles
Copy link
Member Author

Implemented required Python functionality in #370

@chrispyles
Copy link
Member Author

@dbroockman I've just merged #370, so the new functionality for export cells with Otter Assign will be included in Otter v3.1.0.

The ottr::export function is already included in Ottr v1.1.0, so if you want to use that instead of the script you can.

devtools::install_github("ucbds-infra/ottr@1.1.0")
ottr::export("notebook.ipynb")

As a side note, the Python version does not auto-upload submissions to Gradescope; their API is limited to instructors only, so students can't submit to it. This is a feature we hope to add for all versions of Otter, but can't until that is changed.

@dbroockman
Copy link

dbroockman commented Sep 8, 2021

To use this new functionality, do I just add ottr::export("notebook.ipynb") to the bottom of a notebook and then Otter compile it?

You noted that a "reminder [to save] is also included a couple times in the new export cells w/ v3.1.0" but when I put in a cell with ottr::export("notebook.ipynb") in the bottom of my source notebook and then run Otter, I don't get any extra text at the end in the generated student notebook.

@chrispyles
Copy link
Member Author

Are you using Otter Assign to generate this notebook? Otter Assign is what includes the reminders, not calling otter::export.

@dbroockman
Copy link

Yes.

I might not be including the export cell right. All I did was include a cell in the source notebook that said ottr::export("notebook.ipynb") and then compiled the notebook using otter assign.

I attached an example notebook to this message: https://otter-grader.slack.com/archives/D02DAAAUB6F/p1631160558001400

@chrispyles
Copy link
Member Author

chrispyles commented Sep 10, 2021

@dbroockman from the notebook you sent me the reason is because you're using Otter Assign v0 format, in which the update to automatically include export cells was not included. Since v0 is an old format, it is no longer under active development.

I suggest updating your notebooks to the v1 format if you want to use this feature, or adding the cells which include the reminder manually.

Otter v3.1 includes a tool that will convert the notebooks to the new format for you; more details in the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants