Skip to content

Commit c34de45

Browse files
coroalengauericholscherhumitos
authored
More concise uv example with docs (#12064)
As a follow up to #11946 (updating the uv example to rely on uv's project management capabilities) , I added here a few paragraphs on what the new `uv` example achieves. I hope that makes it acceptable for integration @ericholscher . @lengau , it would be appreciated if you could review, that this matches your expectation as well. Thank you <!-- readthedocs-preview docs start --> --- :books: Documentation previews :books: - User's documentation (`docs`): https://docs--12064.org.readthedocs.build/12064/ <!-- readthedocs-preview docs end --> <!-- readthedocs-preview dev start --> - Developer's documentation (`dev`): https://dev--12064.org.readthedocs.build/12064/ <!-- readthedocs-preview dev end --> --------- Co-authored-by: Alex Lowe <[email protected]> Co-authored-by: Eric Holscher <[email protected]> Co-authored-by: Manuel Kaufmann <[email protected]> Co-authored-by: Eric Holscher <[email protected]>
1 parent 069abda commit c34de45

File tree

1 file changed

+19
-11
lines changed

1 file changed

+19
-11
lines changed

docs/user/build-customization.rst

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -450,33 +450,41 @@ Take a look at the following example:
450450
Install dependencies with ``uv``
451451
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
452452

453-
Projects can use `uv <https://github.com/astral-sh/uv/>`__,
454-
to install Python dependencies, usually reducing the time taken to install compared to pip.
455-
Take a look at the following example:
453+
Projects managed with `uv <https://github.com/astral-sh/uv/>`__ can install `uv` with asdf,
454+
and then rely on it to set up the environment and install the python project and its dependencies.
455+
Read the Docs' own build steps expect it by setting the ``UV_PROJECT_ENVIRONMENT`` variable,
456+
usually reducing the time taken to install compared to pip.
457+
458+
The following examples assumes a uv project as described in its
459+
`projects concept <https://docs.astral.sh/uv/concepts/projects/>`__. As an introduction
460+
refer to its `Working on projects guide <https://docs.astral.sh/uv/guides/projects/>`__.
461+
The ``docs`` dependency group which should is pulled in during the ``uv sync`` step (if additional
462+
extras are required they can be added with the `--extra attribute <https://docs.astral.sh/uv/concepts/projects/sync/#syncing-optional-dependencies>`__).
456463

464+
If a ``uv.lock`` file exists it is respected.
457465

458466
.. code-block:: yaml
467+
459468
:caption: .readthedocs.yaml
460469
461470
version: 2
462471
472+
sphinx:
473+
configuration: docs/conf.py
474+
463475
build:
464476
os: ubuntu-24.04
465477
tools:
466478
python: "3.13"
467479
jobs:
468-
create_environment:
480+
pre_create_environment:
469481
- asdf plugin add uv
470482
- asdf install uv latest
471483
- asdf global uv latest
472-
- uv venv
484+
create_environment:
485+
- uv venv "${READTHEDOCS_VIRTUALENV_PATH}"
473486
install:
474-
- uv pip install -r requirements.txt
475-
build:
476-
html:
477-
- uv run sphinx-build -T -b html docs $READTHEDOCS_OUTPUT/html
478-
479-
MkDocs projects could use ``NO_COLOR=1 uv run mkdocs build --strict --site-dir $READTHEDOCS_OUTPUT/html`` instead.
487+
- UV_PROJECT_ENVIRONMENT="${READTHEDOCS_VIRTUALENV_PATH}" uv sync --frozen --group docs
480488
481489
Update Conda version
482490
~~~~~~~~~~~~~~~~~~~~

0 commit comments

Comments
 (0)