Skip to content

Commit 19ad87c

Browse files
committed
sys.path.insert() the src/ path per conf.py
i.e. so you don't have to explicitly install things to build docs
1 parent cf56f46 commit 19ad87c

File tree

9 files changed

+22
-25
lines changed

9 files changed

+22
-25
lines changed

.circleci/config.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
name: build docs
2020
no_output_timeout: 25m
2121
command: |
22-
pip install .[doc]
22+
pip install -r doc-requirements.txt
2323
make spec
2424
- store_artifacts:
2525
path: _site/

.github/workflows/pages.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ jobs:
7676
# Install dependencies:
7777
- name: 'Install dependencies'
7878
run: |
79-
pip install .[doc]
79+
pip install -r doc-requirements.txt
8080
8181
# Generate the documentation:
8282
- name: 'Build documentation'

Makefile

+1-4
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,10 @@ SPHINXOPTS ?= -W --keep-going
33
SOURCEDIR = spec
44
BUILDDIR = _site
55

6-
.PHONY: default install clean draft spec
6+
.PHONY: default clean draft spec
77

88
default: clean spec
99

10-
install:
11-
pip install -e .[doc]
12-
1310
clean:
1411
rm -rf $(BUILDDIR)
1512
find . -type d -name generated -exec rm -rf {} +

README.md

+6-8
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ this array API standard.
2121
### Quickstart
2222

2323
To install the local stubs and additional dependencies of the Sphinx docs, you
24-
can use `make install`. Then just running `make` at the root of the repository
25-
should build the whole spec website.
24+
can use `pip install -r doc-requirements.txt`. Then just running `make` at the
25+
root of the repository should build the whole spec website.
2626

2727
```sh
28-
$ make install
28+
$ pip install -r doc-requirements.txt
2929
$ make
3030
$ ls _site/
3131
2021.12/ draft/ index.html latest/ versions.json
@@ -35,11 +35,9 @@ $ ls _site/
3535

3636
The spec website is comprised of multiple Sphinx docs (one for each spec version),
3737
all of which exist in `spec/` and rely on the modules found in `src/` (most
38-
notably `array_api_stubs`). `make install` aliases
39-
40-
```sh
41-
$ pip install -e .[doc] # ensure you install the dependencies extra "doc"
42-
```
38+
notably `array_api_stubs`). For purposes of building the docs, these `src/`
39+
modules do not need to be installed as they are added to the `sys.path` at
40+
runtime.
4341

4442
To build specific versions of the spec, run `sphinx-build` on the respective
4543
folder in `spec/`, e.g.

doc-requirements.txt

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
sphinx==4.3.0
2+
sphinx-material==0.0.30
3+
myst-parser
4+
sphinx_markdown_tables
5+
sphinx_copybutton
6+
docutils<0.18
7+
sphinx-math-dollar

pyproject.toml

-11
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,6 @@ Source = "https://github.com/data-apis/array-api/"
1414
Documentation = "https://data-apis.org/array-api/"
1515
Homepage = "https://data-apis.org/"
1616

17-
[project.optional-dependencies]
18-
doc = [
19-
"sphinx==4.3.0",
20-
"sphinx-material==0.0.30",
21-
"myst-parser",
22-
"sphinx_markdown_tables",
23-
"sphinx_copybutton",
24-
"docutils<0.18",
25-
"sphinx-math-dollar",
26-
]
27-
2817
[build-system]
2918
requires = ["setuptools"]
3019
build-backend = "setuptools.build_meta"

spec/2021.12/conf.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import sys
2+
from pathlib import Path
3+
sys.path.insert(0, str(Path(__file__).parents[2] / "src"))
24

35
from array_api_stubs import _2021_12 as stubs_mod
46
from _array_api_conf import *

spec/2022.12/conf.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import sys
2+
from pathlib import Path
3+
sys.path.insert(0, str(Path(__file__).parents[2] / "src"))
24

35
from array_api_stubs import _2022_12 as stubs_mod
46
from _array_api_conf import *

spec/draft/conf.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import sys
2+
from pathlib import Path
3+
sys.path.insert(0, str(Path(__file__).parents[2] / "src"))
24

35
from array_api_stubs import _draft as stubs_mod
46
from _array_api_conf import *

0 commit comments

Comments
 (0)