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

Papermill Incompatibility with VS Code Generated Notebooks #393

Open
lachjames opened this issue Feb 16, 2024 · 0 comments
Open

Papermill Incompatibility with VS Code Generated Notebooks #393

lachjames opened this issue Feb 16, 2024 · 0 comments

Comments

@lachjames
Copy link

Hi :) Not necessarily a "bug", but more of a suggestion for the API - currently, nbformat.v4.upgrade outputs None if the notebook is already in v4, which might be a reasonable thing to do (to indicate that no change is necessary), but note that papermill does the following

    # Upgrade the Notebook to the latest v4 before writing into it
    nb = nbformat.v4.upgrade(nb)

without a check for None. This means if the notebook was already in v4 papermill breaks (which I discovered due to, well, papermill breaking!

So the solutions are either to modify papermill, or (and this is where I'd ask for your advice), maybe the upgrade function should just return nb? For what it's worth, this is the current code (nbformat/v4/convert.py, line 73)

    elif from_version == 4:
        if from_minor == nbformat_minor:
            return

but when I delete the return line, Copilot prefers to fill in

    elif from_version == 4:
        if from_minor == nbformat_minor:
            return nb

which might be a somewhat objective way to show that this is the more intuitive API?

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

1 participant