Building the User Tutorials Website Locally
Here, we provide instructions for setting up an appropriate Python environment and building the SimPEG user tutorials website locally with MyST.
Step 1: Cloning the GitHub Repository¶
The URL for the SimPEG user tutorials GitHub repository is: https://
git clone https://github.com/simpeg/user-tutorials
cd user-tutorialsStep 2: Setting Up a Python Environment¶
The Jupyter notebooks containing the tutorials are maintained to run properly using the latest release of SimPEG. Notebooks may not run correctly if SimPEG is being imported from an earlier release or development branch. The mystmd and nodejs are also required to build the website locally.
We advise building a Python environment from the environment.yml file in the root directory of the repository.
To create the simpeg-user-tutorials environment using conda:
conda env create -f environment.ymlOnce built, you can activate using:
conda activate simpeg-user-tutorialsStep 3: Build and Execution Commands¶
The SimPEG user tutorials are a collection of Jupyter Notebook (and Markdown) files, which MyST builds into a website. Here, we describe the commands that contributors should be familiar with.
Locally Build and Serve Website¶
The following command will build the website and serve it locally. This will allow you to preview the website and observe any changes to notebooks on the fly. To locally build and serve the website: the website:
myst startNext, follow the instructions prompted by the command to launch the local build in your brower.
Build Only¶
The following command will build the website and store the HTML files in
a new _build folder:
myst build --htmlClean Cached Builds¶
myst clean --allRerunning Notebooks¶
When making alterations and rerunning notebooks, we typically do so by launching Jupyter Notebooks:
jupyter notebookHowever, we can rerun a notebook and overwrite its output cells in place using nbconvert.
To rerun a single notebook, use:
jupyter nbconvert --to notebook --execute --inplace notebook.ipynbWe may also want to rerun all notebooks in the repository. To rerun all notebooks, use:
jupyter nbconvert --to notebook --execute --inplace notebooks/**/*.ipynb