Skip to content

Commit 6e7104a

Browse files
committed
Merge remote-tracking branch 'origin/stes/upgrade-docs-rebased' into aistats2025
2 parents 1f64a12 + f2dd965 commit 6e7104a

File tree

8 files changed

+32
-23
lines changed

8 files changed

+32
-23
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ on:
1010

1111
jobs:
1212
build:
13+
timeout-minutes: 10
1314
strategy:
1415
fail-fast: true
1516
matrix:

.github/workflows/docs.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,10 @@ jobs:
6161
# ref: main
6262
ref: stes/add-xcebra
6363

64-
- name: Set up Python ${{ matrix.python-version }}
64+
- name: Set up Python 3.10
6565
uses: actions/setup-python@v5
6666
with:
67-
python-version: ${{ matrix.python-version }}
67+
python-version: "3.10"
6868

6969
- name: Install package
7070
run: |
@@ -74,20 +74,20 @@ jobs:
7474
# old pandoc version (2.9.). We will hence install the latest version manually.
7575
# previou: sudo apt-get install -y pandoc
7676
# NOTE(stes): Updated to latest version as of 17/04/2025, v3.6.4.
77-
wget https://github.com/jgm/pandoc/releases/download/3.6.4/pandoc-3.6.4-1-amd64.deb
77+
wget -q https://github.com/jgm/pandoc/releases/download/3.6.4/pandoc-3.6.4-1-amd64.deb
7878
sudo dpkg -i pandoc-3.6.4-1-amd64.deb
7979
rm pandoc-3.6.4-1-amd64.deb
8080
pip install -r docs/requirements.txt
8181
8282
- name: Check software versions
8383
run: |
84-
sphinx --version
84+
sphinx-build --version
8585
pandoc --version
8686
8787
- name: Build docs
8888
run: |
8989
ls docs/source/cebra-figures
90-
# later also add the -n option to check for broken links
90+
export SPHINXBUILD="sphinx-build"
9191
export SPHINXOPTS="-W --keep-going -n"
9292
make docs
9393

cebra/models/criterions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ def infonce(
9595
9696
Note:
9797
- The behavior of this function changed beginning in CEBRA 0.3.0.
98-
The InfoNCE implementation is numerically stabilized.
98+
The InfoNCE implementation is numerically stabilized.
9999
"""
100100
with torch.no_grad():
101101
c, _ = neg_dist.max(dim=1, keepdim=True)

docs/Dockerfile

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@ RUN apt-get update && apt-get install -y \
99
COPY docs/requirements.txt .
1010
RUN pip install -r requirements.txt
1111

12-
COPY setup.cfg .
13-
COPY pyproject.toml .
14-
COPY cebra/ .
15-
16-
RUN pip install cebra[docs]
17-
RUN pip uninstall -y cebra
12+
#COPY setup.cfg .
13+
#COPY pyproject.toml .
14+
#COPY cebra/ .

docs/Makefile

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

1311
# Put it first so that "make" without argument is like "make help".
1412
help:
@@ -18,7 +16,7 @@ help:
1816

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

2321
# Build multiple versions
2422
html_versions:

docs/requirements.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,8 @@ sphinxcontrib-htmlhelp==2.1.0
1616
sphinxcontrib-jsmath==1.0.1
1717
sphinxcontrib-qthelp==2.0.0
1818
sphinxcontrib-serializinghtml==2.0.0
19+
20+
literate_dataclasses
21+
# For IPython.sphinxext.ipython_console_highlighting extension
22+
ipython
23+
numpy

docs/source/conf.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,11 @@
2828

2929
import datetime
3030
import os
31+
import pathlib
3132
import sys
3233

3334
sys.path.insert(0, os.path.abspath("."))
3435

35-
import cebra # noqa: E402
36-
3736

3837
def get_years(start_year=2021):
3938
year = datetime.datetime.now().year
@@ -47,8 +46,17 @@ def get_years(start_year=2021):
4746
project = "cebra"
4847
copyright = f"""{get_years(2021)}"""
4948
author = "See AUTHORS.md"
50-
# The full version, including alpha/beta/rc tags
51-
release = cebra.__version__
49+
version_file = pathlib.Path(
50+
__file__).parent.parent.parent / "cebra" / "__init__.py"
51+
assert version_file.exists(), f"Could not find version file: {version_file}"
52+
with version_file.open("r") as f:
53+
for line in f:
54+
if line.startswith("__version__"):
55+
version = line.split("=")[1].strip().strip('"').strip("'")
56+
print("Building docs for version:", version)
57+
break
58+
else:
59+
raise ValueError("Could not find version in __init__.py")
5260

5361
# -- General configuration ---------------------------------------------------
5462

@@ -120,7 +128,7 @@ def get_years(start_year=2021):
120128
autodoc_member_order = "bysource"
121129
autodoc_mock_imports = [
122130
"torch", "nlb_tools", "tqdm", "h5py", "pandas", "matplotlib", "plotly",
123-
"cvxpy", "captum"
131+
"cvxpy", "captum", "joblib", "scikit-learn", "scipy", "requests", "sklearn"
124132
]
125133
# autodoc_typehints = "none"
126134

tools/build_docs.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ docker run -u $(id -u):$(id -g) \
1111
-v /tmp/.cache/fontconfig:/.cache/fontconfig \
1212
-e MPLCONFIGDIR=/tmp/.cache/matplotlib \
1313
-w /app \
14-
--env HOST=0.0.0.0 \
15-
--env PORT=8000 \
14+
--env SPHINXBUILD="sphinx-autobuild" \
15+
--env SPHINXOPTS="-W --keep-going -n --port 8000 --host 0.0.0.0" \
1616
-it cebra-docs \
1717
make docs

0 commit comments

Comments
 (0)