-
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
Conversation
351: tests/integration/itest 349: setup.py 320: records_mover/records/schema/field/__init__.py Reduce total number of bigfiles violations to 1002 or below!
@@ -2,6 +2,8 @@ | |||
src="https://raw.githubusercontent.com/bluelabsio/records-mover/master/docs/records-mover-horizontal.png" | |||
alt="Records Mover"> | |||
|
|||
[![Documentation Status](https://readthedocs.org/projects/records-mover/badge/?version=publish_docs)](https://records-mover.readthedocs.io/en/publish_docs/?badge=latest) |
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.
- Update readthedocs URLs back to master branch
@@ -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 comment
The 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.
|
||
* :ref:`genindex` | ||
* :ref:`modindex` | ||
* :ref:`search` |
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.
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:
- any tweaks that need to be done to the default generation strategy (you'll see some examples later on)
- lists of the specific public API that will be documented
- any module-level documentation needed, which doesn't seem to be brought in at all (I generally chose to leave this out and preferred documenting things at the class level)
:maxdepth: 4 | ||
|
||
records_mover.records.sources | ||
records_mover.records.targets |
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.
Most of the 'documenting only the public API' comes from judicious exclusion of things from these subpackage lists.
<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 comment
The 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.
.. 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 comment
The 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 __all__
of records_mover
or record_mover.records
, which also ensures that Sphinx will document it there. I then left out the implementation module where it was defined from Sphinx so it didn't get double-documented, and so that we can move things around without folks doing deep 'import' statements.
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.
: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 comment
The 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.
@@ -1 +1 @@ | |||
1002 | |||
1019 |
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.
setup.py has more extras for documentation generation.
'Records', | ||
'move' | ||
'move', | ||
'MoveResult' |
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.
Let's bring more things so they can be pulled in with a simple import from records_mover.records
.
# the first method which makes sense for your new source/target. | ||
# See documentation for RecordsSource in sources.py and | ||
# RecordsTarget in targets.py for the semantics of the methods | ||
# being called. |
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.
Let's leave the maintenance documentation out of the public API documentation.
'RecordsSchemaFieldConstraints', | ||
'RecordsSchemaFieldStatistics', | ||
'RecordsSchemaFieldRepresentation', | ||
] |
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.
I started down the path of bringing this stuff into the public API but ultimately punted. At least we can have simpler imports of it in the meantime.
RecordsFormatType = Literal['delimited', 'parquet'] | ||
|
||
VALID_VARIANTS = ['dumb', 'csv', 'bigquery', 'bluelabs', 'vertica'] |
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.
This thing was only used in unit tests, and can now be done with typing_inspect anyway.
# | ||
# Note: Any expansion of these types should also be done in | ||
# records.jobs.hints | ||
# |
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.
No longer true! These are all sourced from one place now.
This documents a minimal public API for records-mover at https://records-mover.readthedocs.io/en/publish_docs/