Skip to content

Commit 73238ba

Browse files
committed
Improve build setup for docs
1 parent b2357fd commit 73238ba

File tree

7 files changed

+86
-9
lines changed

7 files changed

+86
-9
lines changed

.dockerignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@ tests/
55
third_party/
66
tools/
77
PKGBUILD
8+
9+
!docs/requirements.txt

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,15 @@ exports/
88
demo_notebooks/
99
assets/
1010

11+
# demo run
12+
.vscode/
13+
auxiliary_behavior_data.h5
14+
cebra_model.pt
15+
data.npz
16+
grid_search_models/
17+
neural_data.npz
18+
saved_models/
19+
1120
# Binary files
1221
*.png
1322
*.jpg

build_docs.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash
2+
3+
docker build -t cebra-docs -f docs/Dockerfile .
4+
docker run -u $(id -u):$(id -g) \
5+
-p 127.0.0.1:8000:8000 \
6+
-v $(pwd):/app \
7+
-v /tmp/.cache/pip:/.cache/pip \
8+
-v /tmp/.cache/sphinx:/.cache/sphinx \
9+
-v /tmp/.cache/matplotlib:/.cache/matplotlib \
10+
-v /tmp/.cache/fontconfig:/.cache/fontconfig \
11+
-e MPLCONFIGDIR=/tmp/.cache/matplotlib \
12+
-w /app \
13+
--env HOST=0.0.0.0 \
14+
--env PORT=8000 \
15+
-it cebra-docs \
16+
make docs

docs/Dockerfile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
FROM python:3.10
2+
3+
RUN apt-get update && apt-get install -y \
4+
git \
5+
make \
6+
pandoc \
7+
&& rm -rf /var/lib/apt/lists/*
8+
9+
RUN pip install cebra[docs]
10+
RUN pip uninstall -y cebra
11+
12+
COPY docs/requirements.txt .
13+
RUN pip install -r requirements.txt
14+
15+
COPY setup.cfg .
16+
COPY pyproject.toml .
17+
COPY cebra/ .

docs/Makefile

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@
44
# You can set these variables from the command line, and also
55
# from the environment for the first two.
66
SPHINXOPTS ?=
7-
SPHINXBUILD ?= sphinx-build
7+
SPHINXBUILD ?= sphinx-autobuild
88
SOURCEDIR = source
99
BUILDDIR = build
10+
PORT ?= 8000
11+
HOST ?= 127.0.0.1
1012

1113
# Put it first so that "make" without argument is like "make help".
1214
help:
@@ -16,7 +18,7 @@ help:
1618

1719
# Build the API documentation using sphinx
1820
html:
19-
PYTHONPATH=.. $(SPHINXBUILD) -M html "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
21+
PYTHONPATH=.. $(SPHINXBUILD) --port $(PORT) --host $(HOST) -M html "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
2022

2123
# Build multiple versions
2224
html_versions:
@@ -33,12 +35,26 @@ clean:
3335
source/cebra-figures:
3436
git clone --depth 1 [email protected]:AdaptiveMotorControlLab/cebra-figures.git source/cebra-figures
3537

38+
source/demo_notebooks:
39+
git clone --depth 1 [email protected]:AdaptiveMotorControlLab/cebra-demos.git source/demo_notebooks
40+
3641
# Update the figures. Note that this might prompt you for an SSH key
3742
figures: source/cebra-figures
3843
cd source/cebra-figures && git pull --ff-only origin main
3944

45+
demos: source/demo_notebooks
46+
cd source/demo_notebooks && git pull --ff-only origin main
47+
48+
source/assets:
49+
git clone --depth 1 [email protected]:AdaptiveMotorControlLab/cebra-assets.git source/assets
50+
51+
assets: source/assets
52+
cd source/assets && git pull --ff-only origin main
53+
cp -r source/assets/docs/* .
54+
#rm -rf source/assets
55+
4056
# Build the page with pre-built figures
41-
page: source/cebra-figures html
57+
page: source/cebra-figures source/demo_notebooks html
4258
mkdir -p page/
4359
mkdir -p page/docs
4460
mkdir -p page/staging/docs

docs/requirements.txt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
sphinx==7.4.7
2+
nbsphinx==0.9.6
3+
pydata-sphinx-theme==0.16.1
4+
pytest-sphinx==0.6.3
5+
sphinx-autobuild==2024.10.3
6+
sphinx-autodoc-typehints==1.19.0
7+
sphinx-copybutton==0.5.2
8+
sphinx-gallery==0.19.0
9+
sphinx-tabs==3.4.7
10+
sphinx-togglebutton==0.3.2
11+
sphinx_design==0.6.0
12+
sphinx_pydata_theme==0.1.0
13+
sphinxcontrib-applehelp==2.0.0
14+
sphinxcontrib-devhelp==2.0.0
15+
sphinxcontrib-htmlhelp==2.1.0
16+
sphinxcontrib-jsmath==1.0.1
17+
sphinxcontrib-qthelp==2.0.0
18+
sphinxcontrib-serializinghtml==2.0.0

setup.cfg

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,23 +64,22 @@ integrations =
6464
plotly
6565
seaborn
6666
docs =
67-
sphinx==5.3
68-
sphinx-gallery==0.10.1
67+
sphinx
68+
sphinx-gallery
6969
docutils
70-
pydata-sphinx-theme==0.9.0
71-
sphinx_autodoc_typehints==1.19
70+
pydata-sphinx-theme
71+
sphinx_autodoc_typehints
7272
sphinx_copybutton
7373
sphinx_tabs
7474
sphinx_design
7575
sphinx_togglebutton
7676
nbsphinx
7777
nbconvert
7878
ipykernel
79-
matplotlib<=3.5.2
79+
matplotlib
8080
pandas
8181
seaborn
8282
scikit-learn
83-
numpy<2.0.0
8483
demos =
8584
ipykernel
8685
jupyter

0 commit comments

Comments
 (0)