diff --git a/.github/ISSUE_TEMPLATE/tutorial_request.yml b/.github/ISSUE_TEMPLATE/tutorial_request.yml index 6f8fe4513..16542ce82 100644 --- a/.github/ISSUE_TEMPLATE/tutorial_request.yml +++ b/.github/ISSUE_TEMPLATE/tutorial_request.yml @@ -32,4 +32,4 @@ body: description: Add links to any research papers or other resources the author will need to write this tutorial. value: "`[Markdown link text](url)`" validations: - required: false \ No newline at end of file + required: false diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 86de9a17d..17ec52a78 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -2,15 +2,7 @@ name: Linters and coding standards checks on: push: - paths-ignore: - - 'doc/**' - - '.github/ISSUE_TEMPLATE/**' - - 'README.md' pull_request: - paths-ignore: - - 'doc/**' - - '.github/ISSUE_TEMPLATE/**' - - 'README.md' jobs: clang-format: diff --git a/.github/workflows/osxbinary.yml b/.github/workflows/osxbinary.yml index 025da0132..80ac080df 100644 --- a/.github/workflows/osxbinary.yml +++ b/.github/workflows/osxbinary.yml @@ -2,10 +2,6 @@ name: MacOS static GUI binary on: push: - paths-ignore: - - 'doc/**' - - '.github/ISSUE_TEMPLATE/**' - - 'README.md' tags: - 'v*' schedule: diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index 419e118c1..794340dde 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -2,15 +2,7 @@ name: pygambit Python extension on: push: - paths-ignore: - - 'doc/**' - - '.github/ISSUE_TEMPLATE/**' - - 'README.md' pull_request: - paths-ignore: - - 'doc/**' - - '.github/ISSUE_TEMPLATE/**' - - 'README.md' jobs: linux: @@ -29,7 +21,9 @@ jobs: - name: Set up dependencies run: | python -m pip install --upgrade pip - pip install setuptools build cython pytest pytest-skip-slow wheel lxml numpy scipy nbformat nbclient ipykernel + pip install setuptools build cython wheel + pip install -r tests/requirements.txt + pip install -r doc/requirements.txt - name: Build source distribution run: python -m build @@ -38,13 +32,7 @@ jobs: cd dist pip install -v pygambit*.tar.gz - name: Run tests - run: | - if [ "${{ matrix.python-version }}" = "3.9" ]; then - # Python 3.9 on linux skips the notebook execution test (notebooks may require newer kernels/deps) - pytest -q -k 'not test_execute_notebook' - else - pytest - fi + run: pytest macos-13: runs-on: macos-13 @@ -62,7 +50,9 @@ jobs: - name: Set up dependencies run: | python -m pip install --upgrade pip - pip install cython pytest pytest-skip-slow wheel lxml numpy scipy nbformat nbclient ipykernel + pip install setuptools build cython wheel + pip install -r tests/requirements.txt + pip install -r doc/requirements.txt - name: Build extension run: | python -m pip install -v . @@ -85,7 +75,9 @@ jobs: - name: Set up dependencies run: | python -m pip install --upgrade pip - pip install cython pytest pytest-skip-slow wheel lxml numpy scipy nbformat nbclient ipykernel + pip install setuptools build cython wheel + pip install -r tests/requirements.txt + pip install -r doc/requirements.txt - name: Build extension run: | python -m pip install -v . @@ -108,7 +100,9 @@ jobs: - name: Set up dependencies run: | python -m pip install --upgrade pip - pip install cython pytest pytest-skip-slow wheel lxml numpy scipy nbformat nbclient ipykernel + pip install setuptools build cython wheel + pip install -r tests/requirements.txt + pip install nbformat nbclient ipykernel jupyter matplotlib - name: Build extension run: | python -m pip install -v . diff --git a/.github/workflows/tools.yml b/.github/workflows/tools.yml index 4cd26bc61..1156547ca 100644 --- a/.github/workflows/tools.yml +++ b/.github/workflows/tools.yml @@ -2,15 +2,7 @@ name: Build executables on: push: - paths-ignore: - - 'doc/**' - - '.github/ISSUE_TEMPLATE/**' - - 'README.md' pull_request: - paths-ignore: - - 'doc/**' - - '.github/ISSUE_TEMPLATE/**' - - 'README.md' jobs: linux: diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 7a128e639..e527dcb9b 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -3,10 +3,6 @@ name: pygambit wheels on: push: - paths-ignore: - - 'doc/**' - - '.github/ISSUE_TEMPLATE/**' - - 'README.md' tags: - 'v*' schedule: diff --git a/.gitignore b/.gitignore index 4ca5ddd3c..5e3055af4 100644 --- a/.gitignore +++ b/.gitignore @@ -44,4 +44,4 @@ Gambit.app/* doc/tutorials/games/*.nfg doc/tutorials/games/*.efg *.dmg -Gambit.app/* \ No newline at end of file +Gambit.app/* diff --git a/doc/requirements.txt b/doc/requirements.txt index b06d80877..606f56fbd 100644 --- a/doc/requirements.txt +++ b/doc/requirements.txt @@ -1,12 +1,12 @@ -Cython==3.1.2 -numpy==2.3.2 -scipy==1.16.1 -pydata-sphinx-theme==0.16.1 -sphinx_design==0.6.1 -sphinx-autobuild==2024.10.3 -nbsphinx==0.9.7 -ipython==9.4.0 -matplotlib==3.10.5 -pickleshare==0.7.5 -jupyter==1.1.1 -open_spiel==1.6.9 +Cython +numpy +scipy +pydata-sphinx-theme +sphinx_design +sphinx-autobuild +nbsphinx +ipython +matplotlib +pickleshare +jupyter +open_spiel diff --git a/doc/tutorials/running_locally.rst b/doc/tutorials/running_locally.rst index 756ae7056..8046ddcaa 100644 --- a/doc/tutorials/running_locally.rst +++ b/doc/tutorials/running_locally.rst @@ -3,22 +3,34 @@ How to run PyGambit tutorials on your computer ============================================== -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. -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). +Running the PyGambit tutorials on your machine requires some familiarity with the basics of Python and how to use Git & GitHub. +The tutorials are available as Jupyter notebooks and can be run interactively using any program that supports Jupyter notebooks, such as JupyterLab or VSCode. + +.. tip:: Create a virtual environment with Python 3.13 or higher 1. To download the tutorials, open your OS's command prompt and clone the Gambit repository from GitHub, then navigate to the tutorials directory: :: git clone https://github.com/gambitproject/gambit.git - cd gambit/doc -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. :: +2. Install `pygambit`: + + * To install the latest release from PyPI:: + + pip install pygambit + + * Alternatively, to install the latest development version:: - python -m venv pygambit-env - source pygambit-env/bin/activate - pip install pygambit + pip install . + +3. Install other requirements (including `JupyterLab`) used by the tutorials :: + + cd gambit/doc pip install -r requirements.txt -3. Open `JupyterLab` and click on any of the tutorial notebooks (files ending in `.ipynb`) :: + .. warning:: + 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 `_ for details. + +4. Open `JupyterLab` and click on any of the tutorial notebooks (files ending in `.ipynb`) :: cd tutorials jupyter lab diff --git a/tests/requirements.txt b/tests/requirements.txt index 2091c7fde..545fd9b00 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -1,4 +1,4 @@ -pytest==9.0.0 -nbformat==5.10.4 -nbclient==0.10.2 -ipykernel==6.30.1 +pytest +nbformat +nbclient +ipykernel diff --git a/tests/test_tutorials.py b/tests/test_tutorials.py index f6f3f2123..4d7ed8417 100644 --- a/tests/test_tutorials.py +++ b/tests/test_tutorials.py @@ -1,5 +1,6 @@ import contextlib import os +import sys from pathlib import Path import nbformat @@ -45,6 +46,15 @@ def test_execute_notebook(nb_path): This uses nbclient.NotebookClient to run the notebook in its parent directory so relative paths within the notebook resolve correctly. """ + # Skip notebook execution tests on Python < 3.12 (notebooks may require newer kernels/deps) + if sys.version_info < (3, 12): + pytest.skip("Notebook execution tests require Python 3.12 or newer") + + # Skip OpenSpiel notebook on Windows + # (OpenSpiel is not available on Windows without manual install) + if sys.platform == "win32" and "openspiel" in nb_path.name.lower(): + pytest.skip("OpenSpiel notebook requires OpenSpiel, which is not available on Windows") + nb = nbformat.read(str(nb_path), as_version=4) # Prefer the notebook's kernelspec if provided, otherwise let nbclient pick the default.