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

Compatibility with 'percent' notebook format #2942

Open
westurner opened this issue Sep 19, 2020 · 3 comments
Open

Compatibility with 'percent' notebook format #2942

westurner opened this issue Sep 19, 2020 · 3 comments

Comments

@westurner
Copy link

The "percent" notebook format looks similar to the pyodide notebook format [1]. It may be advantageous to adopt the percent format so that pyodide notebooks can be run in other tools? A different solution would be to add "pyodide format" (?) to jupytext.

Jyve (JupyterLab as WASM with pyiodide) does not yet support jupytext and so does not yet support the 'percent' format: pyodide/pyodide#431

From [1] https://jupytext.readthedocs.io/en/latest/formats.html#the-percent-format :


The percent format

The percent format is a representation of Jupyter notebooks as scripts, in which all cells are explicitely delimited with a commented double percent sign # %%. The percent format is currently available for these languages.

The format was introduced by Spyder in 2013, and is now supported by many editors, including

Our implementation of the percent format is as follows: cells can have

  • a title
  • a cell type (markdown, md or raw, omitted for code cells)
  • and cell metadata
    like in this example:
# %% Optional title [cell type] key="value"

In the percent format, our previous example becomes:

# %% [markdown]
# This is a multiline
# Markdown cell

# %% [markdown]
# Another Markdown cell


# %%
# This is a code cell
class A():
    def one():
        return 1

    def two():
        return 2

In the case of Python scripts, Markdown cells do accept multiline comments:

# %% [markdown]
"""
This is a Markdown cell
that uses multiline comments
"""

Whereas pyodide format looks like this:

%% py
import this

%% js
console.log("hello");

The percent format looks like this:

# %% [python]
import this

# %%
import this
@rth
Copy link
Contributor

rth commented Sep 23, 2020

Thanks for opening this issue. I'm also fond of percent script and jupytext.

Pyodide doesn't handle the notebook formats though, https://github.com/iodide-project/iodide does. Maybe @wlach could transfer it there ( "Transfer issue" button on the bottom right)..

@wlach wlach transferred this issue from pyodide/pyodide Sep 23, 2020
@wlach
Copy link
Contributor

wlach commented Sep 23, 2020

@westurner interesting had not heard of this before! note that iodide is basically in extreme maintenance mode at the moment

@westurner
Copy link
Author

westurner commented Sep 23, 2020

Wasn't sure what level of resources were currently being contributed to this excellent project.

For students, "open a URL in a browser", wait for the initial download, and use local system resources is far more practical than starting with time-consuming environment provisioning on each and every platform or finding the money to run a JupyterHub/BinderHub setup that scales to all students; especially when there are ample resources on the clients for most tasks.

Though containers can make provisioning trivial, admin access as a requirement is maybe not practical for all students.

If pyiodide (or Jyve) could write to other storage APIs (e.g. Dropbox, GDrive), that would solve for very many students' needs for a better calculator that people actually work with in workplaces.

E.g. Khan Academy has ProcessingJS CS exercises and edtech funding.

Is pyiodide hostable as static HTML on e.g. GH Pages or a CDN? Could there be pluggable storage and grading API adapters?

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

3 participants