Skip to content

Commit 82ca217

Browse files
Add GH issue tutorial request template and tutorial submission guide (#622)
* Adds a GitHub issue template to suggest/request a tutorial * Adds a ew section in documentation on how to contribute a tutorial * Improves test suite's collection of tutorial notebooks
1 parent 2eb31d9 commit 82ca217

File tree

4 files changed

+45
-13
lines changed

4 files changed

+45
-13
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Tutorial request
2+
description: Submit a request for a new tutorial to be added to the Gambit documentation.
3+
title: "[Tutorial]: "
4+
labels: ["tutorial", "documentation"]
5+
body:
6+
- type: textarea
7+
id: describe
8+
attributes:
9+
label: Describe the tutorial you want to see.
10+
description: Go into as much detail as you can regarding the tutorial you would like to see, how long it should be etc.
11+
value: "Add a tutorial demonstrating the core components of the PyGambit API."
12+
validations:
13+
required: true
14+
- type: textarea
15+
id: describe
16+
attributes:
17+
label: Who is the tutorial for?
18+
description: Explain who the target audience is for this tutorial and what prior knowledge they should have.
19+
value: "Newcomers to game theory and the Gambit software who have basic Python programming skills."
20+
validations:
21+
required: true
22+
- type: textarea
23+
id: links
24+
attributes:
25+
label: Add links to papers and software.
26+
description: Add links to any research papers or other resources the author will need to write this tutorial.
27+
value: ""

doc/developer.contributing.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,18 @@ You can also build the documentation locally to preview your changes before subm
109109

110110
4. Open ``doc/_build/html/index.html`` in your browser to view the documentation.
111111

112+
Contributing tutorials
113+
^^^^^^^^^^^^^^^^^^^^^^
112114

115+
To submit a tutorial for inclusion in the Gambit documentation, please follow these steps:
116+
117+
1. Open a GitHub issue using the *Tutorial request* issue template on the `Gambit GitHub repo <https://github.com/gambitproject/gambit/issues/new/choose>`__ or choose an issue already opened with the `tutorial` label.
118+
119+
2. Write the tutorial as a Jupyter notebook (`.ipynb` file), following the style and format of existing tutorials in the `doc/tutorials` directory. Develop this on a branch as per the instructions in :ref:`contributing-code`. Add the tutorial to the `doc/tutorials` directory in the repository. Put it in an appropriate subdirectory or create a new one if necessary.
120+
121+
3. Update `doc/pygambit.rst` to ensure the tutorial is listed in the docs at an appropriate location.
122+
123+
4. *[Optional]* If your tutorial requires additional dependencies not already listed in `doc/requirements.txt`, please add them to the file.
113124

114125

115126
Recognising contributions

doc/tutorials/running_locally.rst

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,16 @@ You will need a working installation of Python 3.9+ on your machine to run PyGam
99
1. To download the tutorials, open your OS's command prompt and clone the Gambit repository from GitHub, then navigate to the tutorials directory: ::
1010

1111
git clone https://github.com/gambitproject/gambit.git
12-
cd gambit/doc/tutorials
12+
cd gambit/doc
1313

14-
2. Install `PyGambit` and `JupyterLab`. We recommend creating a new virtual environment and installing both the requirements there. e.g. ::
14+
2. Install `pygambit` and other requirements (including `JupyterLab` and other packages used by the tutorials). We recommend creating a new virtual environment and installing both the requirements there. e.g. ::
1515

1616
python -m venv pygambit-env
1717
source pygambit-env/bin/activate
18-
pip install pygambit jupyterlab
18+
pip install pygambit
19+
pip install -r requirements.txt
1920

2021
3. Open `JupyterLab` and click on any of the tutorial notebooks (files ending in `.ipynb`) ::
2122

23+
cd tutorials
2224
jupyter lab

tests/test_tutorials.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,9 @@ def _find_tutorial_notebooks():
1616
if not root.exists():
1717
pytest.skip(f"Tutorials folder not found: {root}")
1818

19-
# Collect notebooks from the tutorials root (recursive).
20-
notebooks = set(root.rglob("*.ipynb"))
19+
# Collect all notebooks under doc/tutorials (including any subfolders).
20+
notebooks = sorted(set(root.rglob("*.ipynb")))
2121

22-
# Also explicitly include notebooks under an "advanced_tutorials" subfolder
23-
# (in case they are separate or not picked up for some layouts). Use a set
24-
# to deduplicate if the subfolder is already part of the root search.
25-
advanced = root / "advanced_tutorials"
26-
if advanced.exists():
27-
notebooks.update(advanced.rglob("*.ipynb"))
28-
29-
notebooks = sorted(notebooks)
3022
if not notebooks:
3123
pytest.skip(f"No tutorial notebooks found in: {root}")
3224
return notebooks

0 commit comments

Comments
 (0)