Skip to content

Commit ed1db2e

Browse files
Merge branch 'master' into catalog/758
2 parents 196b8d6 + 92c84fa commit ed1db2e

8 files changed

Lines changed: 43 additions & 60 deletions

File tree

.github/workflows/python.yml

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,15 @@ jobs:
2121
- name: Set up dependencies
2222
run: |
2323
python -m pip install --upgrade pip
24-
pip install setuptools build cython wheel
25-
pip install -r tests/requirements.txt
26-
pip install -r doc/requirements.txt
24+
python -m pip install build
2725
- name: Build source distribution
2826
run:
2927
python -m build
3028
- name: Build from source distribution
3129
run: |
3230
cd dist
33-
pip install -v pygambit*.tar.gz
31+
sdist=$(ls pygambit-*.tar.gz)
32+
pip install -v "${sdist}[test,doc]"
3433
- name: Run tests
3534
run: pytest --run-tutorials
3635

@@ -50,12 +49,9 @@ jobs:
5049
- name: Set up dependencies
5150
run: |
5251
python -m pip install --upgrade pip
53-
pip install setuptools build cython wheel
54-
pip install -r tests/requirements.txt
55-
pip install -r doc/requirements.txt
5652
- name: Build extension
5753
run: |
58-
python -m pip install -v .
54+
python -m pip install -v .[test,doc]
5955
- name: Run tests
6056
run: pytest --run-tutorials
6157

@@ -75,12 +71,9 @@ jobs:
7571
- name: Set up dependencies
7672
run: |
7773
python -m pip install --upgrade pip
78-
pip install setuptools build cython wheel
79-
pip install -r tests/requirements.txt
80-
pip install -r doc/requirements.txt
8174
- name: Build extension
8275
run: |
83-
python -m pip install -v .
76+
python -m pip install -v .[test,doc]
8477
- name: Run tests
8578
run: pytest --run-tutorials
8679

@@ -100,11 +93,8 @@ jobs:
10093
- name: Set up dependencies
10194
run: |
10295
python -m pip install --upgrade pip
103-
pip install setuptools build cython wheel
104-
pip install -r tests/requirements.txt
105-
pip install -r doc/requirements.txt
10696
- name: Build extension
10797
run: |
108-
python -m pip install -v .
98+
python -m pip install -v .[test,doc]
10999
- name: Run tests
110100
run: pytest --run-tutorials

.readthedocs.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ build:
2020

2121
python:
2222
install:
23-
- requirements: doc/requirements.txt
2423
- method: pip
2524
path: "."
25+
extra_requirements:
26+
- doc

doc/developer.build.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,11 @@ Use `pip` to install from the **root directory of the source tree**:
188188
189189
python -m venv venv
190190
source venv/bin/activate
191-
python -m pip install .
191+
python -m pip install .[test,doc]
192+
193+
.. tip::
194+
195+
The "test" and "doc" optional dependencies are useful for developers wishing to run the test suite or build this documentation locally.
192196

193197

194198
Once installed, simply ``import pygambit`` in your Python shell or

doc/developer.contributing.rst

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -104,19 +104,16 @@ Be sure to familiarise yourself with :ref:`contributing-code` before reading thi
104104
By default, pull requests on GitHub will trigger the running of Gambit's test suite using GitHub Actions.
105105
You can also run the tests locally before submitting your pull request, using `pytest`.
106106

107-
1. Install the test dependencies (into the virtual environment where you installed PyGambit): ::
107+
1. Ensure `pygambit` is installed with test dependencies: see :ref:`build-python`.
108108

109-
pip install -r tests/requirements.txt
109+
2. Run pytest: ::
110110

111-
2. Navigate to the Gambit repository and run the tests: ::
112-
113-
pytest
114-
115-
3. [Optional] If you wish to run the tutorial notebook tests, you will need to add the ``--run-tutorials`` flag, which require the `doc` dependencies: ::
116-
117-
pip install -r doc/requirements.txt
118111
pytest --run-tutorials
119112

113+
.. tip::
114+
You can omit the `--run-tutorials` to skip running the tutorial notebook tests which take longest to run.
115+
Running tests including tutorials requires `doc` as well as `test` dependencies; see :ref:`build-python`.
116+
120117
Adding to the test suite
121118
^^^^^^^^^^^^^^^^^^^^^^^^
122119

@@ -136,9 +133,7 @@ You can also build the documentation locally to preview your changes before subm
136133

137134
1. `Install Pandoc <https://pandoc.org/installing.html>`_ for your OS
138135

139-
2. Install the docs dependencies (into the virtual environment where you installed PyGambit): ::
140-
141-
pip install -r doc/requirements.txt
136+
2. Ensure `pygambit` is installed with doc dependencies: see :ref:`build-python`.
142137

143138
3. Navigate to the Gambit repo and build the docs: ::
144139

@@ -158,7 +153,7 @@ To submit a tutorial for inclusion in the Gambit documentation, please follow th
158153

159154
3. Update `doc/pygambit.rst` to ensure the tutorial is listed in the docs at an appropriate location.
160155

161-
4. *[Optional]* If your tutorial requires additional dependencies not already listed in `doc/requirements.txt`, please add them to the file.
156+
4. *[Optional]* If your tutorial requires additional dependencies not already listed in the ``doc`` list under ``[project.optional-dependencies]`` inside ``pyproject.toml``, please add them to the file.
162157

163158

164159
Recognising contributions

doc/requirements.txt

Lines changed: 0 additions & 13 deletions
This file was deleted.

doc/tutorials/running_locally.rst

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,29 +8,24 @@ The tutorials are available as Jupyter notebooks and can be run interactively us
88

99
.. tip:: Create a virtual environment with Python 3.10 or higher.
1010

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

1313
git clone https://github.com/gambitproject/gambit.git
1414

15-
2. Install `pygambit`:
15+
2. Install `pygambit` with additional documentation dependencies:
1616

1717
* To install the latest release from PyPI::
1818

19-
pip install pygambit
19+
pip install pygambit[doc]
2020

21-
* Alternatively, to install the latest development version::
21+
* Alternatively, to install the latest development version (from the top level of the gambit repo)::
2222

23-
pip install .
24-
25-
3. Install other requirements (including `JupyterLab`) used by the tutorials ::
26-
27-
cd gambit/doc
28-
pip install -r requirements.txt
23+
pip install .[doc]
2924

3025
.. warning::
3126
Windows users wishing to run the "Using Gambit with OpenSpiel" tutorial will need to install OpenSpiel manually; see the `OpenSpiel installation instructions <https://openspiel.readthedocs.io/en/latest/windows.html>`_ for details.
3227

33-
4. Open `JupyterLab` and click on any of the tutorial notebooks (files ending in `.ipynb`) ::
28+
3. Open `JupyterLab` and click on any of the tutorial notebooks in ``doc/tutorials`` (files ending in `.ipynb`) ::
3429

35-
cd tutorials
30+
cd doc/tutorials
3631
jupyter lab

pyproject.toml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,21 @@ dependencies = [
3131
"pandas",
3232
]
3333

34+
[project.optional-dependencies]
35+
test = ["pytest", "nbformat", "nbclient", "ipykernel"]
36+
doc = [
37+
"pydata-sphinx-theme",
38+
"sphinx_design",
39+
"sphinx-autobuild",
40+
"nbsphinx",
41+
"ipython",
42+
"matplotlib",
43+
"pickleshare",
44+
"jupyter",
45+
"open_spiel; sys_platform != 'win32'",
46+
"draw-tree @ git+https://github.com/gambitproject/draw_tree.git@v0.3.1"
47+
]
48+
3449
[project.urls]
3550
Homepage = "https://www.gambit-project.org"
3651
Documentation = "https://gambitproject.readthedocs.io"

tests/requirements.txt

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)