Skip to content

Commit

Permalink
Fix ReadTheDocs (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
bollwyvl authored May 13, 2024
1 parent 0640e55 commit 2bad8df
Show file tree
Hide file tree
Showing 9 changed files with 280 additions and 83 deletions.
1 change: 1 addition & 0 deletions _scripts/fake-docs/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""A fake configuration for sphinx."""
4 changes: 4 additions & 0 deletions _scripts/fake-docs/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Not Docs
========

This exists for ReadTheDocs to build, and is replaced with the real docs.
35 changes: 35 additions & 0 deletions docs/.readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
version: 2

build:
os: ubuntu-22.04
apt_packages:
- libasound2
- libatk1.0-0
- libcups2
- libdbus-glib-1-2
- libgtk-3-0
- libnss3
- libpangocairo-1.0-0
- libx11-xcb1
- libxcomposite1
- libxcursor1
- libxdamage1
- libxi6
- libxrandr2
- libxss1
- libxtst6
tools:
python: mambaforge-latest
jobs:
pre_build:
- pixi install --environment=rtd
- pixi run --environment=rtd build
- pixi run --environment=rtd docs-lite
- pixi run --environment=rtd docs-sphinx
post_build:
- pixi run --environment=rtd fake-docs-post-build
sphinx:
builder: html
configuration: _scripts/fake-docs/conf.py
conda:
environment: docs/environment.yml
10 changes: 0 additions & 10 deletions docs/.readthedocs.yml

This file was deleted.

5 changes: 5 additions & 0 deletions docs/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
channels:
- conda-forge
- nodefaults
dependencies:
- pixi ==0.21.1
276 changes: 210 additions & 66 deletions pixi.lock

Large diffs are not rendered by default.

28 changes: 23 additions & 5 deletions pixi.toml
Original file line number Diff line number Diff line change
Expand Up @@ -208,17 +208,22 @@ outputs = ["build/docs/.buildinfo"]
cwd = "docs"
cmd = """
export PYDEVD_DISABLE_FILE_VALIDATION=1
&& sphinx-build -W --color -b html . ../build/docs"""
&& sphinx-build -W --keep-going --color -b html . ../build/docs"""

[feature.demo.tasks.lab]
depends-on = ["pip"]
cmd = "jupyter lab --no-browser --debug"

[feature.docs.tasks.readthedocs]
depends-on = ["build", "docs-lite"]
[feature.rtd.tasks.fake-docs-build]
cmd = """
export PYDEVD_DISABLE_FILE_VALIDATION=1
&& sphinx-build -W --color -b html docs $READTHEDOCS_OUTPUT/html
rm -rf build/fake-docs
&& python -m sphinx -W --keep-going --color -b html ./_scripts/fake-docs ./build/fake-docs
"""

[feature.rtd.tasks.fake-docs-post-build]
cmd = """
rm -rf $READTHEDOCS_OUTPUT/html
&& cp -r build/docs $READTHEDOCS_OUTPUT/html
"""

### environments for tasks
Expand All @@ -244,6 +249,16 @@ docs = {features = [
"run",
"webdriver",
], solve-group = "default"}
rtd = {features = [
"build",
"demo",
"dev",
"docs",
"firefox-oldest",
"run",
"webdriver",
"rtd",
], solve-group = "default"}
test-oldest = {features = [
"dev",
"firefox-oldest",
Expand Down Expand Up @@ -319,3 +334,6 @@ importnb = "*"
[feature.demo.dependencies]
ipywidgets = ">=8.1,<8.2"
jupyterlab = ">=4.1,<4.2"

[feature.rtd]
platforms = ["linux-64"]
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ extend-include = [
"*.ipynb",
]
include = [
"_scripts/*.*",
"_scripts/*.py",
"contrib/*/src/**/*.py",
"contrib/*/tests/**/*.py",
"docs/**/*.py",
Expand Down
2 changes: 1 addition & 1 deletion tests/test_repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

PIXI_PATTERNS = {
".github/workflows/*.yml": r"JLPL_PIXI_VERSION: ([^\s]+)",
"docs/.readthedocs.yml": r"pixi==([^\s]+)",
"docs/environment.yml": r"pixi ==([^\s]+)",
"CONTRIBUTING.md": r"pixi==([^\s]+)",
}

Expand Down

0 comments on commit 2bad8df

Please sign in to comment.