ucbds-infra / otter-grader

A Python and R autograding solution
https://otter-grader.readthedocs.io
BSD 3-Clause "New" or "Revised" License
122 stars 63 forks source link

Clean up Jupyterlite support #511

Closed chrispyles closed 5 days ago

chrispyles commented 2 years ago

Support for Jupyterlite was added for #458 but this was done before things like open and filesystem access were supported in Jupyterlite. As a result, the implementation (mainly related to the Notebook class and downloading/storing tests) should be cleaned up. (See #458 for details.)

sean-morris commented 1 year ago

@chrispyles I finally got back here. I am running into the "dill" import problem you spoke about in #458. It looked like you found a way through this problem.

import micropip
await micropip.install('otter-grader==4.3.1')

Ideas?

chrispyles commented 1 year ago

@sean-morris what errors are you getting specifically? I am able to install and import otter.Notebook on Jupyterlite successfully.

sean-morris commented 1 year ago

@chrispyles I get this error: image

Trying to run this cell:

# The pip install can take a minute
import micropip
await micropip.install('otter-grader==4.3.1')

# Initialize Otter
import otter
grader = otter.Notebook("hw09.ipynb")

On the Pyodide kernel from the distribution on the jupyterlite site

Thanks

chrispyles commented 1 year ago

It looks like Otter's method for determining whether it is running on Jupyterlite has been broken by a change to the interpreter. I will add a fix but in the mean time you will need to tell otter.Notebook that it is running on Jupyterlite manually. If this is a notebook generated by Otter Assign, add runs_on: jupyterlite to the assignment config. If not, set jupyterlite=True in otter.Notebook(): otter.Notebook("hw09.ipynb", jupyterlite=True).

sean-morris commented 1 year ago

It looks like Otter's method for determining whether it is running on Jupyterlite has been broken by a change to the interpreter. I will add a fix but in the mean time you will need to tell otter.Notebook that it is running on Jupyterlite manually. If this is a notebook generated by Otter Assign, add runs_on: jupyterlite to the assignment config. If not, set jupyterlite=True in otter.Notebook(): otter.Notebook("hw09.ipynb", jupyterlite=True).

Thanks @chrispyles this is perfect