Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Infra: override RTD build commands #2728

Merged
merged 1 commit into from
Jul 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/render.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
python -m pip install --upgrade pip

- name: 🔧 Render PEPs
run: make pages -j$(nproc)
run: make pages JOBS=$(nproc)

# remove the .doctrees folder when building for deployment as it takes two thirds of disk space
- name: 🔥 Clean up files
Expand Down
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
PYTHON=python3
VENVDIR=.venv
JOBS=8
RENDER_COMMAND=$(VENVDIR)/bin/python3 build.py -j $(JOBS)
OUTPUT_DIR=build
RENDER_COMMAND=$(VENVDIR)/bin/python3 build.py -j $(JOBS) -o $(OUTPUT_DIR)

render: venv
$(RENDER_COMMAND)
Expand Down
8 changes: 7 additions & 1 deletion build.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ def create_parser():
parser.add_argument("-j", "--jobs", type=int, default=1,
help="How many parallel jobs to run (if supported). "
"Integer, default 1.")
parser.add_argument(
"-o",
"--output-dir",
default="build", # synchronise with render.yaml -> deploy step
help="Output directory, relative to root. Default 'build'.",
)
Comment on lines +39 to +44
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kinda out of scope for this PR, but I'm not entirely sure why we're going to all the trouble of manually duplicating the arguments from Sphinx's own build command in the first place, for what appears to be the tiny convenience of typing python build.py instead of python -m sphinx . build for the small subset of users both building locally and not using the Makefile (assuming they remember the bespoke pattern and args to begin with).

The only other thing this file does AFAIK is copy PEP 0 to the root, but the Sphinx extension just does that anyway if not run from build.py by calling the very same function from this file, so it would seem that function should simply be moved into the extension (which would make the latter fully self-contained).


return parser.parse_args()

Expand All @@ -57,7 +63,7 @@ def create_index_file(html_root: Path, builder: str) -> None:

root_directory = Path(".").absolute()
source_directory = root_directory
build_directory = root_directory / "build" # synchronise with deploy-gh-pages.yaml -> deploy step
build_directory = root_directory / args.output_dir
doctree_directory = build_directory / ".doctrees"

# builder configuration
Expand Down
9 changes: 4 additions & 5 deletions readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
version: 2

build:
os: ubuntu-20.04
os: ubuntu-22.04
tools:
python: "3.9"
python: "3.10"

python:
install:
- requirements: requirements.txt
commands:
- make pages JOBS=$(nproc) OUTPUT_DIR=_readthedocs/html

sphinx:
builder: dirhtml
Expand Down