Skip to content

Commit 9c9902b

Browse files
author
Steven Silvester
authored
Merge pull request #166 from jtpio/sphinx
Add Sphinx Docs
2 parents 70f48ae + 70819f5 commit 9c9902b

File tree

9 files changed

+217
-0
lines changed

9 files changed

+217
-0
lines changed

.github/workflows/test.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,3 +145,45 @@ jobs:
145145
- name: Coverage
146146
run: |
147147
codecov
148+
149+
docs:
150+
runs-on: ubuntu-20.04
151+
timeout-minutes: 2
152+
defaults:
153+
run:
154+
shell: bash -l {0}
155+
steps:
156+
- uses: actions/checkout@v2
157+
- name: Setup conda
158+
uses: conda-incubator/setup-miniconda@v2
159+
with:
160+
auto-update-conda: true
161+
activate-environment: jupyter_releaser_documentation
162+
environment-file: docs/environment.yml
163+
python-version: "3.9"
164+
auto-activate-base: false
165+
- name: Get pip cache dir
166+
id: pip-cache
167+
run: |
168+
echo "::set-output name=dir::$(pip cache dir)"
169+
- name: Cache pip
170+
uses: actions/cache@v2
171+
with:
172+
path: ${{ steps.pip-cache.outputs.dir }}
173+
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('setup.cfg') }}
174+
restore-keys: |
175+
${{ runner.os }}-pip-${{ matrix.python-version }}-
176+
${{ runner.os }}-pip-
177+
- name: Cache conda
178+
uses: actions/cache@v2
179+
with:
180+
path: ~/conda_pkgs_dir
181+
key: ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{
182+
hashFiles('docs/environment.yml') }}
183+
- name: Build docs
184+
run: |
185+
set -eux
186+
pip install .
187+
pushd docs
188+
make html
189+
popd

MANIFEST.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
include *.md
22
include LICENSE
33
prune media
4+
prune docs
5+
exclude readthedocs.yml
46
include jupyter_releaser/schema.json

docs/Makefile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Minimal makefile for Sphinx documentation
2+
#
3+
4+
# You can set these variables from the command line, and also
5+
# from the environment for the first two.
6+
SPHINXOPTS ?=
7+
SPHINXBUILD ?= sphinx-build
8+
SOURCEDIR = source
9+
BUILDDIR = build
10+
11+
# Put it first so that "make" without argument is like "make help".
12+
help:
13+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14+
15+
.PHONY: help Makefile
16+
17+
# Catch-all target: route all unknown targets to Sphinx using the new
18+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19+
%: Makefile
20+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

docs/environment.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
name: jupyter_releaser_documentation
2+
channels:
3+
- conda-forge
4+
dependencies:
5+
- python=3.9
6+
- sphinx
7+
- sphinx-copybutton
8+
- pip
9+
- myst-parser
10+
- pip:
11+
- pydata_sphinx_theme

docs/make.bat

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
@ECHO OFF
2+
3+
pushd %~dp0
4+
5+
REM Command file for Sphinx documentation
6+
7+
if "%SPHINXBUILD%" == "" (
8+
set SPHINXBUILD=sphinx-build
9+
)
10+
set SOURCEDIR=source
11+
set BUILDDIR=build
12+
13+
if "%1" == "" goto help
14+
15+
%SPHINXBUILD% >NUL 2>NUL
16+
if errorlevel 9009 (
17+
echo.
18+
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
19+
echo.installed, then set the SPHINXBUILD environment variable to point
20+
echo.to the full path of the 'sphinx-build' executable. Alternatively you
21+
echo.may add the Sphinx directory to PATH.
22+
echo.
23+
echo.If you don't have Sphinx installed, grab it from
24+
echo.https://www.sphinx-doc.org/
25+
exit /b 1
26+
)
27+
28+
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
29+
goto end
30+
31+
:help
32+
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
33+
34+
:end
35+
popd

docs/source/conf.py

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# Configuration file for the Sphinx documentation builder.
2+
#
3+
# This file only contains a selection of the most common options. For a full
4+
# list see the documentation:
5+
# https://www.sphinx-doc.org/en/master/usage/configuration.html
6+
# -- Path setup --------------------------------------------------------------
7+
# If extensions (or modules to document with autodoc) are in another directory,
8+
# add these directories to sys.path here. If the directory is relative to the
9+
# documentation root, use os.path.abspath to make it absolute, like shown here.
10+
#
11+
# import os
12+
# import sys
13+
# sys.path.insert(0, os.path.abspath('.'))
14+
import os.path as osp
15+
import shutil
16+
17+
HERE = osp.abspath(osp.dirname(__file__))
18+
19+
# -- Project information -----------------------------------------------------
20+
21+
project = "Jupyter Releaser"
22+
copyright = "2021, Project Jupyter"
23+
author = "Project Jupyter"
24+
25+
# The full version, including alpha/beta/rc tags.
26+
release = "0.7.4"
27+
# The short X.Y version.
28+
version = ".".join(release.split(".")[:2])
29+
30+
# -- General configuration ---------------------------------------------------
31+
32+
# Add any Sphinx extension module names here, as strings. They can be
33+
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
34+
# ones.
35+
extensions = ["myst_parser"]
36+
37+
myst_enable_extensions = ["html_image"]
38+
39+
# Add any paths that contain templates here, relative to this directory.
40+
templates_path = ["_templates"]
41+
42+
# List of patterns, relative to source directory, that match files and
43+
# directories to ignore when looking for source files.
44+
# This pattern also affects html_static_path and html_extra_path.
45+
exclude_patterns = []
46+
47+
48+
# -- Options for HTML output -------------------------------------------------
49+
50+
# The theme to use for HTML and HTML Help pages. See the documentation for
51+
# a list of builtin themes.
52+
#
53+
html_theme = "pydata_sphinx_theme"
54+
55+
# Add any paths that contain custom static files (such as style sheets) here,
56+
# relative to this directory. They are copied after the builtin static files,
57+
# so a file named "default.css" will overwrite the builtin "default.css".
58+
html_static_path = ["_static"]
59+
60+
# Add an Edit this Page button
61+
html_theme_options = {
62+
"use_edit_page_button": True,
63+
}
64+
65+
# Output for github to be used in links
66+
html_context = {
67+
"github_user": "jupyterlab", # Username
68+
"github_repo": "jupyterlab_server", # Repo name
69+
"github_version": "master", # Version
70+
"doc_path": "/docs/source/", # Path in the checkout to the docs root
71+
}
72+
73+
74+
def setup(app):
75+
dest = osp.join(HERE, "changelog.md")
76+
shutil.copy(osp.join(HERE, "..", "..", "CHANGELOG.md"), dest)

docs/source/index.rst

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
Welcome to Jupyter Releaser's documentation!
2+
============================================
3+
4+
.. toctree::
5+
:maxdepth: 2
6+
:caption: Contents:
7+
8+
changelog
9+
10+
11+
12+
Indices and tables
13+
==================
14+
15+
* :ref:`genindex`
16+
* :ref:`modindex`
17+
* :ref:`search`

pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ tag_template = "v{new_version}"
1919
[[tool.tbump.file]]
2020
src = "jupyter_releaser/__init__.py"
2121

22+
[[tool.tbump.file]]
23+
src = "docs/source/conf.py"
24+
2225
[tool.jupyter-releaser]
2326
skip = ["check-links"]
2427

readthedocs.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
version: 2
2+
sphinx:
3+
configuration: docs/source/conf.py
4+
conda:
5+
environment: docs/environment.yml
6+
python:
7+
version: "3.8"
8+
install:
9+
# install jupyter_releaser itself
10+
- method: pip
11+
path: .

0 commit comments

Comments
 (0)