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

Jupyter Server cannot recognize contents_manager_class class in the config.py file #1309

Open
luweizheng opened this issue Aug 1, 2023 · 3 comments
Assignees
Labels

Comments

@luweizheng
Copy link

luweizheng commented Aug 1, 2023

Description

Not sure if this is the jupyter_server's bug.

Recent jupyter may have some breaking changes on the config file. Some plugin with notebook.services.contents.filemanager.FileContentsManager cannot be recognized when configured c.NotebookApp.contents_manager_class in the jupyter_notebook_config.py file.
Or maybe the community should update when implementing a contents_manager_class?

Reproduce

I want to use notedown plugin to open markdown file in jupyter notebook. This plugin can open the .md file in jupyter notebook just as a normal .ipynb file.

I get the above error when starting the jupyter after setting c.NotebookApp.contents_manager_class = 'notedown.NotedownContentsManager'.

I try a quick fix by changing the following two lines. I am not familiar with this filemanager stuff.

import jupyter_server.transutils
from jupyter_server.services.contents.filemanager import FileContentsManager

It seems that jupyter can start without the error. But I cannot open the markdown file as a normal ipynb file. The markdown file can be opened but in the markdown format. It is not what this plugin expects.

Earyl version of jupyter can work.

Early version like 4.4.0 works.

jupyter --version
4.4.0

New version like jupyter_server 2.7.0 does not work.

jupyter --version
Selected Jupyter core packages...
IPython          : 8.11.0
ipykernel        : 6.25.0
ipywidgets       : 8.1.0
jupyter_client   : 8.3.0
jupyter_core     : 5.3.1
jupyter_server   : 2.7.0
jupyterlab       : 4.0.3
nbclient         : 0.8.0
nbconvert        : 7.7.3
nbformat         : 5.9.2
notebook         : 7.0.1
qtconsole        : 5.4.3
traitlets        : 5.9.0

Context

Full stack tree when setting explicitly contents_manager_class to notebook.services.contents.largefilemanager.LargeFileManager:

W 2023-08-01 21:33:31.193 ServerApp] notebook | error linking extension: The 'contents_manager_class' trait of a ServerApp instance expected a subclass of 'jupyter_server.services.contents.manager.ContentsManager', not the str 'You need to install the jupyter notebook.'.
    Traceback (most recent call last):
      File "/Users/xxx/anaconda3/envs/df/lib/python3.10/site-packages/jupyter_server/extension/manager.py", line 342, in link_extension
        extension.link_all_points(self.serverapp)
      File "/Users/xxx/anaconda3/envs/df/lib/python3.10/site-packages/jupyter_server/extension/manager.py", line 224, in link_all_points
        self.link_point(point_name, serverapp)
      File "/Users/xxx/anaconda3/envs/df/lib/python3.10/site-packages/jupyter_server/extension/manager.py", line 214, in link_point
        point.link(serverapp)
      File "/Users/xxx/anaconda3/envs/df/lib/python3.10/site-packages/jupyter_server/extension/manager.py", line 136, in link
        linker(serverapp)
      File "/Users/xxx/anaconda3/envs/df/lib/python3.10/site-packages/jupyter_server/extension/application.py", line 405, in _link_jupyter_server_extension
        self.serverapp.update_config(self.config)
      File "/Users/xxx/anaconda3/envs/df/lib/python3.10/site-packages/traitlets/config/configurable.py", line 230, in update_config
        self._load_config(config)
      File "/Users/xxx/anaconda3/envs/df/lib/python3.10/site-packages/traitlets/config/configurable.py", line 181, in _load_config
        setattr(self, name, deepcopy(config_value))
      File "/Users/xxx/anaconda3/envs/df/lib/python3.10/site-packages/traitlets/traitlets.py", line 732, in __set__
        self.set(obj, value)
      File "/Users/xxx/anaconda3/envs/df/lib/python3.10/site-packages/traitlets/traitlets.py", line 706, in set
        new_value = self._validate(obj, value)
      File "/Users/xxx/anaconda3/envs/df/lib/python3.10/site-packages/traitlets/traitlets.py", line 738, in _validate
        value = self.validate(obj, value)
      File "/Users/xxx/anaconda3/envs/df/lib/python3.10/site-packages/traitlets/traitlets.py", line 2056, in validate
        self.error(obj, value)
      File "/Users/xxx/anaconda3/envs/df/lib/python3.10/site-packages/traitlets/traitlets.py", line 844, in error
        raise TraitError(e)
    traitlets.traitlets.TraitError: The 'contents_manager_class' trait of a ServerApp instance expected a subclass of 'jupyter_server.services.contents.manager.ContentsManager', not the str 'You need to install the jupyter notebook.'.
@luweizheng luweizheng added the bug label Aug 1, 2023
@welcome
Copy link

welcome bot commented Aug 1, 2023

Thank you for opening your first issue in this project! Engagement like this is essential for open source projects! 🤗

If you haven't done so already, check out Jupyter's Code of Conduct. Also, please try to follow the issue template as it helps other other community members to contribute more effectively.
welcome
You can meet the other Jovyans by joining our Discourse forum. There is also an intro thread there where you can stop by and say Hi! 👋

Welcome to the Jupyter community! 🎉

@Zsailer
Copy link
Member

Zsailer commented Aug 7, 2023

Thank you for reporting, @luweizheng.

Unfortunately, this is an issue with notedown—a community project not managed by the core Jupyter (Server) team—and will require a change there. Sadly, it looks like that project hasn't been updated in awhile so I'm not sure if you'll have much luck addressing the issue there.

As an alternative, have you checked out jupytext? This project is more actively maintained and seems to provide the same functionality.

@Zsailer Zsailer self-assigned this Aug 7, 2023
@luweizheng
Copy link
Author

As an alternative, have you checked out jupytext? This project is more actively maintained and seems to provide the same functionality.

Thanks @Zsailer Could you give me some suggestions on how to improve the notedown project. Maybe I will make a fork and fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants