Skip to content

Commit 6164439

Browse files
authored
Fix #4658: Add setup guide for building and running EvalAI docs locally (#4664)
* Update outdated package versions, metadata & toctree to fix build errors * Add docs/README.md for docs set up * Add reference link for docs setup in main README * Fix indentation in docs/README
1 parent 8d1444f commit 6164439

File tree

5 files changed

+142
-2
lines changed

5 files changed

+142
-2
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,10 @@ The steps are:
8282
8383
If you are facing any issue during installation, please see our [common errors during installation](https://evalai.readthedocs.io/en/latest/faq(developers).html#common-errors-during-installation) page.
8484
85+
## Setup Instructions for EvalAI Documentation
86+
87+
If you're looking to contribute to EvalAI Documentation, refer to the docs specific setup instructions in `docs/README.md` to set up the docs builder locally.
88+
8589
## Citing EvalAI
8690
If you are using EvalAI for hosting challenges, please cite the following technical report:
8791

docs/README.md

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
## Instructions to Build & Run Documentation Locally
2+
This guide provides instructions for setting up your environment, building, and running the EvalAI documentation on your local machine.
3+
4+
Building and running the documentation locally will help you to ensure accuracy, correct formatting, and preview changes before submitting a pull request.
5+
6+
### Prerequisites & Setup
7+
8+
1. Set up the Project locally
9+
10+
Before building the `docs/` project, make sure you have cloned and set up EvalAI project locally.
11+
12+
To set up the development environment first, follow the [installation instructions](https://github.com/Cloud-CV/EvalAI/blob/master/README.md#installation-instructions) in README.
13+
14+
2. Create a Virtual Environment (Recommended)
15+
16+
EvalAI and its documentation tools require Python 3. We recommend using Python 3.10 or newer.
17+
Also, it's a best practice to work within a Python virtual environment to avoid conflicts with your system's Python packages.
18+
19+
From the root directory of EvalAI project (where `requirements/` folder is located), create and activate a virtual environment:
20+
21+
22+
```
23+
# Create a virtual environment with python 3.10
24+
python3.10 -m venv docs-env
25+
26+
# Activate the virtual environment
27+
# On macOS/Linux:
28+
source docs-env/bin/activate
29+
30+
# On Windows (Command Prompt):
31+
docs-env\Scripts\activate.bat
32+
```
33+
34+
### Install Documentation Dependencies
35+
36+
With your virtual environment activated, install the specific Python packages required to build the documentation. These are listed in `requirements/readthedocs.txt`.
37+
38+
From the root directory of EvalAI, run the installation command:
39+
40+
```
41+
pip install -r requirements/readthedocs.txt
42+
```
43+
44+
### Build the Documentation
45+
Once the dependencies are installed, build the HTML documentation.
46+
47+
Navigate to the docs directory and run the build command:
48+
49+
```
50+
cd docs
51+
make html
52+
```
53+
54+
### View Documentation Locally
55+
After a successful build, you can open the generated HTML files in your web browser.
56+
57+
From the `docs` directory, run the following command:
58+
```
59+
# On macOS:
60+
open build/html/index.html
61+
62+
# On Windows (Command Prompt):
63+
start build\html\index.html
64+
65+
# On Linux (using xdg-open for default browser):
66+
xdg-open build/html/index.html
67+
```
68+
69+
Alternatively, you can always navigate manually:
70+
71+
Just go to `evalai/docs/build/html/` on your file explorer/finder
72+
and double-click `index.html`.
73+
74+
### Live Preview (Recommended)
75+
For a more efficient development workflow, `sphinx-autobuild` automatically rebuilds the documentation and refreshes your web browser whenever you save changes to your documentation source files. This eliminates the need to manually run `make html` and refresh your browser repeatedly.
76+
77+
To start the live preview server, run the following command from the root of the project:
78+
79+
> Note: It's important to run this command from the root directory, NOT inside the `docs` directory.
80+
81+
```
82+
sphinx-autobuild docs/source docs/build/html
83+
```
84+
It will start a local web server, typically at `http://127.0.0.1:8000/`. To stop the live preview server, press `Ctrl+C` in your terminal.
85+
86+
With this, you're ready to start contributing to the docs!
87+
88+
## Troubleshooting
89+
Encountering issues? Don't worry, here are some common problems and their fixes:
90+
91+
- ### Incompatible Python Version:
92+
Many package version errors occur mostly due to a wrong or incompatible python version.
93+
94+
Hence, make sure you're using a dedicated virtual environment with `python >=3.10` (preferable) as mentioned in earlier steps, while contributing to the project.
95+
96+
- ### Sphnix Version Error:
97+
98+
```
99+
Sphinx version error:
100+
The sphinxcontrib.applehelp extension used by this project needs at least Sphinx vX.0; it therefore cannot be built with this version.
101+
make: *** [html] Error 2
102+
```
103+
104+
This usually occurs when you're using the wrong or outdated version of Sphinx.
105+
106+
Make sure you've installed docs dependencies as mentioned in the `requirements/readthedocs.txt`. (See installation steps above).
107+
108+
If the issue still persists, simply run this command:
109+
110+
```
111+
pip install --upgrade sphinx
112+
```
113+
- ### Document not included in toctree:
114+
115+
Sometimes, you'll see a warning message like this while building the docs:
116+
117+
```
118+
WARNING: document isn't included in any toctree: <filename.md>
119+
```
120+
121+
This error usually occurs when Sphinx has found a documentation source file (like a .rst or .md file) that exists, but it hasn't been explicitly listed in any `toctree` directive (e.g., `index.rst`).
122+
123+
It can happen when you've likely created a new `.rst` or `.md` file, but forgot to add its entry to `index.rst` toctree.
124+
To fix this, mention the filename in `index.rst` file at a appropriate place and build again.
125+
126+
- ### Document not displayed in Live Preview:
127+
128+
Newly created sections within docs might not show in the build view.
129+
130+
This problem occurs due to the previous mentioned problem of `"Document not included in toctree"` and can be fixed with the same given solution.

docs/source/conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
"sphinx.ext.viewcode",
4141
"sphinx.ext.githubpages",
4242
"sphinx_markdown_tables",
43+
"recommonmark",
4344
]
4445

4546
# Add any paths that contain templates here, relative to this directory.

docs/source/index.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,10 @@ Contents:
1919
intro
2020
installation
2121
host_challenge
22+
github_based_challenge_setup
2223
configuration
2324
evaluation_scripts
25+
edit_evaluation_script
2426
approve_challenge
2527
participate
2628
make_submission_public_private_baseline

requirements/readthedocs.txt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
1-
sphinx_rtd_theme==0.4.3
2-
sphinx_markdown_tables==0.0.14
1+
recommonmark==0.7.1
2+
sphinx-autobuild==2024.10.3
3+
sphinx-markdown-tables==0.0.17
4+
sphinx-rtd-theme==3.0.2
5+
sphinx==8.1.3

0 commit comments

Comments
 (0)