Skip to content

Commit

Permalink
Add Sphinx Docs
Browse files Browse the repository at this point in the history
  • Loading branch information
jtpio committed Sep 20, 2021
1 parent 70f48ae commit 70819f5
Show file tree
Hide file tree
Showing 9 changed files with 217 additions and 0 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -145,3 +145,45 @@ jobs:
- name: Coverage
run: |
codecov
docs:
runs-on: ubuntu-20.04
timeout-minutes: 2
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v2
- name: Setup conda
uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
activate-environment: jupyter_releaser_documentation
environment-file: docs/environment.yml
python-version: "3.9"
auto-activate-base: false
- name: Get pip cache dir
id: pip-cache
run: |
echo "::set-output name=dir::$(pip cache dir)"
- name: Cache pip
uses: actions/cache@v2
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('setup.cfg') }}
restore-keys: |
${{ runner.os }}-pip-${{ matrix.python-version }}-
${{ runner.os }}-pip-
- name: Cache conda
uses: actions/cache@v2
with:
path: ~/conda_pkgs_dir
key: ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{
hashFiles('docs/environment.yml') }}
- name: Build docs
run: |
set -eux
pip install .
pushd docs
make html
popd
2 changes: 2 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
include *.md
include LICENSE
prune media
prune docs
exclude readthedocs.yml
include jupyter_releaser/schema.json
20 changes: 20 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = source
BUILDDIR = build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
11 changes: 11 additions & 0 deletions docs/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: jupyter_releaser_documentation
channels:
- conda-forge
dependencies:
- python=3.9
- sphinx
- sphinx-copybutton
- pip
- myst-parser
- pip:
- pydata_sphinx_theme
35 changes: 35 additions & 0 deletions docs/make.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
@ECHO OFF

pushd %~dp0

REM Command file for Sphinx documentation

if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=source
set BUILDDIR=build

if "%1" == "" goto help

%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.https://www.sphinx-doc.org/
exit /b 1
)

%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end

:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%

:end
popd
76 changes: 76 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
# import os
# import sys
# sys.path.insert(0, os.path.abspath('.'))
import os.path as osp
import shutil

HERE = osp.abspath(osp.dirname(__file__))

# -- Project information -----------------------------------------------------

project = "Jupyter Releaser"
copyright = "2021, Project Jupyter"
author = "Project Jupyter"

# The full version, including alpha/beta/rc tags.
release = "0.7.4"
# The short X.Y version.
version = ".".join(release.split(".")[:2])

# -- General configuration ---------------------------------------------------

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = ["myst_parser"]

myst_enable_extensions = ["html_image"]

# Add any paths that contain templates here, relative to this directory.
templates_path = ["_templates"]

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = []


# -- Options for HTML output -------------------------------------------------

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = "pydata_sphinx_theme"

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ["_static"]

# Add an Edit this Page button
html_theme_options = {
"use_edit_page_button": True,
}

# Output for github to be used in links
html_context = {
"github_user": "jupyterlab", # Username
"github_repo": "jupyterlab_server", # Repo name
"github_version": "master", # Version
"doc_path": "/docs/source/", # Path in the checkout to the docs root
}


def setup(app):
dest = osp.join(HERE, "changelog.md")
shutil.copy(osp.join(HERE, "..", "..", "CHANGELOG.md"), dest)
17 changes: 17 additions & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Welcome to Jupyter Releaser's documentation!
============================================

.. toctree::
:maxdepth: 2
:caption: Contents:

changelog



Indices and tables
==================

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ tag_template = "v{new_version}"
[[tool.tbump.file]]
src = "jupyter_releaser/__init__.py"

[[tool.tbump.file]]
src = "docs/source/conf.py"

[tool.jupyter-releaser]
skip = ["check-links"]

Expand Down
11 changes: 11 additions & 0 deletions readthedocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: 2
sphinx:
configuration: docs/source/conf.py
conda:
environment: docs/environment.yml
python:
version: "3.8"
install:
# install jupyter_releaser itself
- method: pip
path: .

0 comments on commit 70819f5

Please sign in to comment.