Skip to content

Commit 3489b98

Browse files
Fix dependency installation in python.yml GitHub Action (#656)
- Now GH action installs from the `requirements.txt` files used by tests and docs directly - Also moves the logic that skips running the tutorial tests from the GH action to the test file itself (don't run for <3.12), to avoid any inconsistencies with GH actions PR vs Push vs running locally - Removes the version pinning for doc and test requirements - this was actually preventing the installation of packages from working across Python versions, as the pinned package versions for earlier python versions were not always available. It was too stringent to pin these and I don't think there's much to be gained from having done so - if the latest versions of any of those packages do end up including changes that break our docs infrastructure, this will at worst mean that a docs build could fail, but that would be picked up in any PR and would not affect the current build. Might be worth discussing pinning of dependencies of `pygambit` itself in future though - See comment below: The `paths-ignore` in the GitHub action yml was wrongly preventing some checks from running. I don't think it's a big problem to remove this completely, whilst PRs take a long time to run, we don't do docs PRs in high enough volume/speed for this to be too much of a problem - Since Windows requires a specific manual installation of OpenSpiel, I have added a Warning that links to this in the How to run PyGambit tutorials on your computer and skipped running OpenSpiel notebook when running tests on Windows GH action. Also made a few other edits to this page whilst I was there.
1 parent 2db5f7a commit 3489b98

File tree

11 files changed

+61
-69
lines changed

11 files changed

+61
-69
lines changed

.github/ISSUE_TEMPLATE/tutorial_request.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,4 @@ body:
3232
description: Add links to any research papers or other resources the author will need to write this tutorial.
3333
value: "`[Markdown link text](url)`"
3434
validations:
35-
required: false
35+
required: false

.github/workflows/lint.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,7 @@ name: Linters and coding standards checks
22

33
on:
44
push:
5-
paths-ignore:
6-
- 'doc/**'
7-
- '.github/ISSUE_TEMPLATE/**'
8-
- 'README.md'
95
pull_request:
10-
paths-ignore:
11-
- 'doc/**'
12-
- '.github/ISSUE_TEMPLATE/**'
13-
- 'README.md'
146

157
jobs:
168
clang-format:

.github/workflows/osxbinary.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@ name: MacOS static GUI binary
22

33
on:
44
push:
5-
paths-ignore:
6-
- 'doc/**'
7-
- '.github/ISSUE_TEMPLATE/**'
8-
- 'README.md'
95
tags:
106
- 'v*'
117
schedule:

.github/workflows/python.yml

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,7 @@ name: pygambit Python extension
22

33
on:
44
push:
5-
paths-ignore:
6-
- 'doc/**'
7-
- '.github/ISSUE_TEMPLATE/**'
8-
- 'README.md'
95
pull_request:
10-
paths-ignore:
11-
- 'doc/**'
12-
- '.github/ISSUE_TEMPLATE/**'
13-
- 'README.md'
146

157
jobs:
168
linux:
@@ -29,7 +21,9 @@ jobs:
2921
- name: Set up dependencies
3022
run: |
3123
python -m pip install --upgrade pip
32-
pip install setuptools build cython pytest pytest-skip-slow wheel lxml numpy scipy nbformat nbclient ipykernel
24+
pip install setuptools build cython wheel
25+
pip install -r tests/requirements.txt
26+
pip install -r doc/requirements.txt
3327
- name: Build source distribution
3428
run:
3529
python -m build
@@ -38,13 +32,7 @@ jobs:
3832
cd dist
3933
pip install -v pygambit*.tar.gz
4034
- name: Run tests
41-
run: |
42-
if [ "${{ matrix.python-version }}" = "3.9" ]; then
43-
# Python 3.9 on linux skips the notebook execution test (notebooks may require newer kernels/deps)
44-
pytest -q -k 'not test_execute_notebook'
45-
else
46-
pytest
47-
fi
35+
run: pytest
4836

4937
macos-13:
5038
runs-on: macos-13
@@ -62,7 +50,9 @@ jobs:
6250
- name: Set up dependencies
6351
run: |
6452
python -m pip install --upgrade pip
65-
pip install cython pytest pytest-skip-slow wheel lxml numpy scipy nbformat nbclient ipykernel
53+
pip install setuptools build cython wheel
54+
pip install -r tests/requirements.txt
55+
pip install -r doc/requirements.txt
6656
- name: Build extension
6757
run: |
6858
python -m pip install -v .
@@ -85,7 +75,9 @@ jobs:
8575
- name: Set up dependencies
8676
run: |
8777
python -m pip install --upgrade pip
88-
pip install cython pytest pytest-skip-slow wheel lxml numpy scipy nbformat nbclient ipykernel
78+
pip install setuptools build cython wheel
79+
pip install -r tests/requirements.txt
80+
pip install -r doc/requirements.txt
8981
- name: Build extension
9082
run: |
9183
python -m pip install -v .
@@ -108,7 +100,9 @@ jobs:
108100
- name: Set up dependencies
109101
run: |
110102
python -m pip install --upgrade pip
111-
pip install cython pytest pytest-skip-slow wheel lxml numpy scipy nbformat nbclient ipykernel
103+
pip install setuptools build cython wheel
104+
pip install -r tests/requirements.txt
105+
pip install nbformat nbclient ipykernel jupyter matplotlib
112106
- name: Build extension
113107
run: |
114108
python -m pip install -v .

.github/workflows/tools.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,7 @@ name: Build executables
22

33
on:
44
push:
5-
paths-ignore:
6-
- 'doc/**'
7-
- '.github/ISSUE_TEMPLATE/**'
8-
- 'README.md'
95
pull_request:
10-
paths-ignore:
11-
- 'doc/**'
12-
- '.github/ISSUE_TEMPLATE/**'
13-
- 'README.md'
146

157
jobs:
168
linux:

.github/workflows/wheels.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@ name: pygambit wheels
33

44
on:
55
push:
6-
paths-ignore:
7-
- 'doc/**'
8-
- '.github/ISSUE_TEMPLATE/**'
9-
- 'README.md'
106
tags:
117
- 'v*'
128
schedule:

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,4 @@ Gambit.app/*
4444
doc/tutorials/games/*.nfg
4545
doc/tutorials/games/*.efg
4646
*.dmg
47-
Gambit.app/*
47+
Gambit.app/*

doc/requirements.txt

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
Cython==3.1.2
2-
numpy==2.3.2
3-
scipy==1.16.1
4-
pydata-sphinx-theme==0.16.1
5-
sphinx_design==0.6.1
6-
sphinx-autobuild==2024.10.3
7-
nbsphinx==0.9.7
8-
ipython==9.4.0
9-
matplotlib==3.10.5
10-
pickleshare==0.7.5
11-
jupyter==1.1.1
12-
open_spiel==1.6.9
1+
Cython
2+
numpy
3+
scipy
4+
pydata-sphinx-theme
5+
sphinx_design
6+
sphinx-autobuild
7+
nbsphinx
8+
ipython
9+
matplotlib
10+
pickleshare
11+
jupyter
12+
open_spiel

doc/tutorials/running_locally.rst

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,34 @@
33
How to run PyGambit tutorials on your computer
44
==============================================
55

6-
The PyGambit tutorials are available as Jupyter notebooks and can be run interactively using any program that supports Jupyter notebooks, such as JupyterLab or VSCode.
7-
You will need a working installation of Python 3.9+ on your machine to run PyGambit (however the tutorials contain some syntax that may not be compatible with earlier versions of Python than 3.13).
6+
Running the PyGambit tutorials on your machine requires some familiarity with the basics of Python and how to use Git & GitHub.
7+
The tutorials are available as Jupyter notebooks and can be run interactively using any program that supports Jupyter notebooks, such as JupyterLab or VSCode.
8+
9+
.. tip:: Create a virtual environment with Python 3.13 or higher
810

911
1. To download the tutorials, open your OS's command prompt and clone the Gambit repository from GitHub, then navigate to the tutorials directory: ::
1012

1113
git clone https://github.com/gambitproject/gambit.git
12-
cd gambit/doc
1314

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. ::
15+
2. Install `pygambit`:
16+
17+
* To install the latest release from PyPI::
18+
19+
pip install pygambit
20+
21+
* Alternatively, to install the latest development version::
1522

16-
python -m venv pygambit-env
17-
source pygambit-env/bin/activate
18-
pip install pygambit
23+
pip install .
24+
25+
3. Install other requirements (including `JupyterLab`) used by the tutorials ::
26+
27+
cd gambit/doc
1928
pip install -r requirements.txt
2029

21-
3. Open `JupyterLab` and click on any of the tutorial notebooks (files ending in `.ipynb`) ::
30+
.. warning::
31+
Windows users will encounter an error when installing the requirements, which include the OpenSpiel library. Users wishing to run the OpenSpiel tutorial will need to install this manually; see the `OpenSpiel installation instructions <https://openspiel.readthedocs.io/en/latest/windows.html>`_ for details.
32+
33+
4. Open `JupyterLab` and click on any of the tutorial notebooks (files ending in `.ipynb`) ::
2234

2335
cd tutorials
2436
jupyter lab

tests/requirements.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
pytest==9.0.0
2-
nbformat==5.10.4
3-
nbclient==0.10.2
4-
ipykernel==6.30.1
1+
pytest
2+
nbformat
3+
nbclient
4+
ipykernel

0 commit comments

Comments
 (0)