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

codemirror_mode shouldn't be in kernel.json #105

Open
akhmerov opened this issue Sep 13, 2020 · 0 comments
Open

codemirror_mode shouldn't be in kernel.json #105

akhmerov opened this issue Sep 13, 2020 · 0 comments

Comments

@akhmerov
Copy link

I'm using bash_kernel via nbconvert, and I noticed the following deprecation warning.

traceback
self = <jupyter_client.kernelspec.KernelSpec object at 0x7f905cddf460>, args = ()
kwargs = {'argv': ['/home/anton/miniconda3/envs/py38/bin/python', '-m', 'bash_kernel', '-f', '{connection_file}'], 'codemirror_mode': 'shell', 'display_name': 'Bash', 'env': {'PS1': '$'}, ...}
super_args = (), super_kwargs = {'codemirror_mode': 'shell'}, key = 'language', value = 'bash', arg_s_list = ["codemirror_mode='shell'"], k = 'codemirror_mode', v = 'shell'
arg_s = "codemirror_mode='shell'"

    def __init__(self, *args, **kwargs):
        # Allow trait values to be set using keyword arguments.
        # We need to use setattr for this to trigger validation and
        # notifications.
        super_args = args
        super_kwargs = {}
        with self.hold_trait_notifications():
            for key, value in kwargs.items():
                if self.has_trait(key):
                    setattr(self, key, value)
                else:
                    # passthrough args that don't set traits to super
                    super_kwargs[key] = value
        try:
            super(HasTraits, self).__init__(*super_args, **super_kwargs)
        except TypeError as e:
            arg_s_list = [ repr(arg) for arg in super_args ]
            for k, v in super_kwargs.items():
                arg_s_list.append("%s=%r" % (k, v))
            arg_s = ', '.join(arg_s_list)
>           warn(
                "Passing unrecognized arguments to super({classname}).__init__({arg_s}).\n"
                "{error}\n"
                "This is deprecated in traitlets 4.2."
                "This error will be raised in a future release of traitlets."
                .format(
                    arg_s=arg_s, classname=self.__class__.__name__,
                    error=e,
                ),
                DeprecationWarning,
                stacklevel=2,
            )
E           DeprecationWarning: Passing unrecognized arguments to super(KernelSpec).__init__(codemirror_mode='shell').
E           object.__init__() takes exactly one argument (the instance to initialize)
E           This is deprecated in traitlets 4.2.This error will be raised in a future release of traitlets.

../../../miniconda3/envs/py38/lib/python3.8/site-packages/traitlets/traitlets.py:1088: DeprecationWarning

Inspecting jupyter_client, I observed that codemirror_mode is not a trait of KernelSpec (source), and therefore it should probably be removed from this line.

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