forked from jupyterhub/grafana-dashboards
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request jupyterhub#96 from sgibson91/update-contributing
Add noxfile to automate building the docs and update contributing.md
- Loading branch information
Showing
4 changed files
with
93 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
myst-parser[linkify] | ||
sphinx-book-theme | ||
sphinx-autobuild |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
""" | ||
noxfile.py is a configuration file for the command-line tool nox that automates | ||
tasks in multiple Python environments. We use it to setup an environment to | ||
build our documentation. | ||
Config reference: https://nox.thea.codes/en/stable/config.html#noxfile | ||
Common tasks: | ||
- Install nox: pip install nox | ||
- Start a live reloading docs server: nox -s docs -- live | ||
""" | ||
import nox | ||
|
||
nox.options.reuse_existing_virtualenvs = True | ||
|
||
BUILD_COMMAND = ["-b", "html", "docs", "docs/_build/html"] | ||
|
||
|
||
@nox.session(venv_backend="conda") | ||
def docs(session): | ||
"""Build the documentation. Use `-- live` for a live server to preview changes.""" | ||
session.install("-r", "docs/requirements.txt") | ||
|
||
if "live" in session.posargs: | ||
session.posargs.pop(session.posargs.index("live")) | ||
|
||
# Add folders to ignore | ||
AUTOBUILD_IGNORE = [ | ||
"_build", | ||
"tmp", | ||
] | ||
|
||
cmd = ["sphinx-autobuild"] | ||
for folder in AUTOBUILD_IGNORE: | ||
cmd.extend(["--ignore", f"*/{folder}/*"]) | ||
|
||
# Find an open port to serve on | ||
cmd.extend(["--port", "0"]) | ||
|
||
else: | ||
cmd = ["sphinx-build"] | ||
|
||
cmd.extend(BUILD_COMMAND + session.posargs) | ||
session.run(*cmd) |