[Python] How do I install and integrate spyder-notebook's source code into Spyder 6 IDE's...

Discussão em 'Python' iniciado por Stack, Fevereiro 23, 2025.

  1. Stack

    Stack Membro Participativo

    I want to edit the source code of spyder-notebook and then integrate the source code of my custom spyder-notebook into the Spyder 6 IDE. Essentially, I want to extend the functionality of the Spyder 6 IDE by building a plug-in and the spyder-notebook source code provides an excellent starting point. If I were to be able to fork the spyder-notebook repository on GitHub and then integrate it into a local copy of the Spyder 6 IDE build from source, then that would save me a tremendous amount of time. I suppose I could edit the code, publish it as a private Anaconda repository, and download it using Conda, but that would require paying for Anaconda Business and is also undesireable to me for other reasons I won't get into.

    I tried editing Z:\dev\spyder-6.0.4\spyder\plugins\spyderchat\setup.py by adding various deraivatives of this line "notebook = spyder.plugins.spyderchat.spyder_notebook.notebookplugin:NotebookPlugin",.

    Every time I got this:

    2025-02-23 00:24:57,431 [INFO] [Bootstrap] -> Previous root branch: not master; current root branch: not master
    2025-02-23 00:24:57,431 [INFO] [InstallDevRepos] -> Installing 'spyder-6.0.4' from source in editable mode.
    2025-02-23 00:25:08,444 [INFO] [Bootstrap] -> python-lsp-server installed in editable mode
    2025-02-23 00:25:08,445 [INFO] [Bootstrap] -> qtconsole installed in editable mode
    2025-02-23 00:25:08,445 [INFO] [Bootstrap] -> spyder-kernels installed in editable mode
    2025-02-23 00:25:08,445 [INFO] [Bootstrap] -> Restarting bootstrap to pick up installed subrepos
    2025-02-23 00:25:08,702 [INFO] [Bootstrap] -> Executing Spyder from source checkout
    2025-02-23 00:25:08,706 [INFO] [Bootstrap] -> PyQt5 is detected, selecting
    2025-02-23 00:25:08,909 [INFO] [Bootstrap] -> Imported Spyder 6.0.4 - Revision , Branch: None; [Python 3.11.11 64bits, Qt 5.15.8, PyQt5 5.15.9 on Windows]
    2025-02-23 00:25:08,910 [INFO] [Bootstrap] -> Running Spyder
    2025-02-23 00:25:08,934 [INFO] [Bootstrap] -> Bootstrap completed in 00:00:00.2346
    notebook: No module named 'spyder_notebook'
    Traceback (most recent call last):
    File "Z:\dev\spyder-6.0.4\spyder\app\find_plugins.py", line 71, in find_external_plugins
    mod = importlib.import_module(entry_point.module)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "Z:\anaconda3\envs\spyder-dev\Lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
    File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
    File "<frozen importlib._bootstrap>", line 1126, in _find_and_load_unlocked
    File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
    File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
    File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
    File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
    File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
    File "<frozen importlib._bootstrap_external>", line 940, in exec_module
    File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
    File "Z:\dev\spyder-6.0.4\spyder\plugins\spyderchat\spyder_notebook\__init__.py", line 11, in <module>
    from spyder_notebook.notebookplugin import NotebookPlugin as PLUGIN_CLASS
    ModuleNotFoundError: No module named 'spyder_notebook'


    I also tried adding the spyder-notebook code as a sub-module directly into the repository's root\ and into a root\plugin\ folder.

    Continue reading...

Compartilhe esta Página