Skip to content

Commit

Permalink
Add sphinx docs stub (#42)
Browse files Browse the repository at this point in the history
  • Loading branch information
blink1073 committed Jul 4, 2022
1 parent e1870bc commit 244f4d4
Show file tree
Hide file tree
Showing 9 changed files with 159 additions and 6 deletions.
11 changes: 11 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,17 @@ jobs:
pip install pytest-xdist[psutil]
python -m pytest -n auto -vv --migration-tests True
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
- name: Install dependencies
run: pip install -e ".[docs]"
- name: Build docs
working-directory: docs
run: make html SPHINXOPTS="-W"

pre-commit:
name: pre-commit
runs-on: ubuntu-latest
Expand Down
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 = .
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)
54 changes: 54 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# 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('.'))


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

project = "hatch-jupyter-builder"
copyright = "2022, Project Jupyter"
author = "Project Jupyter"

# The full version, including alpha/beta/rc tags
release = "0.6.0.dev0"


# -- 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 = []

# 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 = ["_build", "Thumbs.db", ".DS_Store"]


# -- 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"]
6 changes: 6 additions & 0 deletions docs/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
name: hatch-jupyter-builder-docs
dependencies:
- python
- pip
- pip:
- "..[docs]"
20 changes: 20 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
.. hatch-jupyter-builder documentation master file, created by
sphinx-quickstart on Mon Jul 4 07:51:40 2022.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
Welcome to hatch-jupyter-builder's documentation!
=================================================

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



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

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
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=.
set BUILDDIR=_build

%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
)

if "%1" == "" goto help

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

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

:end
popd
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ Source = "https://github.com/jupyterlab/hatch-jupyter-builder"

[project.optional-dependencies]
test = ["pytest", "pytest-mock", "pre-commit", "hatchling", "pytest-cov", "tomli", "twine"]
docs = ["pydata-sphinx-theme", "sphinx>=5.0"]

[project.entry-points.hatch]
jupyter = "hatch_jupyter_builder.hooks"
Expand Down Expand Up @@ -83,6 +84,9 @@ src = "hatch_jupyter_builder/__init__.py"
[[tool.tbump.file]]
src = "pyproject.toml"

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

[[tool.tbump.field]]
name = "channel"
default = ""
Expand Down
6 changes: 6 additions & 0 deletions readthedocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
sphinx:
configuration: docs/conf.py
fail_on_warning: true
conda:
environment: docs/environment.yml
9 changes: 3 additions & 6 deletions tests/test_migration.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,21 +45,18 @@ def test_npm_builder_migration():
results = main(target2, target1, asset)

if asset == "sdist":
assert len(results["removed"]) == 1
assert "static/remoteEntry." in results["removed"][0]
for item in results["removed"]:
assert "static/remoteEntry." in item

assert len(results["added"]) == 2
for item in results["added"]:
assert ".eslintrc.js" in item or "static/remoteEntry." in item

else:
assert len(results["removed"]) == 3
for item in results["removed"]:
assert "static/remoteEntry." in item or "top_level.txt" in item

assert len(results["added"]) == 3
for item in results["added"]:
assert "entry_points.txt" in item or "static/remoteEntry." in item
assert "static/remoteEntry." in item

# Check the produced dist file in strict mode.
dist_files = glob.glob(str(target1 / "dist/*.*"))
Expand Down

0 comments on commit 244f4d4

Please sign in to comment.