diff --git a/docs/index.rst b/docs/index.rst index 5657b1a10ab8..44e34fa54f5e 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -22,7 +22,7 @@ oslogin/index resource-manager/api runtimeconfig/usage - spanner/usage + spanner/index speech/index error-reporting/usage monitoring/index diff --git a/docs/spanner b/docs/spanner new file mode 120000 index 000000000000..e934485326b2 --- /dev/null +++ b/docs/spanner @@ -0,0 +1 @@ +../spanner/docs/ \ No newline at end of file diff --git a/docs/spanner/changelog.md b/docs/spanner/changelog.md deleted file mode 120000 index 2bf6bca87367..000000000000 --- a/docs/spanner/changelog.md +++ /dev/null @@ -1 +0,0 @@ -../../spanner/CHANGELOG.md \ No newline at end of file diff --git a/spanner/README.rst b/spanner/README.rst index 98d647ed7bbe..a596b827a801 100644 --- a/spanner/README.rst +++ b/spanner/README.rst @@ -1,54 +1,82 @@ Python Client for Cloud Spanner =============================== - Python idiomatic client for `Cloud Spanner`_. +|pypi| |versions| -.. _Cloud Spanner: https://cloud.google.com/spanner/ +`Cloud Spanner`_ is the world's first fully managed relational database service +to offer both strong consistency and horizontal scalability for +mission-critical online transaction processing (OLTP) applications. With Cloud +Spanner you enjoy all the traditional benefits of a relational database; but +unlike any other relational database service, Cloud Spanner scales horizontally +to hundreds or thousands of servers to handle the biggest transactional +workloads. -|pypi| |versions| -- `Documentation`_ +- `Client Library Documentation`_ +- `Product Documentation`_ -.. _Documentation: https://googlecloudplatform.github.io/google-cloud-python/latest/spanner/usage.html + +.. |pypi| image:: https://img.shields.io/pypi/v/google-cloud-spanner.svg + :target: https://pypi.org/project/google-cloud-spanner/ +.. |versions| image:: https://img.shields.io/pypi/pyversions/google-cloud-spanner.svg + :target: https://pypi.org/project/google-cloud-spanner/ +.. _Cloud Spanner: https://cloud.google.com/spanner/ +.. _Client Library Documentation: https://googlecloudplatform.github.io/google-cloud-python/latest/spanner/index.html +.. _Product Documentation: https://cloud.google.com/spanner/docs Quick Start ----------- -.. code-block:: console +In order to use this library, you first need to go through the following steps: - $ pip install --upgrade google-cloud-spanner +1. `Select or create a Cloud Platform project.`_ +2. `Enable billing for your project.`_ +3. `Enable the Google Cloud Datastore API.`_ +4. `Setup Authentication.`_ -For more information on setting up your Python development environment, -such as installing ``pip`` and ``virtualenv`` on your system, please refer -to `Python Development Environment Setup Guide`_ for Google Cloud Platform. +.. _Select or create a Cloud Platform project.: https://console.cloud.google.com/project +.. _Enable billing for your project.: https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project +.. _Enable the Google Cloud Datastore API.: https://cloud.google.com/datastore +.. _Setup Authentication.: https://googlecloudplatform.github.io/google-cloud-python/latest/core/auth.html -.. _Python Development Environment Setup Guide: https://cloud.google.com/python/setup +Installation +~~~~~~~~~~~~ +Install this library in a `virtualenv`_ using pip. `virtualenv`_ is a tool to +create isolated Python environments. The basic problem it addresses is one of +dependencies and versions, and indirectly permissions. -Authentication --------------- +With `virtualenv`_, it's possible to install this library without needing system +install permissions, and without clashing with the installed system +dependencies. -With ``google-cloud-python`` we try to make authentication as painless as -possible. Check out the `Authentication section`_ in our documentation to -learn more. You may also find the `authentication document`_ shared by all -the ``google-cloud-*`` libraries to be helpful. +.. _`virtualenv`: https://virtualenv.pypa.io/en/latest/ -.. _Authentication section: https://google-cloud-python.readthedocs.io/en/latest/core/auth.html -.. _authentication document: https://github.com/GoogleCloudPlatform/google-cloud-common/tree/master/authentication +Mac/Linux +^^^^^^^^^ -Using the API -------------- +.. code-block:: console -Cloud Spanner is the world’s first fully managed relational database service -to offer both strong consistency and horizontal scalability for -mission-critical online transaction processing (OLTP) applications. With Cloud -Spanner you enjoy all the traditional benefits of a relational database; but -unlike any other relational database service, Cloud Spanner scales -horizontally to hundreds or thousands of servers to handle the biggest -transactional workloads. (`About Cloud Spanner`_) + pip install virtualenv + virtualenv + source /bin/activate + /bin/pip install google-cloud-datastore + + +Windows +^^^^^^^ -.. _About Cloud Spanner: https://cloud.google.com/spanner/ +.. code-block:: console + + pip install virtualenv + virtualenv + \Scripts\activate + \Scripts\pip.exe install google-cloud-datastore + + +Example Usage +------------- Executing Arbitrary SQL in a Transaction @@ -152,15 +180,10 @@ if any of the records does not already exist. ) -Learn More ----------- - -See the ``google-cloud-python`` API `Cloud Spanner documentation`_ to learn how -to connect to Cloud Spanner using this Client Library. +Next Steps +~~~~~~~~~~ -.. _Cloud Spanner documentation: https://googlecloudplatform.github.io/google-cloud-python/latest/spanner/usage.html - -.. |pypi| image:: https://img.shields.io/pypi/v/google-cloud-spanner.svg - :target: https://pypi.org/project/google-cloud-spanner/ -.. |versions| image:: https://img.shields.io/pypi/pyversions/google-cloud-spanner.svg - :target: https://pypi.org/project/google-cloud-spanner/ +- See the `Client Library Documentation`_ to learn how to connect to Cloud + Spanner using this Client Library. +- Read the `Product documentation`_ to learn + more about the product and see How-to Guides. diff --git a/docs/spanner/advanced-session-pool-topics.rst b/spanner/docs/advanced-session-pool-topics.rst similarity index 100% rename from docs/spanner/advanced-session-pool-topics.rst rename to spanner/docs/advanced-session-pool-topics.rst diff --git a/docs/spanner/api-reference.rst b/spanner/docs/api-reference.rst similarity index 100% rename from docs/spanner/api-reference.rst rename to spanner/docs/api-reference.rst diff --git a/docs/spanner/batch-api.rst b/spanner/docs/batch-api.rst similarity index 100% rename from docs/spanner/batch-api.rst rename to spanner/docs/batch-api.rst diff --git a/docs/spanner/batch-usage.rst b/spanner/docs/batch-usage.rst similarity index 100% rename from docs/spanner/batch-usage.rst rename to spanner/docs/batch-usage.rst diff --git a/spanner/docs/changelog.md b/spanner/docs/changelog.md new file mode 120000 index 000000000000..04c99a55caae --- /dev/null +++ b/spanner/docs/changelog.md @@ -0,0 +1 @@ +../CHANGELOG.md \ No newline at end of file diff --git a/docs/spanner/client-api.rst b/spanner/docs/client-api.rst similarity index 100% rename from docs/spanner/client-api.rst rename to spanner/docs/client-api.rst diff --git a/docs/spanner/usage.rst b/spanner/docs/client-usage.rst similarity index 61% rename from docs/spanner/usage.rst rename to spanner/docs/client-usage.rst index 908fe17d4868..45098ea416c3 100644 --- a/docs/spanner/usage.rst +++ b/spanner/docs/client-usage.rst @@ -1,38 +1,3 @@ -Spanner -^^^^^^^ - -`Cloud Spanner`_ is the world's first fully managed relational database service -to offer both strong consistency and horizontal scalability for -mission-critical online transaction processing (OLTP) applications. With Cloud -Spanner you enjoy all the traditional benefits of a relational database; but -unlike any other relational database service, Cloud Spanner scales horizontally -to hundreds or thousands of servers to handle the biggest transactional -workloads. - -.. _Cloud Spanner: https://cloud.google.com/spanner/ - -.. toctree:: - :maxdepth: 1 - :titlesonly: - :hidden: - - instance-usage - database-usage - batch-usage - snapshot-usage - transaction-usage - advanced-session-pool-topics - api-reference - -Installation -============ - -Install the ``google-cloud-spanner`` library using ``pip``: - -.. code-block:: console - - $ pip install google-cloud-spanner - Spanner Client ============== @@ -95,13 +60,18 @@ Configuration Be sure to use the **Project ID**, not the **Project Number**. + Warnings about Multiprocessing -------------------------------------------------- -- When using multiprocessing, the application may hang if a - :class:`Client ` instance is created before - :class:`multiprocessing.Pool` or :class:`multiprocessing.Process` invokes :func:`os.fork`. - The issue is under investigation, but may be only happening on Macintosh and not Linux. - See `GRPC/GRPC#12455 `_ for more information. +------------------------------ + +.. warning:: + When using multiprocessing, the application may hang if a + :class:`Client ` instance is created + before :class:`multiprocessing.Pool` or :class:`multiprocessing.Process` + invokes :func:`os.fork`. The issue is under investigation, but may be only + happening on Macintosh and not Linux. See `GRPC/GRPC#12455 + `_ for + more information. Next Step --------- @@ -114,13 +84,3 @@ Next, learn about the :doc:`instance-usage`. .. _Instance Admin: https://cloud.google.com/spanner/reference/rpc/google.spanner.admin.instance.v1 .. _Database Admin: https://cloud.google.com/spanner/reference/rpc/google.spanner.admin.database.v1 - -Changelog -========= - -For a list of all ``google-cloud-spanner`` releases: - -.. toctree:: - :maxdepth: 2 - - changelog diff --git a/spanner/docs/conf.py b/spanner/docs/conf.py new file mode 100644 index 000000000000..ab0cc0fa9598 --- /dev/null +++ b/spanner/docs/conf.py @@ -0,0 +1,317 @@ +# -*- coding: utf-8 -*- +# +# google-cloud-spanner documentation build configuration file +# +# This file is execfile()d with the current directory set to its +# containing dir. +# +# Note that not all possible configuration values are present in this +# autogenerated file. +# +# 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. +sys.path.insert(0, os.path.abspath('..')) + +__version__ = '0.90.4' + +# -- General configuration ------------------------------------------------ + +# If your documentation needs a minimal Sphinx version, state it here. +#needs_sphinx = '1.0' + +# 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', + 'sphinx.ext.autosummary', + 'sphinx.ext.doctest', + 'sphinx.ext.intersphinx', + 'sphinx.ext.coverage', + 'sphinx.ext.napoleon', + 'sphinx.ext.viewcode', +] + +# autodoc/autosummary flags +autoclass_content = 'both' +autodoc_default_flags = ['members'] +autosummary_generate = True + +# Add any paths that contain templates here, relative to this directory. +templates_path = ['_templates'] + +# Allow markdown includes (so releases.md can include CHANGLEOG.md) +# http://www.sphinx-doc.org/en/master/markdown.html +source_parsers = { + '.md': 'recommonmark.parser.CommonMarkParser', +} + +# The suffix(es) of source filenames. +# You can specify multiple suffix as a list of string: +# source_suffix = ['.rst', '.md'] +source_suffix = '.rst' + +# The encoding of source files. +#source_encoding = 'utf-8-sig' + +# The master toctree document. +master_doc = 'index' + +# General information about the project. +project = u'google-cloud-spanner' +copyright = u'2017, Google' +author = u'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 full version, including alpha/beta/rc tags. +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. +# +# This is also used if you do content translation via gettext catalogs. +# Usually you set "language" from the command line for these cases. +language = None + +# 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 +# directories to ignore when looking for source files. +exclude_patterns = ['_build'] + +# 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. +pygments_style = 'sphinx' + +# A list of ignored prefixes for module index sorting. +#modindex_common_prefix = [] + +# If true, keep warnings as "system message" paragraphs in the built documents. +#keep_warnings = False + +# If true, `todo` and `todoList` produce output, else they produce nothing. +todo_include_todos = True + +# -- 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 = '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 = {} + +# Add any paths that contain custom themes here, relative to this directory. +#html_theme_path = [] + +# 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 (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, +# 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 = [] + +# 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 '', 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"). +#html_file_suffix = None + +# 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' +#html_search_language = 'en' + +# A dictionary with options for the search language support, empty by default. +# 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 = 'google-cloud-spanner-doc' + +# -- Options for LaTeX output --------------------------------------------- + +latex_elements = { + # The paper size ('letterpaper' or 'a4paper'). + #'papersize': 'letterpaper', + + # The font size ('10pt', '11pt' or '12pt'). + #'pointsize': '10pt', + + # Additional stuff for the LaTeX preamble. + #'preamble': '', + + # Latex figure (float) alignment + #'figure_align': 'htbp', +} + +# Grouping the document tree into LaTeX files. List of tuples +# (source start file, target name, title, +# author, documentclass [howto, manual, or own class]). +latex_documents = [ + (master_doc, 'google-cloud-spanner.tex', + u'google-cloud-spanner 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 = [] + +# If false, no module index is generated. +#latex_domain_indices = True + +# -- Options for manual page output --------------------------------------- + +# One entry per manual page. List of tuples +# (source start file, name, description, authors, manual section). +man_pages = [(master_doc, 'google-cloud-spanner', + u'google-cloud-spanner Documentation', [author], 1)] + +# If true, show URL addresses after external links. +#man_show_urls = False + +# -- Options for Texinfo output ------------------------------------------- + +# Grouping the document tree into Texinfo files. List of tuples +# (source start file, target name, title, author, +# dir menu entry, description, category) +texinfo_documents = [ + (master_doc, 'google-cloud-spanner', + u'google-cloud-spanner Documentation', author, 'google-cloud-spanner', + 'GAPIC library for the {metadata.shortName} v1 service', '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 + +# Example configuration for intersphinx: refer to the Python standard library. +intersphinx_mapping = { + 'python': ('http://python.readthedocs.org/en/latest/', None), + 'gax': ('https://gax-python.readthedocs.org/en/latest/', None), +} + +# 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/spanner/database-api.rst b/spanner/docs/database-api.rst similarity index 100% rename from docs/spanner/database-api.rst rename to spanner/docs/database-api.rst diff --git a/docs/spanner/database-usage.rst b/spanner/docs/database-usage.rst similarity index 100% rename from docs/spanner/database-usage.rst rename to spanner/docs/database-usage.rst diff --git a/docs/spanner/gapic/v1/admin_database_api.rst b/spanner/docs/gapic/v1/admin_database_api.rst similarity index 100% rename from docs/spanner/gapic/v1/admin_database_api.rst rename to spanner/docs/gapic/v1/admin_database_api.rst diff --git a/docs/spanner/gapic/v1/admin_database_types.rst b/spanner/docs/gapic/v1/admin_database_types.rst similarity index 100% rename from docs/spanner/gapic/v1/admin_database_types.rst rename to spanner/docs/gapic/v1/admin_database_types.rst diff --git a/docs/spanner/gapic/v1/admin_instance_api.rst b/spanner/docs/gapic/v1/admin_instance_api.rst similarity index 100% rename from docs/spanner/gapic/v1/admin_instance_api.rst rename to spanner/docs/gapic/v1/admin_instance_api.rst diff --git a/docs/spanner/gapic/v1/admin_instance_types.rst b/spanner/docs/gapic/v1/admin_instance_types.rst similarity index 100% rename from docs/spanner/gapic/v1/admin_instance_types.rst rename to spanner/docs/gapic/v1/admin_instance_types.rst diff --git a/docs/spanner/gapic/v1/api.rst b/spanner/docs/gapic/v1/api.rst similarity index 100% rename from docs/spanner/gapic/v1/api.rst rename to spanner/docs/gapic/v1/api.rst diff --git a/docs/spanner/gapic/v1/transactions.rst b/spanner/docs/gapic/v1/transactions.rst similarity index 100% rename from docs/spanner/gapic/v1/transactions.rst rename to spanner/docs/gapic/v1/transactions.rst diff --git a/docs/spanner/gapic/v1/types.rst b/spanner/docs/gapic/v1/types.rst similarity index 100% rename from docs/spanner/gapic/v1/types.rst rename to spanner/docs/gapic/v1/types.rst diff --git a/spanner/docs/index.rst b/spanner/docs/index.rst new file mode 100644 index 000000000000..8bfbf428c3a3 --- /dev/null +++ b/spanner/docs/index.rst @@ -0,0 +1,33 @@ +.. include:: /../spanner/README.rst + +Usage Documentation +------------------- +.. toctree:: + :maxdepth: 1 + :titlesonly: + + client-usage + instance-usage + database-usage + batch-usage + snapshot-usage + transaction-usage + +API Documentation +----------------- +.. toctree:: + :maxdepth: 1 + :titlesonly: + + api-reference + advanced-session-pool-topics + +Changelog +========= + +For a list of all ``google-cloud-spanner`` releases: + +.. toctree:: + :maxdepth: 2 + + changelog diff --git a/docs/spanner/instance-api.rst b/spanner/docs/instance-api.rst similarity index 100% rename from docs/spanner/instance-api.rst rename to spanner/docs/instance-api.rst diff --git a/docs/spanner/instance-usage.rst b/spanner/docs/instance-usage.rst similarity index 100% rename from docs/spanner/instance-usage.rst rename to spanner/docs/instance-usage.rst diff --git a/docs/spanner/keyset-api.rst b/spanner/docs/keyset-api.rst similarity index 100% rename from docs/spanner/keyset-api.rst rename to spanner/docs/keyset-api.rst diff --git a/docs/spanner/session-api.rst b/spanner/docs/session-api.rst similarity index 100% rename from docs/spanner/session-api.rst rename to spanner/docs/session-api.rst diff --git a/docs/spanner/snapshot-api.rst b/spanner/docs/snapshot-api.rst similarity index 100% rename from docs/spanner/snapshot-api.rst rename to spanner/docs/snapshot-api.rst diff --git a/docs/spanner/snapshot-usage.rst b/spanner/docs/snapshot-usage.rst similarity index 100% rename from docs/spanner/snapshot-usage.rst rename to spanner/docs/snapshot-usage.rst diff --git a/docs/spanner/streamed-api.rst b/spanner/docs/streamed-api.rst similarity index 100% rename from docs/spanner/streamed-api.rst rename to spanner/docs/streamed-api.rst diff --git a/docs/spanner/transaction-api.rst b/spanner/docs/transaction-api.rst similarity index 100% rename from docs/spanner/transaction-api.rst rename to spanner/docs/transaction-api.rst diff --git a/docs/spanner/transaction-usage.rst b/spanner/docs/transaction-usage.rst similarity index 100% rename from docs/spanner/transaction-usage.rst rename to spanner/docs/transaction-usage.rst