Skip to content

fix: correctly infer output extension for jupytext command#20

Open
hamzashezad wants to merge 1 commit intoGCBallesteros:mainfrom
hamzashezad:fix-infer-output-format
Open

fix: correctly infer output extension for jupytext command#20
hamzashezad wants to merge 1 commit intoGCBallesteros:mainfrom
hamzashezad:fix-infer-output-format

Conversation

@hamzashezad
Copy link
Contributor

@hamzashezad hamzashezad commented Mar 23, 2024

fixes a bug where extracted metadata information is not used when constructing the jupytext command to convert python.
NOTE: this and #19 are both required to fix issues when opening a Google Colab exported notebook.

Context
I get the following metadata from a notebook exported directly from Google Colab. jupytext doesn't have enough information to use auto:hydrogen when converting:

  "metadata": {
    "colab": {
      "provenance": []
    },
    "kernelspec": {
      "name": "python3",
      "display_name": "Python 3"
    },
    "language_info": {
      "name": "python"
    }

@GCBallesteros
Copy link
Owner

Can you explain what information is jupytext missing above in order to make use of the auto mode?

@hamzashezad
Copy link
Contributor Author

jupytext uses the kernelspec.language_info.file_extension (or kernelspec.language, or jupytext.main_language as fallbacks) to determine the output format:
https://github.com/mwouts/jupytext/blob/main/src/jupytext/formats.py#L811 -> https://github.com/mwouts/jupytext/blob/main/src/jupytext/formats.py#L782

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

Successfully merging this pull request may close these issues.

2 participants