The code structure of Nashpy

The directory structure

The directory structure for Nashpy is:

├── src/
├── tests/
├── docs/
├── CHANGES.md
├── CITATION.md
├── LICENSE
├── README.md
├── paper.bib
├── paper.md
├── pyproject.toml
├── .readthedocs.yml
├── setup.cfg
└── tox.ini

Here is a brief description of each of these:

The src/ directory

The src/ directory contains the source code. It’s structure is as follows:

src/
└── nashpy
    ├── __init__.py
    ├── game.py
    ├── algorithms/
    ├── integer_pivoting/
    ├── learning/
    └── polytope/
  • The __init__.py file contains the various commands to import all the functionality of the library.

  • The game.py file contains the main nashpy.Game class.

  • The algorithms/ directory contains further modules with algorithms for computation of Nash equilibria.

  • The integer_pivoting/ directory contains further modules with algorithms for integer pivoting.

  • The learning/ directory contains further modules for various learning algorithms.

  • The polytope directory contains further modules with code for best response polytopes.

The tests/ directory

This contains all the test files.

The docs/ directory

The documentation is written using the Diataxis framework [Procida2021]. As well as various configuration files for sphinx there are 5 main subdirectories:

docs/
├── contributing
│   ├── discussion/
│   ├── how-to/
│   ├── index.rst
│   ├── reference/
│   └── tutorial/
├── discussion/
├── how-to/
├── index.rst
├── reference/
└── tutorial/
  • The contributing/ directory contains the specific contributing documentation. Which itself is written using Diataxis [Procida2021].

  • The discussion/ directory contains source files for the discussion described at [Procida2021] as: “explanation is discussion that clarifies and illuminates a particular topic.”

  • The reference/ directory contains source files for the reference described at [Procida2021] as: “reference guides are technical descriptions of the machinery and how to operate it.”

  • The how-to/ directory contains source files for the how to guides described at [Procida2021] as: “how-to guides are directions that take the reader through the steps required to solve a real-world problem”

  • The tutorial/ directory contains source files for the tutorial described at [Procida2021] as: “tutorials are lessons that take the reader by the hand through a series of steps to complete a project of some kind.”

The CHANGES.md file

Makes a note of different changes in versions of Nashpy.

The CITATION.md file

Contains information for citing Nashpy.

The LICENSE file

Contains the license.

The README.md file

Contains the first entry point documentation to the Nashpy project.

The paper.bib and paper.md files

These are the source files for the Journal of Open Source Software paper written about Nashpy: [Knight2018b].

The pyproject.toml file

Contains all the build instructions for packaging Nashpy and is used by flit.

The .readthedocs.yml file

This includes configuration settings for the online service that hosts the documentation read the docs.

The setup.cfg file

Contains some configuration instructions for testing.

The tox.ini file

Contains the instructions for the test runner tox.

The Game class

The nashpy.Game class is an umbrella class that creates an object oriented interface to all functionality of Nashpy as methods on a game.