Skip to content

Commit 6b66a76

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 0d8432b commit 6b66a76

File tree

7 files changed

+1423
-2530
lines changed

7 files changed

+1423
-2530
lines changed

.github/workflows/docs-pages.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,11 @@ jobs:
2727
persist-credentials: false
2828
fetch-depth: 0
2929

30-
- name: Set up Python
31-
uses: actions/setup-python@v6
30+
- name: Install uv
31+
uses: astral-sh/setup-uv@v6
3232
with:
33-
python-version: '3.10'
34-
35-
- name: Set up env
36-
run: make -C docs setupenv
33+
working-directory: docs
34+
enable-cache: true
3735

3836
- name: Build docs
3937
run: make -C docs multiversion

.github/workflows/docs-pr.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,11 @@ jobs:
3333
persist-credentials: false
3434
fetch-depth: 0
3535

36-
- name: Set up Python
37-
uses: actions/setup-python@v6
36+
- name: Install uv
37+
uses: astral-sh/setup-uv@v6
3838
with:
39-
python-version: '3.10'
40-
41-
- name: Set up env
42-
run: make -C docs setupenv
39+
working-directory: docs
40+
enable-cache: true
4341

4442
- name: Build docs
4543
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: 16 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,9 @@
134143
# Dictionary of values to pass into the template engine’s context for all pages
135144
html_context = {'html_baseurl': html_baseurl}
136145

146+
autodoc_mock_imports = [
147+
# Asyncore has been removed from python 3.12, we need to mock it until `cassandra/io/asyncorereactor.py` is dropped
148+
"asyncore",
149+
# Since driver is not built, binary modules also not built, so we need to mock them
150+
"cassandra.io.libevwrapper"
151+
]

0 commit comments

Comments
 (0)