Skip to content

Commit aa789a6

Browse files
committed
docs: switch from poetry to uv
uv provides better user experience. As result of switching form poetry to uv environment preparation became seamless, to the point that `setup` step could have been completely dropped.
1 parent 056f26c commit aa789a6

File tree

7 files changed

+1388
-2012
lines changed

7 files changed

+1388
-2012
lines changed

.github/workflows/docs-pages.yml

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -23,23 +23,11 @@ jobs:
2323
persist-credentials: false
2424
fetch-depth: 0
2525

26-
- uses: actions/cache@v4
27-
# actions/setup-python poetry cache feature requires poetry to be installed beforehand
28-
# which makes use of it extremely awkward.
26+
- name: Install uv
27+
uses: astral-sh/setup-uv@v6
2928
with:
30-
path: |
31-
/home/runner/.cache/pip
32-
/home/runner/.cache/pypoetry
33-
# python and poetry version are in docs/pyproject.toml
34-
key: docs-cache-${{ runner.os }}-${{ hashFiles('docs/pyproject.toml', 'docs/Makefile') }}
35-
36-
- name: Set up Python
37-
uses: actions/setup-python@v6
38-
with:
39-
python-version-file: docs/pyproject.toml
40-
41-
- name: Set up env
42-
run: make -C docs setupenv
29+
working-directory: docs
30+
enable-cache: true
4331

4432
- name: Build docs
4533
run: make -C docs multiversion

.github/workflows/docs-pr.yml

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -25,23 +25,11 @@ jobs:
2525
persist-credentials: false
2626
fetch-depth: 0
2727

28-
- uses: actions/cache@v4
29-
# actions/setup-python poetry cache feature requires poetry to be installed beforehand
30-
# which makes use of it extremely awkward.
28+
- name: Install uv
29+
uses: astral-sh/setup-uv@v6
3130
with:
32-
path: |
33-
/home/runner/.cache/pip
34-
/home/runner/.cache/pypoetry
35-
# python and poetry version are in docs/pyproject.toml
36-
key: docs-cache-${{ runner.os }}-${{ hashFiles('docs/pyproject.toml', 'docs/Makefile') }}
37-
38-
- name: Set up Python
39-
uses: actions/setup-python@v6
40-
with:
41-
python-version-file: docs/pyproject.toml
42-
43-
- name: Set up env
44-
run: make -C docs setupenv
31+
working-directory: docs
32+
enable-cache: true
4533

4634
- name: Build docs
4735
run: make -C docs test

docs/Makefile

Lines changed: 20 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
# Global variables
22
# You can set these variables from the command line.
3-
POETRY = poetry
3+
SHELL = bash
4+
UV = uv
45
SPHINXOPTS = -j auto
5-
SPHINXBUILD = $(POETRY) run sphinx-build
6+
SPHINXBUILD = $(UV) run --frozen sphinx-build
67
PAPER =
78
BUILDDIR = _build
89
SOURCEDIR = .
@@ -17,18 +18,13 @@ TESTSPHINXOPTS = $(ALLSPHINXOPTS) -W --keep-going
1718
all: dirhtml
1819

1920
# Setup commands
20-
.PHONY: setupenv
21-
setupenv:
22-
pip install -q poetry
23-
sudo apt-get install gcc python3-dev libev4 libev-dev
24-
25-
.PHONY: setup
26-
setup:
27-
$(POETRY) install
21+
#.PHONY: setupenv
22+
#setupenv:
23+
# uv pip install -r <(uv pip compile pyproject.toml)
2824

2925
.PHONY: update
3026
update:
31-
$(POETRY) update
27+
$(UV) update
3228

3329
# Clean commands
3430
.PHONY: pristine
@@ -41,58 +37,58 @@ clean:
4137

4238
# Generate output commands
4339
.PHONY: dirhtml
44-
dirhtml: setup
40+
dirhtml:
4541
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
4642
@echo
4743
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
4844

4945
.PHONY: singlehtml
50-
singlehtml: setup
46+
singlehtml:
5147
$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
5248
@echo
5349
@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
5450

5551
.PHONY: epub
56-
epub: setup
52+
epub:
5753
$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
5854
@echo
5955
@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
6056

6157
.PHONY: epub3
62-
epub3: setup
58+
epub3:
6359
$(SPHINXBUILD) -b epub3 $(ALLSPHINXOPTS) $(BUILDDIR)/epub3
6460
@echo
6561
@echo "Build finished. The epub3 file is in $(BUILDDIR)/epub3."
6662

6763
.PHONY: multiversion
68-
multiversion: setup
69-
$(POETRY) run sphinx-multiversion $(SOURCEDIR) $(BUILDDIR)/dirhtml
64+
multiversion:
65+
$(UV) run --frozen sphinx-multiversion $(SOURCEDIR) $(BUILDDIR)/dirhtml
7066
@echo
7167
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
7268

7369
.PHONY: redirects
74-
redirects: setup
75-
$(POETRY) run redirects-cli fromfile --yaml-file _utils/redirects.yaml --output-dir $(BUILDDIR)/dirhtml
70+
redirects:
71+
$(UV) run --frozen redirects-cli fromfile --yaml-file _utils/redirects.yaml --output-dir $(BUILDDIR)/dirhtml
7672
@echo
7773
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
7874

7975
# Preview commands
8076
.PHONY: preview
81-
preview: setup
82-
$(POETRY) run sphinx-autobuild -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml --port 5500
77+
preview:
78+
$(UV) run --frozen sphinx-autobuild -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml --port 5500
8379

8480
.PHONY: multiversionpreview
8581
multiversionpreview: multiversion
86-
$(POETRY) run python -m http.server 5500 --directory $(BUILDDIR)/dirhtml
82+
$(UV) run --frozen python -m http.server 5500 --directory $(BUILDDIR)/dirhtml
8783

8884
# Test commands
8985
.PHONY: test
90-
test: setup
86+
test:
9187
$(SPHINXBUILD) -b dirhtml $(TESTSPHINXOPTS) $(BUILDDIR)/dirhtml
9288
@echo
9389
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
9490

9591
.PHONY: linkcheck
96-
linkcheck: setup
92+
linkcheck:
9793
$(SPHINXBUILD) -b linkcheck $(SOURCEDIR) $(BUILDDIR)/linkcheck
9894

docs/conf.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,16 @@
6565

6666
# List of patterns, relative to source directory, that match files and
6767
# directories to ignore when looking for source files.
68-
exclude_patterns = ['_build']
68+
exclude_patterns = [
69+
"_build",
70+
"Thumbs.db",
71+
".DS_Store",
72+
".venv",
73+
".venv/**",
74+
"**/site-packages/**",
75+
"**/*.dist-info/**",
76+
"**/licenses/**",
77+
]
6978

7079
# The name of the Pygments (syntax highlighting) style to use.
7180
pygments_style = 'sphinx'
@@ -134,3 +143,5 @@
134143
# Dictionary of values to pass into the template engine’s context for all pages
135144
html_context = {'html_baseurl': html_baseurl}
136145

146+
# Asyncore has been removed from python 3.12, we need to mock it until `cassandra/io/asyncorereactor.py` is dropped
147+
autodoc_mock_imports = ["asyncore"]

0 commit comments

Comments
 (0)