Skip to content

Commit 688b347

Browse files
authored
Use ReadTheDocs theme for GitHub Pages documentation - instruction for ReadTheDocs
Use ReadTheDocs theme for GitHub Pages documentation
2 parents 5c1fee3 + 1da0f1b commit 688b347

5 files changed

Lines changed: 63 additions & 7 deletions

File tree

.github/workflows/docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
- name: Install dependencies
4040
run: |
4141
python -m pip install --upgrade pip
42-
pip install sphinx sphinx-autodoc-typehints
42+
pip install sphinx sphinx-autodoc-typehints sphinx_rtd_theme
4343
pip install -e .
4444
4545
- name: Build documentation

.readthedocs.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@
44
# Required
55
version: 2
66

7+
# Set the OS, Python version, and other tools you might need
8+
build:
9+
os: ubuntu-22.04
10+
tools:
11+
python: "3.10"
12+
713
# Build documentation in the docs/ directory with Sphinx
814
sphinx:
915
configuration: docs/conf.py
@@ -17,7 +23,7 @@ formats:
1723
- pdf
1824

1925
python:
20-
version: 3.8
2126
install:
2227
- requirements: docs/requirements.txt
23-
- {path: ., method: pip}
28+
- method: pip
29+
path: .

CONTRIBUTING.rst

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,56 @@ on PyPI_, the following steps can be used to release a new version for
232232
uploaded to PyPI_ correctly.
233233

234234

235+
Deploying Documentation to ReadTheDocs
236+
--------------------------------------
237+
238+
This project is configured to work with `Read the Docs`_ for automatic
239+
documentation hosting. To deploy the documentation to ReadTheDocs.io, follow
240+
these steps:
241+
242+
#. **Create a Read the Docs account**: Go to `readthedocs.org`_ and create an
243+
account (you can sign up using your GitHub account).
244+
245+
#. **Import your project**: After logging in, click on "Import a Project" and
246+
select the ``XAI-Lib`` repository from your GitHub account. If you don't see
247+
it, you may need to refresh your repository list or manually enter the
248+
repository URL.
249+
250+
#. **Configure the project**: Read the Docs will automatically detect the
251+
``.readthedocs.yml`` configuration file in the repository root. The
252+
configuration specifies:
253+
254+
- Python version: 3.10
255+
- Documentation builder: Sphinx
256+
- Configuration file location: ``docs/conf.py``
257+
- Additional formats: PDF
258+
259+
#. **Build the documentation**: Once imported, Read the Docs will automatically
260+
build the documentation. You can trigger manual builds from the project
261+
dashboard.
262+
263+
#. **Enable automatic builds**: By default, Read the Docs will build the
264+
documentation on every push to the main branch. You can also configure
265+
webhook integration for pull request previews.
266+
267+
#. **Access your documentation**: After a successful build, your documentation
268+
will be available at ``https://xai-lib.readthedocs.io/`` (or a similar URL
269+
based on your project name).
270+
271+
Additional configuration options include:
272+
273+
- **Versioning**: Read the Docs can build documentation for multiple versions
274+
(branches/tags) of your project.
275+
- **Custom domains**: You can configure a custom domain for your documentation.
276+
- **Notifications**: Set up build notifications for failures.
277+
278+
For more information, see the `Read the Docs documentation`_.
279+
280+
.. _Read the Docs: https://readthedocs.org/
281+
.. _readthedocs.org: https://readthedocs.org/
282+
.. _Read the Docs documentation: https://docs.readthedocs.io/en/stable/
283+
284+
235285

236286
.. [#contrib1] Even though, these resources focus on open source projects and
237287
communities, the general ideas behind collaborating with other developers

docs/conf.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,14 +153,14 @@
153153

154154
# The theme to use for HTML and HTML Help pages. See the documentation for
155155
# a list of builtin themes.
156-
html_theme = "alabaster"
156+
html_theme = "sphinx_rtd_theme"
157157

158158
# Theme options are theme-specific and customize the look and feel of a theme
159159
# further. For a list of options available for each theme, see the
160160
# documentation.
161161
html_theme_options = {
162-
"sidebar_width": "300px",
163-
"page_width": "1200px"
162+
"navigation_depth": 4,
163+
"collapse_navigation": False,
164164
}
165165

166166
# Add any paths that contain custom themes here, relative to this directory.

docs/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
# under `install_requires` in `setup.cfg` is also listed here!
44
sphinx>=3.2.1
55
sphinx-autodoc-typehints>=1.12.0
6-
# sphinx_rtd_theme
6+
sphinx_rtd_theme

0 commit comments

Comments
 (0)