GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Interleave doctest examples w/ API ref docs. · Issue #1141 · googleapis/google-cloud-python

Interleave doctest examples w/ API ref docs.  #1141

New issue
Copy link
New issue
Copy link
Closed
Closed
Interleave doctest examples w/ API ref docs. #1141
Copy link
Assignees
tseaver
Labels
api: pubsubIssues related to the Pub/Sub API.

Description

@jgeewax
jgeewax
opened on Sep 16, 2015
Issue body actions

Related to #1102

I just tried to walk a group of people through gcloud.pubsub, and of the few who found the docs under "Pubsub usage", almost everyone was frustrated by the examples being there rather than next to the method they were interested in. They couldn't find the specific thing they wanted quickly, whereas finding the right methods was pretty straight forward -- but then example code was hidden in a big long (and separate) page.

Ideally we would:

  1. Move all the usage examples to live next to the methods they describe
  2. Remove the pubsub-usage.rst file
  3. Have test coverage of those docstring examples

(ie, https://googlecloudplatform.github.io/gcloud-python/stable/pubsub-topic.html has no example code snippets)

Activity

  1. jgeewax
    added
    api: pubsubIssues related to the Pub/Sub API.
    on Sep 16, 2015
  2. dhermes commented on Sep 16, 2015

    @dhermes
    dhermes
    on Sep 16, 2015
    Contributor
    More actions

    FWIW I've never been a big fan of the *-usage docs.

    IIRC you encouraged us to create them after @tseaver started the very first one for Pub/Sub (datastore and storage don't really have them).

  3. jgeewax commented on Sep 16, 2015

    @jgeewax
    jgeewax
    on Sep 16, 2015
    ContributorAuthor
    More actions

    Yes, the goal of the usage docs was "let's define the actions and the API surface" and debate the usage in those docs rather than in code that implements them -- which I still think we should do with new APIs...

    The goal wasn't to hide examples in there and take them out of docstrings... Sorry if that was confusing.

  4. dhermes commented on Sep 16, 2015

    @dhermes
    dhermes
    on Sep 16, 2015
    Contributor
    More actions

    We never took them out, just for those packages they never went in as a result. The process was never really explicit in either direction.

  5. dhermes commented on Sep 16, 2015

    @dhermes
    dhermes
    on Sep 16, 2015
    Contributor
    More actions

    Also @jgeewax third item relies on #212 being done

  6. tseaver commented on Sep 23, 2015

    @tseaver
    tseaver
    on Sep 23, 2015
    Contributor
    More actions

    Making the example snippets testable requires being able to tie them to specific testsetup and testcleanup groups.

    My inclination would be not to put the examples in the docstrings themselves, but to interleave them with the docstring-generated API reference docs. This would require making the API reference less DRY, as we would need to explicitly name each method (to pull in its docstring) before the example. In exchange, we would gain some benefits:

    • We could explicitly reorder (or exclude) the method API reference entries.
    • The Sphinx API source documents would become a logical place to inject other, too-verbose-for-the-docstring narrative.
    • We would be able to use testsetup and testcleanup groups without trying to sync them between docstrings and the Sphinx source.
  7. dhermes commented on Sep 24, 2015

    @dhermes
    dhermes
    on Sep 24, 2015
    Contributor
    More actions

    I'd like to make that such a change would include #714 (e.g. an automated way to make sure all public functions, classes, methods, constants, or otherwise, are documented)

  8. dhermes
    added
    docs
    on Jan 11, 2016
  9. dhermes
    changed the title [-]Add examples to pubsub methods[/-] [+]Interleave doctest examples w/ API ref docs. [/+] on Jan 11, 2016
  10. theacodes commented on Aug 22, 2016

    @theacodes
    theacodes
    on Aug 22, 2016
    Contributor
    More actions

    It seems that we currently have a lot of usage snippets that are untested included in the docs. This is really unacceptable. I'd vote that until #1744 (testing for snippets) is resolved, that you guys instead link to the docs on cloud.google.com (where applicable) where samples are tested. Some products haven't been updated to use gcloud-python, but that gap should be closing this quarter for Datastore, Pub/Sub, Logging, BigQuery, and Storage.

    We can't be putting untested samples in front of users.

    /cc @omaray

    Reacted by Les Vogel and Phil Fritzsche
  11. tseaver commented on Aug 25, 2016

    @tseaver
    tseaver
    on Aug 25, 2016
    Contributor
    More actions

    #2154 is really where this should be tracked as an ongoing issue.

  12. tseaver
    closed this as completedon Aug 25, 2016
  13. JustinBeckwith
    assigned
    tseaver
    on Feb 1, 2021
  14. parthea
    added a commit that references this issue on Nov 24, 2025

    fix: alembic column rename (#1141)

    3c207dd
  15. parthea
    added a commit that references this issue on Mar 6, 2026

    feat: add `--no_query_cache` option to `%%bigquery` magics to disable…

    4bbd591
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @tseaver
    tseaver

Labels

api: pubsubIssues related to the Pub/Sub API.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.