jupyter-book icon indicating copy to clipboard operation
jupyter-book copied to clipboard

how to config thebe server localy(jupyter notebook server) for jupyter-book ?

Open ntwuxc opened this issue 3 years ago • 5 comments

Context

I have a jupyter notebook server localy in docker , 它能通过thebe 在网页中嵌入可执行代码框。

我的问题是如何 配置给 jupyter-notebook 使用呢?

my answer

you can modifiy the builded HTML at end, and executed code with local server:

<script type="text/x-thebe-config">
    {
        requestKernel: true,
        # rem Next few lines 
        # binderOptions: {
        #    repo: "executablebooks/jupyter-book",
        #    ref: "master",
        # },
        codeMirrorConfig: {
            theme: "abcdef",
            mode: "python"
        },
        kernelOptions: {
            kernelName: "python3",
            name: "python3",
            path: "./docs",
            serverSettings: {
                baseUrl: "http://127.0.0.1:8686",   # this is local jupyter notebook server
                token: "dd084d0534afsfg4534df23c164cc5f6ed86929117982cec",  # this is login token 
              }
        },
        predefinedOutput: true
    }

ntwuxc avatar Jun 16 '22 01:06 ntwuxc

Thanks for opening your first issue here! Engagement like this is essential for open source projects! :hugs:
If you haven't done so already, check out EBP's Code of Conduct. Also, please try to follow the issue template as it helps other community members to contribute more effectively.
If your issue is a feature request, others may react to it, to raise its prominence (see Feature Voting).
Welcome to the EBP community! :tada:

welcome[bot] avatar Jun 16 '22 01:06 welcome[bot]

Would it be possible to add local jupyter server thebe execution while the jupyter book is being built?

st4eve avatar Aug 10 '23 18:08 st4eve

@ntwuxc how did you determine the token, was it generated by the server? or did you produce that token and add it to the notebook command line when you started the notebook server? e.g.

jupyter notebook --NotebookApp.token=dd084d0534afsfg4534df23c164cc5f6ed86929117982cec

stevejpurves avatar Aug 10 '23 20:08 stevejpurves

@st4eve unfortunately the sphinx-thebe integration only handles a subset of the thebe options, until a passthough of all options is implemented (https://github.com/executablebooks/sphinx-thebe/issues/17) then this won't be possible in jupyter-book. We've added this in mystmd which has been keeping pace with the more recent thebe changes.

stevejpurves avatar Aug 10 '23 21:08 stevejpurves

@stevejpurves thanks for the information. What steps need to happen before these features can be implemented? My lab is currently using jupyter book for our local server site. A locally hosted jupyter server is necessary for us to run some interactive visualization tools. How difficult is a migration to MySt? The majority of our pages are written in markdown.

st4eve avatar Aug 11 '23 15:08 st4eve