-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Running pip install '.[docs]' on ReadTheDocs
- Loading branch information
Showing
1 changed file
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# Running pip install '.[docs]' on ReadTheDocs | ||
|
||
I decided to use ReadTheDocs for my in-development [datasette-enrichments](https://github.com/datasette/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: | ||
|
||
```python | ||
# ... | ||
extras_require={ | ||
"test": ["pytest", "pytest-asyncio", "black", "cogapp", "ruff"], | ||
"docs": [ | ||
"sphinx==7.2.6", | ||
"furo==2023.9.10", | ||
"sphinx-autobuild", | ||
"sphinx-copybutton", | ||
"myst-parser", | ||
"cogapp", | ||
], | ||
}, | ||
# ... | ||
``` | ||
When I'm working on this project locally I install these dependencies like so: | ||
```bash | ||
pip 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: | ||
|
||
```yaml | ||
version: 2 | ||
|
||
build: | ||
os: ubuntu-22.04 | ||
tools: | ||
python: "3.12" | ||
|
||
sphinx: | ||
configuration: docs/conf.py | ||
|
||
formats: | ||
- epub | ||
|
||
python: | ||
install: | ||
- method: pip | ||
path: . | ||
extra_requirements: | ||
- docs | ||
``` |
04a0013
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Refs: