Skip to content

Commit 4abd832

Browse files
committed
chore(rtd): Simplify environment creation
1 parent e337f43 commit 4abd832

File tree

2 files changed

+21
-19
lines changed

2 files changed

+21
-19
lines changed

readthedocs.yml

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,26 +5,22 @@ build:
55
tools:
66
python: latest
77
jobs:
8-
# The *_create_environment and post_install steps replace RTD's virtual environment
8+
# The *create_environment steps replace RTD's virtual environment
99
# steps with uv, a much faster alternative to virtualenv+pip.
10-
pre_create_environment:
10+
create_environment:
1111
# Install jq and uv
1212
- asdf plugin add jq https://github.com/lsanwick/asdf-jq.git
1313
- asdf plugin add uv https://github.com/asdf-community/asdf-uv.git
1414
- asdf install jq latest
1515
- asdf install uv latest
1616
- asdf global jq latest
1717
- asdf global uv latest
18-
# Turn `python -m virtualenv` into `python -c pass`
19-
- truncate --size 0 $( dirname $( uv python find ) )/../lib/python3*/site-packages/virtualenv/__main__.py
20-
post_create_environment:
21-
- uv venv $READTHEDOCS_VIRTUALENV_PATH
22-
# Turn `python -m pip` into `python -c pass`
23-
- truncate --size 0 $( ls -d $READTHEDOCS_VIRTUALENV_PATH/lib/python3* )/site-packages/pip.py
24-
# post_install replaces the top-level {python: {install: [{requirements: requirements.txt}]}}
25-
post_install:
26-
# Use a cache dir in the same mount to halve the install time
27-
- VIRTUAL_ENV=$READTHEDOCS_VIRTUALENV_PATH uv pip install --cache-dir $READTHEDOCS_VIRTUALENV_PATH/../../uv_cache -r requirements.txt
18+
- VIRTUAL_ENV=$READTHEDOCS_VIRTUALENV_PATH uv venv
19+
install:
20+
- >
21+
VIRTUAL_ENV=$READTHEDOCS_VIRTUALENV_PATH
22+
UV_CACHE_DIR=$READTHEDOCS_VIRTUALENV_PATH/../../uv_cache
23+
uv sync --active --locked
2824
# Normal pre-build step to inject schema.json into the source directory
2925
# so schema.json is hosted alongside the specification documents
3026
pre_build:

tools/schemacode/.readthedocs.yaml

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,20 @@
11
version: 2
22

33
build:
4-
os: ubuntu-22.04
4+
os: ubuntu-lts-latest
55
tools:
6-
python: "3.11"
6+
python: latest
7+
jobs:
8+
create_environment:
9+
- asdf plugin add uv https://github.com/asdf-community/asdf-uv.git
10+
- asdf install uv latest
11+
- asdf global uv latest
12+
- VIRTUAL_ENV=$READTHEDOCS_VIRTUALENV_PATH uv venv
13+
install:
14+
- >
15+
VIRTUAL_ENV=$READTHEDOCS_VIRTUALENV_PATH
16+
UV_CACHE_DIR=$READTHEDOCS_VIRTUALENV_PATH/../../uv_cache
17+
uv sync --active --locked --group=doc
718
819
sphinx:
920
configuration: tools/schemacode/docs/conf.py
10-
11-
python:
12-
install:
13-
- requirements: requirements.txt
14-
- requirements: tools/schemacode/docs/requirements.txt

0 commit comments

Comments
 (0)