-
Notifications
You must be signed in to change notification settings - Fork 4
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, publish public API documentation on readthedocs.io #98
Changes from 58 commits
6f4b13f
61a790f
3abfab2
be2a095
a74c47b
c444f3c
52197e7
98812c5
58d3f95
b18873a
66ce59c
0d1f78d
24bc882
63b437f
0f63d74
dfd93ae
9b1995a
7131ad1
5872e52
bf783d5
a563aa3
fd978cb
cb018a6
d25f27a
1979dd9
40d5958
280a981
23e89f9
7fe9510
20411b8
f24165e
de23e61
71e3e63
82bb2fa
4708dac
0fd2a49
52f9c8e
66ad7b3
413f5ac
e6cf90f
73693ff
404ef14
7ea2482
7f246f5
9871f46
f5ebe0d
bfc1e54
a3f6819
3ca322d
53a9897
6d1fc2f
80dbd1d
7eb2960
e16b177
74a4838
8bd46bb
788a9b3
9ec6984
93f672e
e513abc
2ba42e4
37c2b62
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# .readthedocs.yml | ||
# Read the Docs configuration file | ||
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details | ||
|
||
# Required | ||
version: 2 | ||
|
||
python: | ||
version: 3.7 | ||
install: | ||
- method: pip | ||
path: . | ||
extra_requirements: | ||
- docs | ||
|
||
sphinx: | ||
fail_on_warning: true |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,4 +20,4 @@ pip3 install --upgrade pip | |
# It's nice to unit test, integration test, and run the CLI in | ||
# a development pyenv. | ||
# | ||
pip3 install -r requirements.txt -e '.[unittest,itest,cli,typecheck]' | ||
pip3 install -r requirements.txt -e '.[unittest,itest,cli,typecheck,docs]' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. With this extra, you can run 'make docs' in the docs/ directory and generate things locally. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Minimal makefile for Sphinx documentation | ||
# | ||
|
||
# You can set these variables from the command line, and also | ||
# from the environment for the first two. | ||
SPHINXOPTS ?= -W | ||
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) | ||
|
||
apidocs: | ||
@sphinx-apidoc -o ./source ../records_mover | ||
|
||
.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) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
# 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 records_mover # noqa | ||
|
||
|
||
# -- Project information ----------------------------------------------------- | ||
|
||
project = 'records-mover' | ||
copyright = '2020 BlueLabs Analytics, Inc.' | ||
author = 'Vince Broz' | ||
|
||
# The full version, including alpha/beta/rc tags | ||
release = records_mover.version.__version__ | ||
|
||
|
||
# -- 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', | ||
] | ||
|
||
# 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 = [] | ||
|
||
# | ||
# This value selects if automatically documented members are sorted | ||
# alphabetical (value 'alphabetical'), by member type (value | ||
# 'groupwise') or by source order (value 'bysource'). The default is | ||
# alphabetical. | ||
# | ||
# records mover picks 'groupwise' so that enums appear in the order | ||
# listed in the source code, which can reflect a natural order. | ||
# | ||
autodoc_member_order = 'bysource' | ||
|
||
# -- 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'] | ||
|
||
# -- Options for type generation --------------------------------------------- | ||
|
||
# | ||
# Document parameter types in description of parameter, not in | ||
# function signature part of documentation. | ||
# | ||
autodoc_typehints = 'description' |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
.. records-mover documentation master file, created by | ||
sphinx-quickstart on Fri Jun 26 11:46:58 2020. | ||
You can adapt this file completely to your liking, but it should at least | ||
contain the root `toctree` directive. | ||
|
||
Welcome to records-mover's documentation! | ||
========================================= | ||
|
||
.. toctree:: | ||
:maxdepth: 2 | ||
:caption: Contents: | ||
|
||
records_mover | ||
|
||
|
||
Indices and tables | ||
================== | ||
|
||
* :ref:`genindex` | ||
* :ref:`modindex` | ||
* :ref:`search` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was sort of expecting documentation generation to be entirely driven by docstring comments, but the Sphinx toolkit seems to be a tad more rustic than that. As a result, these .rst files contain:
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
records\_mover.airflow.hooks package | ||
==================================== | ||
|
||
Module contents | ||
--------------- | ||
|
||
.. comment: | ||
SqlAlchemyDbHook.validate_and_prepare_target_directory is something | ||
I'd like to explore removing and promoting to something | ||
non-Airflow-related, so let's not include it in the docs and leave | ||
'undoc-members' out | ||
|
||
.. automodule:: records_mover.airflow.hooks | ||
:members: | ||
:show-inheritance: | ||
:special-members: __init__ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
records\_mover.airflow package | ||
============================== | ||
|
||
Subpackages | ||
----------- | ||
|
||
.. toctree:: | ||
:maxdepth: 4 | ||
|
||
records_mover.airflow.hooks |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
records\_mover.records package | ||
============================== | ||
|
||
Subpackages | ||
----------- | ||
|
||
.. toctree:: | ||
:maxdepth: 4 | ||
|
||
records_mover.records.sources | ||
records_mover.records.targets | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Most of the 'documenting only the public API' comes from judicious exclusion of things from these subpackage lists. |
||
|
||
Submodules | ||
---------- | ||
|
||
records\_mover.records.base\_records\_format module | ||
--------------------------------------------------- | ||
|
||
.. autoclass:: records_mover.records.base_records_format.BaseRecordsFormat | ||
:members: | ||
:show-inheritance: | ||
:special-members: __init__ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Most of the time I chose to bring up key public API classes into the This is a case where I couldn't get away with that, as Sphinx documented it as a base class of DelimitedRecordsFormat and ParquetRecordsFormat--leaving this out broke the link. I couldn't figure how to convince it to do otherwise. |
||
|
||
Module contents | ||
--------------- | ||
|
||
.. comment: | ||
|
||
I exclude PartialRecordsHints entirely below because Sphinx doesn't | ||
yet support TypedDict types that have hyphens as part of the keys. | ||
Example error on 'make html': | ||
|
||
WARNING: invalid signature for autoinstanceattribute | ||
('records_mover.records::PartialRecordsHints.header-row') | ||
|
||
I exclude RecordsSchema as we haven't defined yet exactly what | ||
public API to export. | ||
|
||
https://github.com/bluelabsio/records-mover/issues/97 | ||
|
||
I exclude RecordsFormat as it's generally an internal factory | ||
method useful when reading undifferentiated JSON files - a general | ||
user ought to be able to select their records format in advance and | ||
use the correct subclass. | ||
|
||
I exclude UntypedRecordsHints and RecordsFormatType as it hasn't | ||
been used in any other part of the public interface. | ||
|
||
I exclude DelimitedVariant as there's no way to specify a | ||
docstring, so I add out-of-band documentation below. | ||
|
||
.. automodule:: records_mover.records | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: | ||
:exclude-members: DelimitedRecordsFormat, ParquetRecordsFormat, ProcessingInstructions, PartialRecordsHints, RecordsSchema, RecordsFormat, UntypedRecordsHints, RecordsFormatType, DelimitedVariant | ||
|
||
.. autoclass:: records_mover.records.DelimitedRecordsFormat | ||
:undoc-members: | ||
:show-inheritance: | ||
:special-members: __init__ | ||
|
||
.. autoclass:: records_mover.records.ParquetRecordsFormat | ||
:undoc-members: | ||
:show-inheritance: | ||
:special-members: __init__ | ||
|
||
.. autoclass:: records_mover.records.ProcessingInstructions | ||
:undoc-members: | ||
:show-inheritance: | ||
:special-members: __init__ | ||
|
||
.. py:data:: DelimitedVariant | ||
:module: records_mover.records | ||
|
||
Valid string values for the variant of a delimited records format. | ||
Variants specify a default set of parsing hints for how the delimited | ||
file is formatted. See the `records format specification | ||
<https://github.com/bluelabsio/records-mover/blob/master/docs/RECORDS_SPEC.md>`_ | ||
for semantics of each. | ||
|
||
alias of Literal[dumb, csv, bigquery, bluelabs, vertica] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sadly, there's no way to assign a docstring to: DelimitedVariant = Literal[dumb, csv, bigquery, bluelabs, vertica] ...so I had to do it out-of-band here. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
records\_mover.records.sources package | ||
====================================== | ||
|
||
Module contents | ||
--------------- | ||
|
||
.. automodule:: records_mover.records.sources | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
records\_mover.records.targets package | ||
====================================== | ||
|
||
Module contents | ||
--------------- | ||
|
||
.. automodule:: records_mover.records.targets | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
records\_mover package | ||
====================== | ||
|
||
Subpackages | ||
----------- | ||
|
||
.. toctree:: | ||
:maxdepth: 4 | ||
|
||
records_mover.airflow | ||
records_mover.records | ||
|
||
Module contents | ||
--------------- | ||
|
||
.. automodule:: records_mover | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: | ||
:exclude-members: Session | ||
|
||
.. autoclass:: records_mover.Session | ||
:members: records, set_stream_logging, get_db_engine, get_default_db_engine | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I documented only specific methods here. In particular I didn't yet document the Creds hierarchy - it seemed like a whole different can of worms to lock down at this point. As a result, the methods needed to do google sheets work aren't documented in Sphinx yet - I dropped a post-1.0 backlog item to deal with that. |
||
:undoc-members: | ||
:show-inheritance: | ||
:special-members: __init__ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
1002 | ||
1019 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. setup.py has more extras for documentation generation. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
93.700 | ||
93.7100 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
174 | ||
170 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
92.2800 | ||
92.3100 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.