/opening-deviation

Compare your recent chess games against an opening reference to see where you first deviated

Primary LanguagePythonMIT LicenseMIT

How to Run

Follow these steps to set up and run the project.

1. Create a Virtual Environment

First, create a virtual environment for your Python in the project directory. This isolates your project dependencies.

python3 -m venv myenv

Activate the virtual environment:

  • On Unix/Linux/macOS:
    source myenv/bin/activate
  • On Windows:
    myenv\Scripts\activate

2. Install Dependencies

Install the project dependencies from the requirements.txt file:

pip install -r requirements.txt

3. Setup Streamlit Configuration

Streamlit expects a hidden directory named .streamlit at the top level of your project. Create this directory if it doesn't already exist:

mkdir -p .streamlit

Inside the .streamlit directory, create a file named secrets.toml and add your Lichess API token:

cd .streamlit && touch secrets.toml 

Add this line to your toml file, replacing "your_api_token" with your actual API token.

LICHESS_API_TOKEN = "your_api_token"

4. Run the Streamlit App

With all requirements set up, run the Streamlit app from the top directory using the following command:

streamlit run main.py

Running Tests

Ensure pytest is installed:

pip install pytest

Install the Project in Editable Mode:

pip install -e .

From the root project directory, run tests with:

pytest

Building the Documentation

Prerequisites

  • Ensure you have Python 3.6 or newer installed.
  • Install Sphinx: pip install sphinx

Building

To build the documentation, run the following command in the project root:

sphinx-build -b html docs/source docs/build

This will generate HTML documentation in the docs/build directory.

Viewing

Open docs/build/index.html in your web browser to view the documentation.