From 5f6219f7b4a926402d0d0664d37b283438ce2bb8 Mon Sep 17 00:00:00 2001 From: Tim Swast Date: Wed, 22 Sep 2021 17:07:39 -0500 Subject: [PATCH 1/2] doc: unify layout with Google client libraries --- docs/{source => }/Makefile | 0 docs/README.rst | 10 - docs/{source => }/_static/style.css | 0 docs/{source => }/_templates/layout.html | 0 docs/{source => }/api.rst | 0 docs/changelog.md | 1 + docs/{source => }/conf.py | 253 +++++++++---------- docs/{source => }/contributing.rst | 2 +- docs/{source => }/howto/authentication.rst | 0 docs/{source => }/index.rst | 0 docs/{source => }/install.rst | 0 docs/{source => }/intro.rst | 0 docs/{source => }/privacy.rst | 0 docs/{source => }/reading.rst | 0 docs/samples | 1 + docs/source/changelog.md | 1 - docs/source/samples | 1 - docs/{source => }/writing.rst | 0 noxfile.py | 12 +- samples/samples | 1 - samples/{tests => snippets}/__init__.py | 0 samples/{tests => snippets}/conftest.py | 0 samples/{tests => snippets}/test_read_gbq.py | 0 samples/{tests => snippets}/test_to_gbq.py | 0 24 files changed, 132 insertions(+), 150 deletions(-) rename docs/{source => }/Makefile (100%) delete mode 100644 docs/README.rst rename docs/{source => }/_static/style.css (100%) rename docs/{source => }/_templates/layout.html (100%) rename docs/{source => }/api.rst (100%) create mode 120000 docs/changelog.md rename docs/{source => }/conf.py (65%) rename docs/{source => }/contributing.rst (99%) rename docs/{source => }/howto/authentication.rst (100%) rename docs/{source => }/index.rst (100%) rename docs/{source => }/install.rst (100%) rename docs/{source => }/intro.rst (100%) rename docs/{source => }/privacy.rst (100%) rename docs/{source => }/reading.rst (100%) create mode 120000 docs/samples delete mode 120000 docs/source/changelog.md delete mode 120000 docs/source/samples rename docs/{source => }/writing.rst (100%) delete mode 120000 samples/samples rename samples/{tests => snippets}/__init__.py (100%) rename samples/{tests => snippets}/conftest.py (100%) rename samples/{tests => snippets}/test_read_gbq.py (100%) rename samples/{tests => snippets}/test_to_gbq.py (100%) diff --git a/docs/source/Makefile b/docs/Makefile similarity index 100% rename from docs/source/Makefile rename to docs/Makefile diff --git a/docs/README.rst b/docs/README.rst deleted file mode 100644 index 8cd89d11..00000000 --- a/docs/README.rst +++ /dev/null @@ -1,10 +0,0 @@ -To build a local copy of the pandas-gbq docs, install the programs in -requirements-docs.txt and run 'make html'. If you use the conda package manager -these commands suffice:: - - git clone git@github.com:pydata/pandas-gbq.git - cd dask/docs - conda create -n pandas-gbq-docs --file requirements-docs.txt - source activate pandas-gbq-docs - make html - open build/html/index.html diff --git a/docs/source/_static/style.css b/docs/_static/style.css similarity index 100% rename from docs/source/_static/style.css rename to docs/_static/style.css diff --git a/docs/source/_templates/layout.html b/docs/_templates/layout.html similarity index 100% rename from docs/source/_templates/layout.html rename to docs/_templates/layout.html diff --git a/docs/source/api.rst b/docs/api.rst similarity index 100% rename from docs/source/api.rst rename to docs/api.rst diff --git a/docs/changelog.md b/docs/changelog.md new file mode 120000 index 00000000..04c99a55 --- /dev/null +++ b/docs/changelog.md @@ -0,0 +1 @@ +../CHANGELOG.md \ No newline at end of file diff --git a/docs/source/conf.py b/docs/conf.py similarity index 65% rename from docs/source/conf.py rename to docs/conf.py index b250e7d0..79e0c2aa 100644 --- a/docs/source/conf.py +++ b/docs/conf.py @@ -1,11 +1,19 @@ -# Copyright (c) 2017 pandas-gbq Authors All rights reserved. -# Use of this source code is governed by a BSD-style -# license that can be found in the LICENSE file. - # -*- coding: utf-8 -*- +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 # -# pandas-gbq documentation build configuration file, created by -# sphinx-quickstart on Wed Feb 8 10:52:12 2017. +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# google-cloud-bigquery-storage documentation build configuration file # # This file is execfile()d with the current directory set to its # containing dir. @@ -16,23 +24,25 @@ # All configuration values have a default; values that are commented out # serve to show the default. +import sys +import os +import shlex + # 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 datetime -import os -import sys +sys.path.insert(0, os.path.abspath("..")) -import pandas_gbq +# For plugins that can not read conf.py. +# See also: https://github.com/docascode/sphinx-docfx-yaml/issues/85 +sys.path.insert(0, os.path.abspath(".")) -# sys.path.insert(0, os.path.abspath('.')) +__version__ = "" # -- General configuration ------------------------------------------------ # If your documentation needs a minimal Sphinx version, state it here. -# -# needs_sphinx = '1.0' +needs_sphinx = "1.5.5" # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom @@ -40,47 +50,48 @@ extensions = [ "sphinx.ext.autodoc", "sphinx.ext.autosummary", - "sphinx.ext.doctest", - "sphinx.ext.extlinks", - "sphinx.ext.todo", - "numpydoc", # used to parse numpy-style docstrings for autodoc - "IPython.sphinxext.ipython_console_highlighting", - "IPython.sphinxext.ipython_directive", "sphinx.ext.intersphinx", "sphinx.ext.coverage", - "sphinx.ext.ifconfig", + "sphinx.ext.doctest", + "sphinx.ext.napoleon", + "sphinx.ext.todo", + "sphinx.ext.viewcode", "recommonmark", ] +# autodoc/autosummary flags +autoclass_content = "both" +autodoc_default_options = {"members": True} +autosummary_generate = True + + # Add any paths that contain templates here, relative to this directory. templates_path = ["_templates"] # The suffix(es) of source filenames. # You can specify multiple suffix as a list of string: -# # source_suffix = ['.rst', '.md'] source_suffix = [".rst", ".md"] # The encoding of source files. -# # source_encoding = 'utf-8-sig' -# The master toctree document. -master_doc = "index" +# The root toctree document. +root_doc = "index" # General information about the project. -project = u"pandas-gbq" -copyright = u"2017-{}, PyData Development Team".format(datetime.datetime.now().year) -author = u"PyData Development Team" +project = "google-cloud-bigquery-storage" +copyright = "2019, Google" +author = "Google APIs" # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. # -# The short X.Y version. -version = pandas_gbq.__version__ # The full version, including alpha/beta/rc tags. -release = version +release = __version__ +# The short X.Y version. +version = ".".join(release.split(".")[0:2]) # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. @@ -91,11 +102,8 @@ # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: -# # today = '' -# # Else, today_fmt is used as the format for a strftime call. -# # today_fmt = '%B %d, %Y' # List of patterns, relative to source directory, that match files and @@ -110,21 +118,17 @@ # The reST default role (used for this markup: `text`) to use for all # documents. -# # default_role = None # If true, '()' will be appended to :func: etc. cross-reference text. -# # add_function_parentheses = True # If true, the current module name will be prepended to all description # unit titles (such as .. function::). -# # add_module_names = True # If true, sectionauthor and moduleauthor directives will be shown in the # output. They are ignored by default. -# # show_authors = False # The name of the Pygments (syntax highlighting) style to use. @@ -137,53 +141,45 @@ # keep_warnings = False # If true, `todo` and `todoList` produce output, else they produce nothing. -todo_include_todos = False +todo_include_todos = True # -- Options for HTML output ---------------------------------------------- -# Taken from docs.readthedocs.io: -# on_rtd is whether we are on readthedocs.io -on_rtd = os.environ.get("READTHEDOCS", None) == "True" - -if not on_rtd: # only import and set the theme if we're building docs locally - import sphinx_rtd_theme - - html_theme = "sphinx_rtd_theme" - html_theme_path = [sphinx_rtd_theme.get_html_theme_path()] - # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. -# -# html_theme = 'alabaster' +html_theme = "alabaster" # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. -# -# html_theme_options = {} +html_theme_options = { + "description": "Google Cloud Client Libraries for google-cloud-bigquery-storage", + "github_user": "googleapis", + "github_repo": "python-bigquery-storage", + "github_banner": True, + "font_family": "'Roboto', Georgia, sans", + "head_font_family": "'Roboto', Georgia, serif", + "code_font_family": "'Roboto Mono', 'Consolas', monospace", +} # Add any paths that contain custom themes here, relative to this directory. # html_theme_path = [] -# The name for this set of Sphinx documents. -# " v documentation" by default. -# -# html_title = u'pandas-gbq v0.1.0' +# The name for this set of Sphinx documents. If None, it defaults to +# " v documentation". +# html_title = None # A shorter title for the navigation bar. Default is the same as html_title. -# # html_short_title = None # The name of an image file (relative to this directory) to place at the top # of the sidebar. -# # html_logo = None -# The name of an image file (relative to this directory) to use as a favicon of -# the docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 +# The name of an image file (within the static path) to use as favicon of the +# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 # pixels large. -# # html_favicon = None # Add any paths that contain custom static files (such as style sheets) here, @@ -194,57 +190,44 @@ # Add any extra paths that contain custom files (such as robots.txt or # .htaccess) here, relative to this directory. These files are copied # directly to the root of the documentation. -# # html_extra_path = [] -# If not None, a 'Last updated on:' timestamp is inserted at every page -# bottom, using the given strftime format. -# The empty string is equivalent to '%b %d, %Y'. -# -# html_last_updated_fmt = None +# If not '', a 'Last updated on:' timestamp is inserted at every page bottom, +# using the given strftime format. +# html_last_updated_fmt = '%b %d, %Y' # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. -# # html_use_smartypants = True # Custom sidebar templates, maps document names to template names. -# # html_sidebars = {} # Additional templates that should be rendered to pages, maps page names to # template names. -# # html_additional_pages = {} # If false, no module index is generated. -# # html_domain_indices = True # If false, no index is generated. -# # html_use_index = True # If true, the index is split into individual pages for each letter. -# # html_split_index = False # If true, links to the reST sources are added to the pages. -# # html_show_sourcelink = True # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. -# # html_show_sphinx = True # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. -# # html_show_copyright = True # If true, an OpenSearch description file will be output, and all pages will # contain a tag referring to it. The value of this option must be the # base URL from which the finished HTML is served. -# # html_use_opensearch = '' # This is the file name suffix for HTML files (e.g. ".xhtml"). @@ -253,39 +236,43 @@ # Language to be used for generating the HTML full-text search index. # Sphinx supports the following languages: # 'da', 'de', 'en', 'es', 'fi', 'fr', 'hu', 'it', 'ja' -# 'nl', 'no', 'pt', 'ro', 'ru', 'sv', 'tr', 'zh' -# +# 'nl', 'no', 'pt', 'ro', 'ru', 'sv', 'tr' # html_search_language = 'en' # A dictionary with options for the search language support, empty by default. -# 'ja' uses this config value. -# 'zh' user can custom change `jieba` dictionary path. -# +# Now only 'ja' uses this config value # html_search_options = {'type': 'default'} # The name of a javascript file (relative to the configuration directory) that # implements a search results scorer. If empty, the default will be used. -# # html_search_scorer = 'scorer.js' # Output file base name for HTML help builder. -htmlhelp_basename = "pandas-gbqdoc" +htmlhelp_basename = "google-cloud-bigquery-storage-doc" + +# -- Options for warnings ------------------------------------------------------ + + +suppress_warnings = [ + # Temporarily suppress this to avoid "more than one target found for + # cross-reference" warning, which are intractable for us to avoid while in + # a mono-repo. + # See https://github.com/sphinx-doc/sphinx/blob + # /2a65ffeef5c107c19084fabdd706cdff3f52d93c/sphinx/domains/python.py#L843 + "ref.python" +] # -- Options for LaTeX output --------------------------------------------- latex_elements = { # The paper size ('letterpaper' or 'a4paper'). - # - # 'papersize': 'letterpaper', + #'papersize': 'letterpaper', # The font size ('10pt', '11pt' or '12pt'). - # - # 'pointsize': '10pt', + #'pointsize': '10pt', # Additional stuff for the LaTeX preamble. - # - # 'preamble': '', + #'preamble': '', # Latex figure (float) alignment - # - # 'figure_align': 'htbp', + #'figure_align': 'htbp', } # Grouping the document tree into LaTeX files. List of tuples @@ -293,44 +280,32 @@ # author, documentclass [howto, manual, or own class]). latex_documents = [ ( - master_doc, - "pandas-gbq.tex", - u"pandas-gbq Documentation", - u"PyData Development Team", + root_doc, + "google-cloud-bigquery-storage.tex", + "google-cloud-bigquery-storage Documentation", + author, "manual", ) ] # The name of an image file (relative to this directory) to place at the top of # the title page. -# # latex_logo = None # For "manual" documents, if this is true, then toplevel headings are parts, # not chapters. -# # latex_use_parts = False # If true, show page references after internal links. -# # latex_show_pagerefs = False # If true, show URL addresses after external links. -# # latex_show_urls = False # Documents to append as an appendix to all manuals. -# # latex_appendices = [] -# It false, will not define \strong, \code, itleref, \crossref ... but only -# \sphinxstrong, ..., \sphinxtitleref, ... To help avoid clash with user added -# packages. -# -# latex_keep_old_macro_names = True - # If false, no module index is generated. -# # latex_domain_indices = True @@ -338,10 +313,17 @@ # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). -man_pages = [(master_doc, "pandas-gbq", u"pandas-gbq Documentation", [author], 1)] +man_pages = [ + ( + root_doc, + "google-cloud-bigquery-storage", + "google-cloud-bigquery-storage Documentation", + [author], + 1, + ) +] # If true, show URL addresses after external links. -# # man_show_urls = False @@ -352,42 +334,53 @@ # dir menu entry, description, category) texinfo_documents = [ ( - master_doc, - "pandas-gbq", - u"pandas-gbq Documentation", + root_doc, + "google-cloud-bigquery-storage", + "google-cloud-bigquery-storage Documentation", author, - "pandas-gbq", - "One line description of project.", - "Miscellaneous", + "google-cloud-bigquery-storage", + "google-cloud-bigquery-storage Library", + "APIs", ) ] # Documents to append as an appendix to all manuals. -# # texinfo_appendices = [] # If false, no module index is generated. -# # texinfo_domain_indices = True # How to display URL addresses: 'footnote', 'no', or 'inline'. -# # texinfo_show_urls = 'footnote' # If true, do not generate a @detailmenu in the "Top" node's menu. -# # texinfo_no_detailmenu = False -# Configuration for intersphinx: +# Example configuration for intersphinx: refer to the Python standard library. intersphinx_mapping = { - "https://docs.python.org/": None, - "https://pandas.pydata.org/pandas-docs/stable/": None, - "https://pydata-google-auth.readthedocs.io/en/latest/": None, - "https://google-auth.readthedocs.io/en/latest/": None, + "python": ("https://python.readthedocs.org/en/latest/", None), + "google-auth": ("https://googleapis.dev/python/google-auth/latest/", None), + "google.api_core": ("https://googleapis.dev/python/google-api-core/latest/", None,), + "grpc": ("https://grpc.github.io/grpc/python/", None), + "proto-plus": ("https://proto-plus-python.readthedocs.io/en/latest/", None), + "protobuf": ("https://googleapis.dev/python/protobuf/latest/", None), + "pandas": ("https://pandas.pydata.org/pandas-docs/stable/", None), + "pydata-google-auth": ( + "https://pydata-google-auth.readthedocs.io/en/latest/", + None, + ), } -extlinks = { - "issue": ("https://github.com/pydata/pandas-gbq/issues/%s", "GH#"), - "pr": ("https://github.com/pydata/pandas-gbq/pull/%s", "GH#"), -} + +# Napoleon settings +napoleon_google_docstring = True +napoleon_numpy_docstring = True +napoleon_include_private_with_doc = False +napoleon_include_special_with_doc = True +napoleon_use_admonition_for_examples = False +napoleon_use_admonition_for_notes = False +napoleon_use_admonition_for_references = False +napoleon_use_ivar = False +napoleon_use_param = True +napoleon_use_rtype = True diff --git a/docs/source/contributing.rst b/docs/contributing.rst similarity index 99% rename from docs/source/contributing.rst rename to docs/contributing.rst index 3bd86849..4a17e803 100644 --- a/docs/source/contributing.rst +++ b/docs/contributing.rst @@ -335,7 +335,7 @@ Documenting your code --------------------- Changes should follow convential commits. The release-please bot uses the -commit message to create an ongoing change log. +commit message to create an ongoing change log. If your code is an enhancement, it is most likely necessary to add usage examples to the existing documentation. Further, to let users know when diff --git a/docs/source/howto/authentication.rst b/docs/howto/authentication.rst similarity index 100% rename from docs/source/howto/authentication.rst rename to docs/howto/authentication.rst diff --git a/docs/source/index.rst b/docs/index.rst similarity index 100% rename from docs/source/index.rst rename to docs/index.rst diff --git a/docs/source/install.rst b/docs/install.rst similarity index 100% rename from docs/source/install.rst rename to docs/install.rst diff --git a/docs/source/intro.rst b/docs/intro.rst similarity index 100% rename from docs/source/intro.rst rename to docs/intro.rst diff --git a/docs/source/privacy.rst b/docs/privacy.rst similarity index 100% rename from docs/source/privacy.rst rename to docs/privacy.rst diff --git a/docs/source/reading.rst b/docs/reading.rst similarity index 100% rename from docs/source/reading.rst rename to docs/reading.rst diff --git a/docs/samples b/docs/samples new file mode 120000 index 00000000..e804737e --- /dev/null +++ b/docs/samples @@ -0,0 +1 @@ +../samples \ No newline at end of file diff --git a/docs/source/changelog.md b/docs/source/changelog.md deleted file mode 120000 index 699cc9e7..00000000 --- a/docs/source/changelog.md +++ /dev/null @@ -1 +0,0 @@ -../../CHANGELOG.md \ No newline at end of file diff --git a/docs/source/samples b/docs/source/samples deleted file mode 120000 index 47920198..00000000 --- a/docs/source/samples +++ /dev/null @@ -1 +0,0 @@ -../../samples \ No newline at end of file diff --git a/docs/source/writing.rst b/docs/writing.rst similarity index 100% rename from docs/source/writing.rst rename to docs/writing.rst diff --git a/noxfile.py b/noxfile.py index b8a3a985..1b65ae79 100644 --- a/noxfile.py +++ b/noxfile.py @@ -92,12 +92,12 @@ def cover(session): @nox.session(python=DEFAULT_PYTHON_VERSION) def docs(session): - """Build the docs.""" + """Build the docs for this library.""" - session.install("-r", os.path.join("docs", "requirements-docs.txt")) session.install("-e", ".") + session.install("sphinx==4.0.1", "alabaster", "recommonmark") - shutil.rmtree(os.path.join("docs", "source", "_build"), ignore_errors=True) + shutil.rmtree(os.path.join("docs", "_build"), ignore_errors=True) session.run( "sphinx-build", "-W", # warnings as errors @@ -106,9 +106,9 @@ def docs(session): "-b", "html", "-d", - os.path.join("docs", "source", "_build", "doctrees", ""), - os.path.join("docs", "source", ""), - os.path.join("docs", "source", "_build", "html", ""), + os.path.join("docs", "_build", "doctrees", ""), + os.path.join("docs", ""), + os.path.join("docs", "_build", "html", ""), ) diff --git a/samples/samples b/samples/samples deleted file mode 120000 index d9d97bb8..00000000 --- a/samples/samples +++ /dev/null @@ -1 +0,0 @@ -docs/source/samples \ No newline at end of file diff --git a/samples/tests/__init__.py b/samples/snippets/__init__.py similarity index 100% rename from samples/tests/__init__.py rename to samples/snippets/__init__.py diff --git a/samples/tests/conftest.py b/samples/snippets/conftest.py similarity index 100% rename from samples/tests/conftest.py rename to samples/snippets/conftest.py diff --git a/samples/tests/test_read_gbq.py b/samples/snippets/test_read_gbq.py similarity index 100% rename from samples/tests/test_read_gbq.py rename to samples/snippets/test_read_gbq.py diff --git a/samples/tests/test_to_gbq.py b/samples/snippets/test_to_gbq.py similarity index 100% rename from samples/tests/test_to_gbq.py rename to samples/snippets/test_to_gbq.py From 19eaceb4d108dd720cf207d6ee9f00abad1f0c5d Mon Sep 17 00:00:00 2001 From: Tim Swast Date: Fri, 24 Sep 2021 12:16:25 -0500 Subject: [PATCH 2/2] migrate samples to new layout too --- docs/conf.py | 36 +++++++---------------- docs/intro.rst | 6 ++-- docs/reading.rst | 4 +-- docs/writing.rst | 2 +- noxfile.py | 2 +- samples/__init__.py | 3 -- samples/{ => snippets}/read_gbq_legacy.py | 0 samples/{ => snippets}/read_gbq_simple.py | 0 samples/snippets/test_read_gbq.py | 4 +-- samples/snippets/test_to_gbq.py | 2 +- samples/{ => snippets}/to_gbq_simple.py | 0 11 files changed, 21 insertions(+), 38 deletions(-) delete mode 100644 samples/__init__.py rename samples/{ => snippets}/read_gbq_legacy.py (100%) rename samples/{ => snippets}/read_gbq_simple.py (100%) rename samples/{ => snippets}/to_gbq_simple.py (100%) diff --git a/docs/conf.py b/docs/conf.py index 79e0c2aa..a4eed21b 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -13,7 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # -# google-cloud-bigquery-storage documentation build configuration file +# pandas-gbq documentation build configuration file # # This file is execfile()d with the current directory set to its # containing dir. @@ -80,7 +80,7 @@ root_doc = "index" # General information about the project. -project = "google-cloud-bigquery-storage" +project = "pandas-gbq" copyright = "2019, Google" author = "Google APIs" @@ -154,9 +154,9 @@ # further. For a list of options available for each theme, see the # documentation. html_theme_options = { - "description": "Google Cloud Client Libraries for google-cloud-bigquery-storage", + "description": "Google Cloud Client Libraries for pandas-gbq", "github_user": "googleapis", - "github_repo": "python-bigquery-storage", + "github_repo": "python-bigquery-pandas", "github_banner": True, "font_family": "'Roboto', Georgia, sans", "head_font_family": "'Roboto', Georgia, serif", @@ -248,7 +248,7 @@ # html_search_scorer = 'scorer.js' # Output file base name for HTML help builder. -htmlhelp_basename = "google-cloud-bigquery-storage-doc" +htmlhelp_basename = "pandas-gbq-doc" # -- Options for warnings ------------------------------------------------------ @@ -279,13 +279,7 @@ # (source start file, target name, title, # author, documentclass [howto, manual, or own class]). latex_documents = [ - ( - root_doc, - "google-cloud-bigquery-storage.tex", - "google-cloud-bigquery-storage Documentation", - author, - "manual", - ) + (root_doc, "pandas-gbq.tex", "pandas-gbq Documentation", author, "manual",) ] # The name of an image file (relative to this directory) to place at the top of @@ -313,15 +307,7 @@ # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). -man_pages = [ - ( - root_doc, - "google-cloud-bigquery-storage", - "google-cloud-bigquery-storage Documentation", - [author], - 1, - ) -] +man_pages = [(root_doc, "pandas-gbq", "pandas-gbq Documentation", [author], 1,)] # If true, show URL addresses after external links. # man_show_urls = False @@ -335,11 +321,11 @@ texinfo_documents = [ ( root_doc, - "google-cloud-bigquery-storage", - "google-cloud-bigquery-storage Documentation", + "pandas-gbq", + "pandas-gbq Documentation", author, - "google-cloud-bigquery-storage", - "google-cloud-bigquery-storage Library", + "pandas-gbq", + "pandas-gbq Library", "APIs", ) ] diff --git a/docs/intro.rst b/docs/intro.rst index e506ebe7..c6774b15 100644 --- a/docs/intro.rst +++ b/docs/intro.rst @@ -27,7 +27,7 @@ Reading data from BigQuery Use the :func:`pandas_gbq.read_gbq` function to run a BigQuery query and download the results as a :class:`pandas.DataFrame` object. -.. literalinclude:: samples/read_gbq_simple.py +.. literalinclude:: samples/snippets/read_gbq_simple.py :language: python :dedent: 4 :start-after: [START bigquery_pandas_gbq_read_gbq_simple] @@ -44,7 +44,7 @@ longer queries. IPython & Jupyter by default attach a handler to the logger. If you're running in another process and want to see logs, or you want to see more verbose logs, you can do something like: -.. code-block:: ipython +.. code-block:: python import logging logger = logging.getLogger('pandas_gbq') @@ -57,7 +57,7 @@ Writing data to BigQuery Use the :func:`pandas_gbq.to_gbq` function to write a :class:`pandas.DataFrame` object to a BigQuery table. -.. literalinclude:: samples/to_gbq_simple.py +.. literalinclude:: samples/snippets/to_gbq_simple.py :language: python :dedent: 4 :start-after: [START bigquery_pandas_gbq_to_gbq_simple] diff --git a/docs/reading.rst b/docs/reading.rst index 67919c57..aaecf9a0 100644 --- a/docs/reading.rst +++ b/docs/reading.rst @@ -6,7 +6,7 @@ Reading Tables Use the :func:`pandas_gbq.read_gbq` function to run a BigQuery query and download the results as a :class:`pandas.DataFrame` object. -.. literalinclude:: samples/read_gbq_simple.py +.. literalinclude:: samples/snippets/read_gbq_simple.py :language: python :dedent: 4 :start-after: [START bigquery_pandas_gbq_read_gbq_simple] @@ -37,7 +37,7 @@ The ``dialect`` argument can be used to indicate whether to use BigQuery's ``'legacy'`` SQL or BigQuery's ``'standard'`` SQL. The default value is ``'standard'``. -.. literalinclude:: samples/read_gbq_legacy.py +.. literalinclude:: samples/snippets/read_gbq_legacy.py :language: python :dedent: 4 :start-after: [START bigquery_pandas_gbq_read_gbq_legacy] diff --git a/docs/writing.rst b/docs/writing.rst index a6a5c123..6c1be272 100644 --- a/docs/writing.rst +++ b/docs/writing.rst @@ -6,7 +6,7 @@ Writing Tables Use the :func:`pandas_gbq.to_gbq` function to write a :class:`pandas.DataFrame` object to a BigQuery table. -.. literalinclude:: samples/to_gbq_simple.py +.. literalinclude:: samples/snippets/to_gbq_simple.py :language: python :dedent: 4 :start-after: [START bigquery_pandas_gbq_to_gbq_simple] diff --git a/noxfile.py b/noxfile.py index 1b65ae79..ab50d5d7 100644 --- a/noxfile.py +++ b/noxfile.py @@ -132,7 +132,7 @@ def system(session): session.run( "pytest", os.path.join(".", "tests", "system"), - os.path.join(".", "samples", "tests"), + os.path.join(".", "samples", "snippets"), "-v", *additional_args, ) diff --git a/samples/__init__.py b/samples/__init__.py deleted file mode 100644 index c9ab8506..00000000 --- a/samples/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -# Copyright (c) 2017 pandas-gbq Authors All rights reserved. -# Use of this source code is governed by a BSD-style -# license that can be found in the LICENSE file. diff --git a/samples/read_gbq_legacy.py b/samples/snippets/read_gbq_legacy.py similarity index 100% rename from samples/read_gbq_legacy.py rename to samples/snippets/read_gbq_legacy.py diff --git a/samples/read_gbq_simple.py b/samples/snippets/read_gbq_simple.py similarity index 100% rename from samples/read_gbq_simple.py rename to samples/snippets/read_gbq_simple.py diff --git a/samples/snippets/test_read_gbq.py b/samples/snippets/test_read_gbq.py index 1882ded0..8f4992d7 100644 --- a/samples/snippets/test_read_gbq.py +++ b/samples/snippets/test_read_gbq.py @@ -4,8 +4,8 @@ """System tests for read_gbq code samples.""" -from .. import read_gbq_legacy -from .. import read_gbq_simple +from . import read_gbq_legacy +from . import read_gbq_simple def test_read_gbq_legacy(project_id): diff --git a/samples/snippets/test_to_gbq.py b/samples/snippets/test_to_gbq.py index c25b9059..f4208974 100644 --- a/samples/snippets/test_to_gbq.py +++ b/samples/snippets/test_to_gbq.py @@ -4,7 +4,7 @@ """System tests for to_gbq code samples.""" -from .. import to_gbq_simple +from . import to_gbq_simple def test_to_gbq_simple(project_id, bigquery_client, random_dataset_id): diff --git a/samples/to_gbq_simple.py b/samples/snippets/to_gbq_simple.py similarity index 100% rename from samples/to_gbq_simple.py rename to samples/snippets/to_gbq_simple.py