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

Default icons for makrdown and python scripts not retained #746

Closed
LijoDXL opened this issue Feb 17, 2021 · 4 comments
Closed

Default icons for makrdown and python scripts not retained #746

LijoDXL opened this issue Feb 17, 2021 · 4 comments
Milestone

Comments

@LijoDXL
Copy link

LijoDXL commented Feb 17, 2021

Though I added notebook_extensions = "ipynb,Rmd" to jupytext.toml in my home directory, it still shows .md and .py files with notebook icon. I am running JupyterLab 3.0.3 and the Jupytext version is 1.10.2.

@LijoDXL LijoDXL changed the title File icons for makrdown and python scripts are not retained. Default icons for makrdown and python scripts not retained Feb 17, 2021
@mwouts
Copy link
Owner

mwouts commented Feb 17, 2021

Hi @LijoDXL , thank you for reporting this

I confirm that some configuration entries only work at the moment when set directly on the context manager, and I agree that it would me more natural to set them in the jupytext.toml. I'll see how to fix that later on.

If you want a quicker fix, you can have a look at #744. However the workaround there was for Jupyter Notebook, if you get an error telling you that the contents manager should be derived from another class, you will have to build your Jupytext contents manager by calling build_jupytext_contents_manager_class on the desired base class in your jupyter lab configuration file. This will give something similar to

from notebook.services.contents.largefilemanager import LargeFileManager
TextFileContentsManager = build_jupytext_contents_manager_class(LargeFileManager)

@LijoDXL
Copy link
Author

LijoDXL commented Feb 18, 2021

Thanks, @mwouts for confirming the issue. It is a minor aesthetic issue that I don't mind waiting for a fix. Though I don't have the technical expertise to tinker with the contents manager class, I will try implementing the suggested quick fix.

@LijoDXL
Copy link
Author

LijoDXL commented Feb 18, 2021

Strangely, setting the JupyterLab config file as below results in the behavior I require:

#c.NotebookApp.contents_manager_class = "jupytext.TextFileContentsManager"
c.ContentsManager.notebook_extensions = "ipynb"

It warns about notebook_extensions not recognized by _LargeFileManager, but keeps the default file icons for .py and .md files.

@mwouts mwouts added this to the 1.11.0 milestone Mar 17, 2021
mwouts added a commit that referenced this issue Mar 18, 2021
* jupytext.read and write accept a config argument

* Settings from the config file have precedence over those in the notebook at save time

* Comment on why we use the config when reading text notebooks

* Normalize the Jupytext configuration options
- default_jupytext_formats -> formats
- default_notebook_metadata_filter -> notebook_metadata_filter
- default_cell_metadata_filter -> cell_metadata_filter
- default_cell_markers -> cell_markers

Previous option names are supported but will cause a DeprecationWarning

* Rename "default_jupytext_formats" to "formats" in the tests and documentation

* Rename "default_notebook_metadata_filter" to "notebook_metadata_filter" in the tests and documentation

* Rename "default_cell_metadata_filter" to "cell_metadata_filter" in the tests and documentation

* Rename "default_cell_markers" to "cell_markers" in the tests and documentation

* On the way to Jupytext 1.11.0

* Use nbformat>=5.1.2 in tests
to get rid of the 'Sampling from a set deprecated' warning

* 'formats' in jupytext.toml can be a string, a list or a dict prefix => format name

* Issue FutureWarnings rather than DeprecationWarnings when obsolete config names are used

* Add contributing.md to the documentation

* Use notebook_extensions from the config file if set #746

* One more test on config & metadata filters

* Test that deprecated options work but result in a warning

* Version 1.11.0rc0

* Version 1.11.0
@mwouts
Copy link
Owner

mwouts commented Mar 18, 2021

This issue will be fixed in Jupytext 1.11.0 - you will be able to set notebook_extensions directly in the jupytext.toml file, no need anymore to modify the Jupyter configuration files.

@mwouts mwouts closed this as completed Mar 18, 2021
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

2 participants