Shortcuts

This page was generated from doc/configuring-kernels.ipynb. Interactive online version: Binder badge.

Configuring the Kernels

Kernel Name

If we have multiple kernels installed, we can choose to override the kernel saved in the notebook using nbsphinx_kernel_name:

nbsphinx_kernel_name = 'python-upstream-dev'

which uses the kernel named python-upstream-dev instead of the kernel name stored in the notebook.

Kernel Arguments

We can also pass options to the kernel by setting nbsphinx_execute_arguments in conf.py. These work the same way as ipython_kernel_config.py. For example, using

nbsphinx_execute_arguments = [
    "--InlineBackend.rc={'figure.dpi': 96}",
]

to set plot options is the same as writing:

c.InlineBackend.rc = {'figure.dpi': 96}

in ipython_kernel_config.py or using:

%config InlineBackend.rc={'figure.dpi': 96}

at the top of a notebook:

[1]:
get_ipython().config.InlineBackend.rc
[1]:
{'figure.dpi': 96}

Environment Variables

The contents of os.environ after the execution of conf.py will be passed as environment variables to the kernel. As an example, MY_DUMMY_VARIABLE has been set in conf.py like this:

import os
os.environ['MY_DUMMY_VARIABLE'] = 'Hello from conf.py!'

… and it can be checked in the notebook like this:

[2]:
import os
os.environ['MY_DUMMY_VARIABLE']
[2]:
'Hello from conf.py!'

This is useful if we want to edit PYTHONPATH in order to compile the documentation without installing the project:

import os

src = os.path.abspath('../src')
os.environ['PYTHONPATH'] = src

If you are using https://mybinder.org/ and you want to define environment variables, you should create a file .binder/start in your repository (see Binder docs) containing definitions like this:

#!/bin/bash
export MY_DUMMY_VARIABLE="Hello from .binder/start!"
exec "$@"
Read the Docs v: pytorch-theme
Versions
latest
0.6.0
0.5.1
0.5.0
0.4.3
0.4.2
0.4.1
0.3.5
0.3.4
0.3.3
0.3.2
0.3.1
0.3.0
0.2.18
0.2.17
0.2.16
0.2.15
0.2.14
0.2.13
0.2.12
0.2.11
0.2.10
0.2.9
0.2.8
0.2.7
0.2.6
0.2.5
0.2.4
0.2.3
0.2.2
0.2.1
0.2.0
typlog-theme
traditional-theme
sphinxdoc-theme
sizzle-theme
scrolls-theme
rtd-theme
pyviz-theme
pytorch-theme
pyramid-theme
py3doc-enhanced-theme
press-theme
pangeo-theme
pandas-theme
nature-theme
material-theme
maisie-theme
jupyter-theme
julia-theme
haiku-theme
guzzle-theme
dask-theme
cloud-theme
classic-theme
bootstrap-theme
bizstyle-theme
better-theme
basicstrap-theme
astropy-theme
alabaster-theme
alabaster-jupyterhub-theme
agogo-theme
0.1.0
Downloads
pdf
epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.

Docs

Lorem ipsum dolor sit amet, consectetur

View Docs

Tutorials

Lorem ipsum dolor sit amet, consectetur

View Tutorials

Resources

Lorem ipsum dolor sit amet, consectetur

View Resources