executablebooks / jupyter-book

Create beautiful, publication-quality books and documents from computational content.
http://jupyterbook.org
BSD 3-Clause "New" or "Revised" License
3.76k stars 652 forks source link

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

Open ntwuxc opened 2 years ago

ntwuxc commented 2 years ago

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
    }
welcome[bot] commented 2 years ago

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:

st4eve commented 11 months ago

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

stevejpurves commented 11 months ago

@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 commented 11 months ago

@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.

st4eve commented 11 months ago

@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.