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

Create docs and use Readthedocs for hosting #56

Merged
merged 1 commit into from
Feb 12, 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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
pydocstringformatter.egg-info
dist/
docs/_build
17 changes: 17 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

version: 2

python:
install:
- requirements: docs/requirements-doc.txt

sphinx:
builder: html
fail_on_warning: true
configuration: docs/conf.py

build:
os: ubuntu-20.04
tools:
python: "3.10"
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)
7 changes: 7 additions & 0 deletions docs/_static/custom.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
div.sphinxsidebarwrapper h1.logo {
font-size: 17px;
}

div.body h1 {
font-size: 28px;
}
41 changes: 41 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# pylint: disable=invalid-name

"""Configuration file for the Sphinx documentation builder."""

# -- Path setup --------------------------------------------------------------

# Add parent directory so we can import pydocstringformatter
import os
import sys

sys.path.insert(0, os.path.abspath(".."))

# pylint: disable-next=import-error, wrong-import-position
import pydocstringformatter # noqa: E402

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

project = "pydocstringformatter"
copyright = "2022, Github Contributors" # pylint: disable=redefined-builtin
author = "Github Contributors"
release = pydocstringformatter.__version__

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

extensions = ["myst_parser"]
source_suffix = [".rst", ".md"]
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]

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

html_theme = "alabaster"
html_theme_options = {
# pylint: disable-next=line-too-long
"description": "A tool to automatically format Python docstrings that tries to follow recommendations from PEP 8 and PEP 257.", # noqa: E501
"donate_url": "https://github.com/DanielNoord/pydocstringformatter",
"github_repo": "pydocstringformatter",
"github_user": "DanielNoord",
"fixed_sidebar": True,
}

html_static_path = ["_static"]
2 changes: 2 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.. include:: ../README.md
:parser: myst_parser.sphinx_
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

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
3 changes: 3 additions & 0 deletions docs/requirements-doc.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
-e .
myst-parser~=0.16
sphinx~=4.4
5 changes: 5 additions & 0 deletions requirements-test.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
-e .
# Requirements for testing and coverage reporting
coverage[toml]==6.2
coveralls==3.3.1
pytest==6.2.5
pytest-cov==3.0.0

# Requirements for docs building
myst-parser~=0.16
sphinx~=4.4