Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pull request template #50

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<!--
Thanks for contributing a pull request to SimPEG user tutorials!
Remember to use a personal fork of SimPEG user tutorials to propose changes.

Check out the stages of a pull request at
https://docs.simpeg.xyz/content/getting_started/contributing/pull-requests.html

Note that we are a team of volunteers and we appreciate your
patience during the review process.

Again, thanks for contributing!

Feel free to remove lines from this template that do not apply to you pull request.
-->

#### Summary
<!-- Add a summary of this Pull Request. Explain what it provides as tutorial material. -->

#### PR Checklist
* [ ] If this is a work in progress PR, set as a Draft PR
* [ ] Introduction is complete:
* [ ] Title and author added to notebook
* [ ] Admonitions for notebook difficulty and computational resources have been added
* [ ] Keywords list has been added
* [ ] Summary paragraph describing the tutorial has been added
* [ ] Learning objectives have been listed
* [ ] Hyperlinks to other tutorial notebooks added if necessary
Comment on lines +25 to +31
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about simplifying the text in these items? Something like this:

Suggested change
* [ ] Introduction is complete:
* [ ] Title and author added to notebook
* [ ] Admonitions for notebook difficulty and computational resources have been added
* [ ] Keywords list has been added
* [ ] Summary paragraph describing the tutorial has been added
* [ ] Learning objectives have been listed
* [ ] Hyperlinks to other tutorial notebooks added if necessary
* [ ] Introduction is complete and includes:
* [ ] Title and author
* [ ] Admonitions for notebook difficulty and computational resources
* [ ] Keywords list
* [ ] Summary paragraph describing the tutorial
* [ ] Learning objectives
* [ ] Hyperlinks to other tutorial notebooks (if necessary)

* [ ] For sections and subsections:
* [ ] A header and short summary of what is being done
* [ ] Links to API documentation added for all classes and functions that are used
* [ ] Newly introduced functionality is explained or links provided to relevant notebooks
* [ ] All figures are legible and rendered appropriately
* [ ] Coding cells have been linted according to the [style guides](https://docs.simpeg.xyz/latest/content/getting_started/contributing/code-style.html).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have style guide for this particular repo. I'd suggest linking at those instead of linking to the ones we have in SimPEG.

Suggested change
* [ ] Coding cells have been linted according to the [style guides](https://docs.simpeg.xyz/latest/content/getting_started/contributing/code-style.html).
* [ ] Coding cells have been linted according to the [style guides](https://simpeg.xyz/user-tutorials/formatting#check-style-of-notebooks).

* [ ] Marked as ready for review (if this is was a draft PR), and converted to a pull request
* [ ] Tagged ``@simpeg/simpeg-developers`` when ready for review.


#### Additional information
<!--Any additional information you think is important.-->


<!--
Once all tests pass and the code has been reviewed and approved, it will be merged into main
-->
7 changes: 7 additions & 0 deletions index.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,10 @@ Requires moderate computational resources. Run-times may exceed several minutes
The computational resources required to execute this notebook exceed those provided by standard laptop computers. To execute the notebook, please deploy to a cluster computing environment.
```

Want to Add a Tutorial?
-----------------------

Please visit the [Contributing to User Tutorials](notebooks/contributing_index.md) page to find out how you can add a tutorial.



5 changes: 5 additions & 0 deletions myst.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,11 @@ project:
children:
- file: notebooks/12-pgi-inversion/plot_inv_1_joint_pf_pgi_full_info_tutorial.ipynb
- file: notebooks/12-pgi-inversion/plot_inv_2_joint_pf_pgi_no_info_tutorial.ipynb
- file: notebooks/contributing_index.md
children:
- file: notebooks/contributing/build_website.md
- file: notebooks/contributing/formatting.md
- file: notebooks/contributing/pull_request.md

site:
template: book-theme
Expand Down
2 changes: 1 addition & 1 deletion notebooks/03-gravity/fwd_gravity_gradiometry_3d.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -782,7 +782,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.15"
"version": "3.10.16"
}
},
"nbformat": 4,
Expand Down
109 changes: 109 additions & 0 deletions notebooks/contributing/build_website.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
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](https://mystmd.org/).

## Step 1: Cloning the GitHub Repository

The URL for the SimPEG user tutorials GitHub repository is: https://github.com/simpeg/user-tutorials/. If using the Git Bash shell:

```bash
git clone https://github.com/simpeg/user-tutorials
cd user-tutorials
```

## Step 2: Setting Up a Python Environment

The Jupyter notebooks containing the tutorials are maintained to run properly using the [latest release of SimPEG](https://github.com/simpeg/simpeg/releases).
Notebooks may not run correctly if SimPEG is being imported from an earlier release or development branch.
The [mystmd][install-mystmd] and [nodejs](https://nodejs.org/api/packages.html) 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:

```bash
conda env create -f environment.yml
```

Once built, you can activate using:

```bash
conda activate simpeg-user-tutorials
```

## Step 3: Build and Execution Commands

The SimPEG user tutorials are a collection of [Jupyter Notebook](https://jupyter.org/) (and [Markdown](https://www.markdownguide.org/getting-started/)) files,
which [MyST][mystmd.org] builds into a website. Here, we describe the commands that contributors should be familiar with.

:::{important}
The tutorial notebooks, including their states, are tracked by GitHub. When the SimPEG user tutorials repository was cloned, all notebooks had been run and saved. Therefore, you do not need to rerun all of the notebooks prior to building the website!
:::

### 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:

```bash
msyt start
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix typo:

Suggested change
msyt start
myst start

```

Next, 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:

```bash
msyt build --html
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix typo:

Suggested change
msyt build --html
myst build --html

```

### Clean Cached Builds

```bash
myst clean --all
```

### Rerunning Notebooks

When making alterations and rerunning notebooks, we typically do so by launching Jupyter Notebooks:

```bash
jupyter notebook
```

However, we can rerun a notebook and overwrite its output cells in place using `nbconvert`.
To rerun a single notebook, use:

```bash
jupyter nbconvert --to notebook --execute --inplace notebook.ipynb
```

We may also want to rerun all notebooks in the repository.
To rerun all notebooks, use:

```bash
jupyter nbconvert --to notebook --execute --inplace notebooks/**/*.ipynb
```

:::{danger}
Rerunning all notebooks is a computationally intensive task. Some notebooks
require significant amount of memory to allocate large sensitivity matrices.
:::

> [!IMPORTANT]
> If you are using bash as your shell, make sure to run `shopt -s
> globstar` to enable the `globstar` feature that allows the use of `**` for
> filename expansion.




[install-mystmd]: https://mystmd.org/guide/quickstart
[jupyter]: https://jupyter.org
[mystmd.org]: https://mystmd.org

Loading
Loading