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

Automatically check if modules are left out of the API docs #714

Closed
dhermes opened this issue Mar 12, 2015 · 4 comments
Closed

Automatically check if modules are left out of the API docs #714

dhermes opened this issue Mar 12, 2015 · 4 comments
Assignees

Comments

@dhermes
Copy link
Contributor

dhermes commented Mar 12, 2015

See previous comment for context.

@dhermes
Copy link
Contributor Author

dhermes commented Sep 28, 2015

/cc @tseaver We may be able to handle this with http://sphinx-doc.org/ext/coverage.html

@tseaver
Copy link
Contributor

tseaver commented Sep 28, 2015

I will try to enable sphinx.ext.coverage.

@tseaver tseaver self-assigned this Sep 28, 2015
@tseaver
Copy link
Contributor

tseaver commented Sep 28, 2015

Per Takayuki Shimizukawa's EP 2015 presentation, the extension generates a ReST report for undocumented modules/classes/functions, but there is no CI integration for it: the command always succeeds, and does not generate a useful machine-readable file we could interrogate.

@dhermes
Copy link
Contributor Author

dhermes commented Jan 6, 2016

I have a hacky but short way to check this.

import os
import warnings

from sphinx.ext.intersphinx import fetch_inventory

class SphinxApp(object):
    warn = warnings.warn
    srcdir = os.path.abspath('.')

I = fetch_inventory(SphinxApp, '',
                    os.path.join('docs', '_build', 'html', 'objects.inv'))
sphinx_mods = I['py:module'].keys()

py_files = []
for path, _, files in os.walk('gcloud'):
    if any([part.startswith('_')
            for part in path.split(os.path.sep)]):
        continue
    for fi in files:
        if (fi.endswith('.py') and not fi.startswith('test_')
                and not fi.startswith('_')):
            py_files.append(os.path.join(path, fi))
mods = [fi[:-3].replace(os.path.sep, '.') for fi in py_files]
print set(sphinx_mods) - set(mods)
print set(mods) - set(sphinx_mods)

Running this results in an empty set (everything in sphinx_mods is in mods) and the following:

{'gcloud.bigquery.query',
 'gcloud.bigtable.client',
 'gcloud.bigtable.cluster',
 'gcloud.bigtable.column_family',
 'gcloud.bigtable.row',
 'gcloud.bigtable.table',
 'gcloud.datastore.demo.demo',
 'gcloud.datastore.helpers',
 'gcloud.demo',
 'gcloud.environment_vars',
 'gcloud.iterator',
 'gcloud.storage.batch',
 'gcloud.storage.demo.demo',
 'gcloud.streaming.buffered_stream',
 'gcloud.streaming.exceptions',
 'gcloud.streaming.http_wrapper',
 'gcloud.streaming.stream_slice',
 'gcloud.streaming.transfer',
 'gcloud.streaming.util'}

We could do as we do in run_pylint.py and manually specify which files we are happy to ignore.


@tseaver WDYT?

dhermes added a commit to dhermes/google-cloud-python that referenced this issue Jan 9, 2016
dhermes added a commit to dhermes/google-cloud-python that referenced this issue Jan 15, 2016
dhermes added a commit to dhermes/google-cloud-python that referenced this issue Jan 20, 2016
dhermes added a commit to dhermes/google-cloud-python that referenced this issue Jan 28, 2016
dhermes added a commit to dhermes/google-cloud-python that referenced this issue Feb 12, 2016
parthea pushed a commit that referenced this issue Oct 21, 2023
- [ ] Regenerate this pull request now.

Source-Link: googleapis/googleapis@6b3fdce

Source-Link: googleapis/googleapis-gen@832dbe9
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiODMyZGJlOTk4ODc4ZDg2MTlkNmI0MGZlNTdjNmQyY2M2ZTdkYzkwYyJ9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants