Newsletter
TechAnV Blog
Get updates on security engineering, Rust, eBPF, and DevSecOps. No spam, unsubscribe anytime.
Check your inbox and click the confirmation link to complete your subscription.
Running pip install ’.[docs]’ on ReadTheDocs#
I decided to use ReadTheDocs for my in-development datasette-enrichments project.
Previously when I’ve used ReadTheDocs I’ve had a docs/ folder in my project with its own docs/requirements.txt file containing the requirements.
For this project I decided to try putting my documentation dependencies in a setup.py file (which I will likely upgrade to pyproject.toml in the future) like this:
1 # ...2 extras_require={3 "test": ["pytest", "pytest-asyncio", "black", "cogapp", "ruff"],4 "docs": [5 "sphinx==7.2.6",6 "furo==2023.9.10",7 "sphinx-autobuild",8 "sphinx-copybutton",9 "myst-parser",10 "cogapp",11 ],12 },13 # ...When I’m working on this project locally I install these dependencies like so:
1pip install -e '.[docs]'It took me a few iterations to figure it out, so here’s how to run that same command on ReadTheDocs using the .readthedocs.yaml configuration file:
1version: 22
3build:4 os: ubuntu-22.045 tools:6 python: "3.12"7
8sphinx:9 configuration: docs/conf.py10
11formats:12- pdf13- epub14
15python:16 install:17 - method: pip18 path: .19 extra_requirements:20 - docs