Skip to content

Commit

Permalink
Fix RTD (#435)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gallaecio authored Nov 30, 2023
1 parent 41c4b1a commit 0f3087f
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 25 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ jobs:
- python-version: 3
env:
TOXENV: flake8
- python-version: "3.11"
env:
TOXENV: docs

steps:
- uses: actions/checkout@v2
Expand Down
17 changes: 17 additions & 0 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
version: 2
formats: all
sphinx:
configuration: docs/conf.py
fail_on_warning: true

build:
os: ubuntu-20.04
tools:
# For available versions, see:
# https://docs.readthedocs.io/en/stable/config-file/v2.html#build-tools-python
python: "3.11" # Keep in sync with .github/workflows/checks.yml

python:
install:
- requirements: docs/requirements.txt
- path: .
25 changes: 2 additions & 23 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None
language = "en"

# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
Expand Down Expand Up @@ -114,7 +114,7 @@

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
html_theme = 'default'
html_theme = "sphinx_rtd_theme"

# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
Expand Down Expand Up @@ -288,24 +288,3 @@

# If true, do not generate a @detailmenu in the "Top" node's menu.
# texinfo_no_detailmenu = False


# Following is taken from https://github.com/snide/sphinx_rtd_theme#
# using-this-theme-locally-then-building-on-read-the-docs

# on_rtd is whether we are on readthedocs.org,
# this line of code grabbed from docs.readthedocs.org
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'

if not on_rtd: # only import and set the theme if we're building docs locally
import sphinx_rtd_theme
html_theme = 'sphinx_rtd_theme'
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]

# otherwise, readthedocs.org uses their theme by default, no need to specify it


# Wrap text in tables
# https://github.com/snide/sphinx_rtd_theme/issues/117#issuecomment-41571653
def setup(app):
app.add_css_file("theme_overrides.css")
4 changes: 2 additions & 2 deletions docs/custom-images-contract.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ Contract statements
1. Docker image should be able to run via ``start-crawl`` command without arguments.
``start-crawl`` should be :ref:`executable and located on the search path <scripts-example>`.

.. code-block:: bash
.. code-block:: bash
docker run myscrapyimage start-crawl
docker run myscrapyimage start-crawl
Crawler will be started by unpriviledged user ``nobody`` in a writable directory ``/scrapinghub``.
``HOME`` environment variable will be set to ``/scrapinghub`` as well. Beware that this directory is added
Expand Down
2 changes: 2 additions & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
sphinx==7.2.6
sphinx-rtd-theme==2.0.0
7 changes: 7 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,10 @@ deps =
flake8>=3.7.9
commands =
flake8 --exclude=.git,.tox,venv* {posargs:shub tests}

[testenv:docs]
changedir = docs
deps =
-rdocs/requirements.txt
commands =
sphinx-build -W -b html . {envtmpdir}/html

0 comments on commit 0f3087f

Please sign in to comment.