Skip to content

Commit a04a593

Browse files
authored
chore(rtd): Installing virtualenv and deps with uv to speed up builds (#95)
Cuts build time in half.
1 parent dd8a5b3 commit a04a593

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

.readthedocs.yaml

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,18 @@ build:
44
os: ubuntu-lts-latest
55
tools:
66
python: latest
7-
8-
python:
9-
install:
10-
- requirements: docs/requirements.txt
11-
12-
sphinx:
13-
configuration: docs/conf.py
7+
jobs:
8+
pre_create_environment:
9+
- asdf plugin add uv
10+
- asdf install uv latest
11+
- asdf global uv latest
12+
# Turn `python -m virtualenv` into `python -c pass`
13+
- truncate --size 0 $( dirname $( uv python find ) )/../lib/python3*/site-packages/virtualenv/__main__.py
14+
post_create_environment:
15+
- uv venv $READTHEDOCS_VIRTUALENV_PATH
16+
# Turn `python -m pip` into `python -c pass`
17+
- truncate --size 0 $( ls -d $READTHEDOCS_VIRTUALENV_PATH/lib/python3* )/site-packages/pip.py
18+
# Use a cache dir in the same mount to halve the install time
19+
- VIRTUAL_ENV=$READTHEDOCS_VIRTUALENV_PATH uv pip install --cache-dir $READTHEDOCS_VIRTUALENV_PATH/../../uv_cache --upgrade sphinx
20+
post_install:
21+
- VIRTUAL_ENV=$READTHEDOCS_VIRTUALENV_PATH uv pip install --cache-dir $READTHEDOCS_VIRTUALENV_PATH/../../uv_cache -r docs/requirements.txt

0 commit comments

Comments
 (0)