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

{Issue #6}: Add sphinx docs #123

Open
wants to merge 35 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 32 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
45a9bf4
Initial commit
JoseALermaIII Apr 16, 2019
271cc12
Change depreciated autodoc_default_flags to autodoc_default_options
JoseALermaIII Apr 20, 2019
56ff6d9
Add napoleon extension
JoseALermaIII Apr 20, 2019
b1cccb2
Fix docstring spacing
JoseALermaIII Apr 20, 2019
64b749f
Fix docstring spacing
JoseALermaIII Apr 20, 2019
9a90063
Fix line numbers in halo.py include
JoseALermaIII Apr 20, 2019
e65f0f9
Add symlink to .github/CONTRIBUTING.md
JoseALermaIII Apr 20, 2019
74c85a5
Add symlink to DEVELOPMENT.md
JoseALermaIII Apr 20, 2019
26fed63
Add DEVELOPMENT.md and CONTRIBUTING.md to toctree
JoseALermaIII Apr 20, 2019
6a2693a
Remove How to contribute? section
JoseALermaIII Apr 20, 2019
a9bb9c1
Fix typo in docstring
JoseALermaIII Apr 20, 2019
ad367ab
Add comment to autodoc_default_options and add autoclass_content
JoseALermaIII Apr 22, 2019
69d5806
Updated docstrings to match README.md API section
JoseALermaIII Apr 22, 2019
a6852f6
Fix line numbers in halo.py include
JoseALermaIII Apr 22, 2019
ce4ef63
Add badges
JoseALermaIII Sep 23, 2019
a8c9dc9
Add sphinx linkcheck
JoseALermaIII Sep 23, 2019
65972d6
Fix broken link
JoseALermaIII Sep 23, 2019
6dded16
[Builds] Add sphinx toxenv to appveyor
JoseALermaIII Sep 23, 2019
065977b
[Builds] Add sphinx toxenv to travis
JoseALermaIII Sep 23, 2019
269052e
Move DEVELOPMENT.md to .github
JoseALermaIII Sep 23, 2019
a4fea93
Downgrade sphinx from 2.0.1 to 1.8.5 for python2.7
JoseALermaIII Sep 23, 2019
70b8f7d
Change autodoc_default_options to autodoc_default_flags
JoseALermaIII Sep 23, 2019
4fa53b5
Add master_doc
JoseALermaIII Sep 23, 2019
6889a4a
Merge remote-tracking branch 'manrajgrover/master' into add-sphinx-docs
JoseALermaIII Sep 23, 2019
747c931
Add DummyBuilder to sphinx testenv commands
JoseALermaIII Sep 23, 2019
2f43f04
Add Building Documentation section
JoseALermaIII Sep 24, 2019
bb82411
Add clearing output directory to Adding Documentation section
JoseALermaIII Sep 24, 2019
35a4123
Fix line numbers in halo.py include
JoseALermaIII Sep 24, 2019
2167ae0
Add adding to docs/source folder to Adding Documentation section
JoseALermaIII Sep 24, 2019
d0b6d1a
Add version
JoseALermaIII Sep 24, 2019
272f107
Bump release
JoseALermaIII Sep 24, 2019
f76b256
Add version TODO
JoseALermaIII Sep 24, 2019
24db0a5
Fix _check_stream docstring spacing
JoseALermaIII Sep 24, 2019
7770c84
Fix _write docstring spacing
JoseALermaIII Sep 24, 2019
ed2681e
Fix line numbers in halo.py include
JoseALermaIII Sep 24, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Development Guidelines

Please read [development guidelines](https://github.com/manrajgrover/halo/blob/master/DEVELOPMENT.md) inorder to setup dev environment and run tests.
Please read [development guidelines](./DEVELOPMENT.md) inorder to setup dev environment and run tests.

## Steps to contribute

Expand Down
94 changes: 94 additions & 0 deletions .github/DEVELOPMENT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
## Development

We need to clone the project and prepare the dev environment:

```bash
$ git clone https://github.com/manrajgrover/halo.git // or using ssh: [email protected]:manrajgrover/halo.git
$ cd halo
$ pip install -e .
```

This will install all requirements to use `halo`. You may want to create a virtual environment specifically for this.

To install development dependencies, run:

```bash
$ pip install -r requirements-dev.txt
```

#### Testing
Before submitting a pull request, make sure the code passes all the tests and is clean of lint errors:

```bash
$ tox
```

To run tests for specific environment, run:

1. For Python 2.7:

```bash
$ tox -e py27
```

2. For Python 3.6:

```bash
$ tox -e py36
```

For checking lint issues:

```bash
$ tox -e lint
```

### Building Documentation

To install documentation dependencies, run:

```bash
$ pip install -r requirements-docs.txt
```

To build the docs, change directories and then run the `html` make target:

```bash
$ cd docs
$ make html
```

Documentation will be located in `docs/build/html`.

#### Adding Documentation

After editing or adding to the module's docstrings, update the Sphinx documentation with `sphinx-apidoc`,
clear the output directory, then rebuild the html pages:

```bash
$ sphinx-apidoc -f -o ./docs/source halo
$ cd docs
$ make clean
$ make html
```

After adding content to the `docs/source` folder, update the Sphinx documentation by clearing the output directory,
then rebuilding the html pages:

```bash
$ cd docs
$ make clean
$ make html
```

#### Testing Documentation

Documentation testing is integrated with `tox`.

Simply run:

```bash
$ tox -e sphinx
```

If `linkcheck` fails, a list of broken external links will be located in `docs/build/linkcheck/output.txt`.
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ matrix:
dist: xenial
sudo: true
env: TOXENV=py37
- python: '3.7'
dist: xenial
sudo: true
env: TOXENV=sphinx
fast_finish: true
install:
- pip install tox coveralls
Expand Down
44 changes: 0 additions & 44 deletions DEVELOPMENT.md

This file was deleted.

6 changes: 6 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ environment:
PYTHON_VERSION: '2.7'
PYTHON_ARCH: '32'

- TOXENV: 'sphinx'
TOXPYTHON: C:\Python37\python.exe
PYTHON_HOME: C:\Python37
PYTHON_VERSION: '3.7'
PYTHON_ARCH: '32'

matrix:
fast_finish: true

Expand Down
19 changes: 19 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line.
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)
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.http://sphinx-doc.org/
exit /b 1
)

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

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

:end
popd
1 change: 1 addition & 0 deletions docs/source/about/CONTRIBUTING.md
1 change: 1 addition & 0 deletions docs/source/about/DEVELOPMENT.md
17 changes: 17 additions & 0 deletions docs/source/about/faqs.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FAQs
====

Anticipated :abbr:`FAQs (Frequently Asked Questions)`.

What spinners are compatible with Windows Operating System?
-----------------------------------------------------------

Compatible spinners are defined in :meth:`~halo.halo.Halo._get_spinner()` from :mod:`halo.halo`:

.. literalinclude:: ../../../halo/halo.py
:linenos:
:lineno-start: 320
:language: python
:lines: 320-345

Currently, it defaults to ``line``.
91 changes: 91 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
# 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:
# http://www.sphinx-doc.org/en/master/config

# -- 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
import recommonmark
from recommonmark.transform import AutoStructify

sys.path.insert(0, os.path.abspath('../..'))

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

project = 'halo'
copyright = '2019, Manraj Singh'
author = 'Manraj Singh'

# TODO: Single source version info
# The short X.Y version
version = '0.0'

# The full version, including alpha/beta/rc tags
release = '0.0.28'


# -- 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 = [
'sphinx.ext.autodoc',
'sphinx.ext.viewcode',
'sphinx.ext.intersphinx',
'sphinx.ext.napoleon',
'recommonmark',
]

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

# Handle mapping of external module documentation written with Sphinx
intersphinx_mapping = {
'python': ('https://docs.python.org/3/', None),
}

# Document private members
autodoc_default_flags = [
'members',
'private-members'
]

# Define master document
master_doc = 'index'

# Document class' and __init__ docstrings combined
autoclass_content = 'both'

# -- 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 = 'sphinx_rtd_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']

# -- Extension configuration -------------------------------------------------

def setup(app):
app.add_config_value('recommonmark_config', {
'auto_toc_tree_section': 'Contents',
'enable_eval_rst': True,
}, True)
app.add_transform(AutoStructify)
30 changes: 30 additions & 0 deletions docs/source/halo.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
halo package
============

Submodules
----------

halo.halo module
----------------

.. automodule:: halo.halo
:members:
:undoc-members:
:show-inheritance:

halo.halo\_notebook module
--------------------------

.. automodule:: halo.halo_notebook
:members:
:undoc-members:
:show-inheritance:


Module contents
---------------

.. automodule:: halo
:members:
:undoc-members:
:show-inheritance: