From d7d9abac33479a5203c0fd1c768db01c93e6f35e Mon Sep 17 00:00:00 2001 From: Danny Hermes Date: Mon, 23 May 2016 10:00:07 -0700 Subject: [PATCH 1/3] Making grpcio install require fewer keystrokes. - Adding an import error with a nice failure message in `gcloud.bigtable` in the absence of `grpcio` - Making `setup.py` include `grpcio` conditional on being Python 2.7 - Adding a warning to every single Bigtable docs page explaining that it can't be used outside of Python 2.7 --- docs/bigtable-client-intro.rst | 6 ++++++ docs/bigtable-client.rst | 6 ++++++ docs/bigtable-cluster-api.rst | 6 ++++++ docs/bigtable-cluster.rst | 6 ++++++ docs/bigtable-column-family.rst | 6 ++++++ docs/bigtable-data-api.rst | 6 ++++++ docs/bigtable-row-data.rst | 6 ++++++ docs/bigtable-row-filters.rst | 6 ++++++ docs/bigtable-row.rst | 6 ++++++ docs/bigtable-table-api.rst | 6 ++++++ docs/bigtable-table.rst | 6 ++++++ docs/bigtable-usage.rst | 7 +++++++ docs/happybase-batch.rst | 6 ++++++ docs/happybase-connection.rst | 6 ++++++ docs/happybase-package.rst | 6 ++++++ docs/happybase-pool.rst | 6 ++++++ docs/happybase-table.rst | 6 ++++++ gcloud/bigtable/__init__.py | 8 ++++++++ scripts/verify_included_modules.py | 8 +++++--- setup.py | 4 ++++ 20 files changed, 120 insertions(+), 3 deletions(-) diff --git a/docs/bigtable-client-intro.rst b/docs/bigtable-client-intro.rst index 3f43371ec1db..22925def4a3b 100644 --- a/docs/bigtable-client-intro.rst +++ b/docs/bigtable-client-intro.rst @@ -1,6 +1,12 @@ Base for Everything =================== +.. warning:: + + gRPC is required for using the Cloud Bigtable API. As of May 2016, + ``grpcio`` is only supported in Python 2.7, so importing + :mod:`gcloud.bigtable` will fail. + To use the API, the :class:`Client ` class defines a high-level interface which handles authorization and creating other objects: diff --git a/docs/bigtable-client.rst b/docs/bigtable-client.rst index fb2d9cec88e4..08e721601cb4 100644 --- a/docs/bigtable-client.rst +++ b/docs/bigtable-client.rst @@ -1,6 +1,12 @@ Client ~~~~~~ +.. warning:: + + gRPC is required for using the Cloud Bigtable API. As of May 2016, + ``grpcio`` is only supported in Python 2.7, so importing + :mod:`gcloud.bigtable` will fail. + .. automodule:: gcloud.bigtable.client :members: :show-inheritance: diff --git a/docs/bigtable-cluster-api.rst b/docs/bigtable-cluster-api.rst index 17fba96840db..b5b6aacbd859 100644 --- a/docs/bigtable-cluster-api.rst +++ b/docs/bigtable-cluster-api.rst @@ -1,6 +1,12 @@ Cluster Admin API ================= +.. warning:: + + gRPC is required for using the Cloud Bigtable API. As of May 2016, + ``grpcio`` is only supported in Python 2.7, so importing + :mod:`gcloud.bigtable` will fail. + After creating a :class:`Client `, you can interact with individual clusters, groups of clusters or available zones for a project. diff --git a/docs/bigtable-cluster.rst b/docs/bigtable-cluster.rst index 9c5276dc462a..09a183836c65 100644 --- a/docs/bigtable-cluster.rst +++ b/docs/bigtable-cluster.rst @@ -1,6 +1,12 @@ Cluster ~~~~~~~ +.. warning:: + + gRPC is required for using the Cloud Bigtable API. As of May 2016, + ``grpcio`` is only supported in Python 2.7, so importing + :mod:`gcloud.bigtable` will fail. + .. automodule:: gcloud.bigtable.cluster :members: :show-inheritance: diff --git a/docs/bigtable-column-family.rst b/docs/bigtable-column-family.rst index 6539e0230d15..37ff32fdb5da 100644 --- a/docs/bigtable-column-family.rst +++ b/docs/bigtable-column-family.rst @@ -1,6 +1,12 @@ Column Families =============== +.. warning:: + + gRPC is required for using the Cloud Bigtable API. As of May 2016, + ``grpcio`` is only supported in Python 2.7, so importing + :mod:`gcloud.bigtable` will fail. + When creating a :class:`ColumnFamily `, it is possible to set garbage collection rules for expired data. diff --git a/docs/bigtable-data-api.rst b/docs/bigtable-data-api.rst index 779efa991886..360041d61b07 100644 --- a/docs/bigtable-data-api.rst +++ b/docs/bigtable-data-api.rst @@ -1,6 +1,12 @@ Data API ======== +.. warning:: + + gRPC is required for using the Cloud Bigtable API. As of May 2016, + ``grpcio`` is only supported in Python 2.7, so importing + :mod:`gcloud.bigtable` will fail. + After creating a :class:`Table ` and some column families, you are ready to store and retrieve data. diff --git a/docs/bigtable-row-data.rst b/docs/bigtable-row-data.rst index 3564f4e7a4b4..aaf474f81080 100644 --- a/docs/bigtable-row-data.rst +++ b/docs/bigtable-row-data.rst @@ -1,6 +1,12 @@ Row Data ~~~~~~~~ +.. warning:: + + gRPC is required for using the Cloud Bigtable API. As of May 2016, + ``grpcio`` is only supported in Python 2.7, so importing + :mod:`gcloud.bigtable` will fail. + .. automodule:: gcloud.bigtable.row_data :members: :show-inheritance: diff --git a/docs/bigtable-row-filters.rst b/docs/bigtable-row-filters.rst index 9796a4c27239..32d59089e392 100644 --- a/docs/bigtable-row-filters.rst +++ b/docs/bigtable-row-filters.rst @@ -1,6 +1,12 @@ Bigtable Row Filters ==================== +.. warning:: + + gRPC is required for using the Cloud Bigtable API. As of May 2016, + ``grpcio`` is only supported in Python 2.7, so importing + :mod:`gcloud.bigtable` will fail. + It is possible to use a :class:`RowFilter ` when adding mutations to a diff --git a/docs/bigtable-row.rst b/docs/bigtable-row.rst index afb52f39782b..42976d98e74c 100644 --- a/docs/bigtable-row.rst +++ b/docs/bigtable-row.rst @@ -1,6 +1,12 @@ Bigtable Row ============ +.. warning:: + + gRPC is required for using the Cloud Bigtable API. As of May 2016, + ``grpcio`` is only supported in Python 2.7, so importing + :mod:`gcloud.bigtable` will fail. + .. automodule:: gcloud.bigtable.row :members: :show-inheritance: diff --git a/docs/bigtable-table-api.rst b/docs/bigtable-table-api.rst index b3108da75a1b..4a08dc8b0ac9 100644 --- a/docs/bigtable-table-api.rst +++ b/docs/bigtable-table-api.rst @@ -1,6 +1,12 @@ Table Admin API =============== +.. warning:: + + gRPC is required for using the Cloud Bigtable API. As of May 2016, + ``grpcio`` is only supported in Python 2.7, so importing + :mod:`gcloud.bigtable` will fail. + After creating a :class:`Cluster `, you can interact with individual tables, groups of tables or column families within a table. diff --git a/docs/bigtable-table.rst b/docs/bigtable-table.rst index 93704aae5d3a..b191a0ad3e47 100644 --- a/docs/bigtable-table.rst +++ b/docs/bigtable-table.rst @@ -1,6 +1,12 @@ Table ~~~~~ +.. warning:: + + gRPC is required for using the Cloud Bigtable API. As of May 2016, + ``grpcio`` is only supported in Python 2.7, so importing + :mod:`gcloud.bigtable` will fail. + .. automodule:: gcloud.bigtable.table :members: :show-inheritance: diff --git a/docs/bigtable-usage.rst b/docs/bigtable-usage.rst index 95faba854e69..c23db80ad14f 100644 --- a/docs/bigtable-usage.rst +++ b/docs/bigtable-usage.rst @@ -1,6 +1,12 @@ Using the API ============= +.. warning:: + + `gRPC`_ is required for using the Cloud Bigtable API. As of May 2016, + `grpcio`_ is only supported in Python 2.7, so importing + :mod:`gcloud.bigtable` will fail. + API requests are sent to the `Google Cloud Bigtable`_ API via RPC over HTTP/2. In order to support this, we'll rely on `gRPC`_. We are working with the gRPC team to rapidly make the install story more user-friendly. @@ -23,3 +29,4 @@ In the hierarchy of API concepts .. _Google Cloud Bigtable: https://cloud.google.com/bigtable/docs/ .. _gRPC: http://www.grpc.io/ +.. _grpcio: https://pypi.python.org/pypi/grpcio diff --git a/docs/happybase-batch.rst b/docs/happybase-batch.rst index 3b512e2bb347..8cda4c5d622d 100644 --- a/docs/happybase-batch.rst +++ b/docs/happybase-batch.rst @@ -1,6 +1,12 @@ HappyBase Batch ~~~~~~~~~~~~~~~ +.. warning:: + + gRPC is required for using the Cloud Bigtable API. As of May 2016, + ``grpcio`` is only supported in Python 2.7, so importing + :mod:`gcloud.bigtable` will fail. + .. automodule:: gcloud.bigtable.happybase.batch :members: :show-inheritance: diff --git a/docs/happybase-connection.rst b/docs/happybase-connection.rst index 700b0b9cfcfa..0cf93a0f51ff 100644 --- a/docs/happybase-connection.rst +++ b/docs/happybase-connection.rst @@ -1,6 +1,12 @@ HappyBase Connection ~~~~~~~~~~~~~~~~~~~~ +.. warning:: + + gRPC is required for using the Cloud Bigtable API. As of May 2016, + ``grpcio`` is only supported in Python 2.7, so importing + :mod:`gcloud.bigtable` will fail. + .. automodule:: gcloud.bigtable.happybase.connection :members: :show-inheritance: diff --git a/docs/happybase-package.rst b/docs/happybase-package.rst index 315ef766f32f..2727ea1128c8 100644 --- a/docs/happybase-package.rst +++ b/docs/happybase-package.rst @@ -1,6 +1,12 @@ HappyBase Package ~~~~~~~~~~~~~~~~~ +.. warning:: + + gRPC is required for using the Cloud Bigtable API. As of May 2016, + ``grpcio`` is only supported in Python 2.7, so importing + :mod:`gcloud.bigtable` will fail. + .. automodule:: gcloud.bigtable.happybase.__init__ :members: :show-inheritance: diff --git a/docs/happybase-pool.rst b/docs/happybase-pool.rst index 40e44a7def52..4fb624d8aa4b 100644 --- a/docs/happybase-pool.rst +++ b/docs/happybase-pool.rst @@ -1,6 +1,12 @@ HappyBase Connection Pool ~~~~~~~~~~~~~~~~~~~~~~~~~ +.. warning:: + + gRPC is required for using the Cloud Bigtable API. As of May 2016, + ``grpcio`` is only supported in Python 2.7, so importing + :mod:`gcloud.bigtable` will fail. + .. automodule:: gcloud.bigtable.happybase.pool :members: :show-inheritance: diff --git a/docs/happybase-table.rst b/docs/happybase-table.rst index d8f6875eb12c..588377ff0c0c 100644 --- a/docs/happybase-table.rst +++ b/docs/happybase-table.rst @@ -1,6 +1,12 @@ HappyBase Table ~~~~~~~~~~~~~~~ +.. warning:: + + gRPC is required for using the Cloud Bigtable API. As of May 2016, + ``grpcio`` is only supported in Python 2.7, so importing + :mod:`gcloud.bigtable` will fail. + .. automodule:: gcloud.bigtable.happybase.table :members: :show-inheritance: diff --git a/gcloud/bigtable/__init__.py b/gcloud/bigtable/__init__.py index 2533a0c69c5b..ee49e8bb1af1 100644 --- a/gcloud/bigtable/__init__.py +++ b/gcloud/bigtable/__init__.py @@ -16,3 +16,11 @@ from gcloud.bigtable.client import Client + +try: + import grpc.beta.implementations +except ImportError as exc: + message = ('gRPC is required for using the Cloud Bigtable API. ' + 'Importing the grpc library (grpcio in PyPI) has failed. ' + 'As of May 2016, grpcio is only supported in Python 2.7.') + raise ImportError(message, exc) diff --git a/scripts/verify_included_modules.py b/scripts/verify_included_modules.py index fcba7d96dfa7..15d387506484 100644 --- a/scripts/verify_included_modules.py +++ b/scripts/verify_included_modules.py @@ -126,9 +126,11 @@ def main(): public_mods = set(public_mods) if not sphinx_mods <= public_mods: - message = ('Unexpected error. There were modules referenced by ' - 'Sphinx that are not among the public modules.') - print(message, file=sys.stderr) + unexpected_mods = sphinx_mods - public_mods + message = ['Unexpected error. There were modules referenced by ' + 'Sphinx that are not among the public modules.'] + message.extend(['- %s' % (mod,) for mod in unexpected_mods]) + print('\n'.join(message), file=sys.stderr) sys.exit(1) undocumented_mods = public_mods - sphinx_mods diff --git a/setup.py b/setup.py index 0fe05e45fce6..08f6b5c75315 100644 --- a/setup.py +++ b/setup.py @@ -1,4 +1,5 @@ import os +import sys from setuptools import setup from setuptools import find_packages @@ -23,6 +24,9 @@ 'gax-google-pubsub-v1', ] +if sys.version_info[:2] == (2, 7): + REQUIREMENTS.extend(GRPC_EXTRAS) + setup( name='gcloud', version='0.14.0', From 9c6753e68e18a55578bd0eea42b1ef04c2820607 Mon Sep 17 00:00:00 2001 From: Danny Hermes Date: Mon, 6 Jun 2016 23:17:48 -0700 Subject: [PATCH 2/3] Addressing JJ review comments. --- docs/bigtable-client-intro.rst | 2 +- docs/bigtable-client.rst | 2 +- docs/bigtable-cluster-api.rst | 2 +- docs/bigtable-cluster.rst | 2 +- docs/bigtable-column-family.rst | 2 +- docs/bigtable-data-api.rst | 2 +- docs/bigtable-row-data.rst | 2 +- docs/bigtable-row-filters.rst | 2 +- docs/bigtable-row.rst | 2 +- docs/bigtable-table-api.rst | 2 +- docs/bigtable-table.rst | 2 +- docs/bigtable-usage.rst | 2 +- docs/happybase-batch.rst | 2 +- docs/happybase-connection.rst | 2 +- docs/happybase-package.rst | 2 +- docs/happybase-pool.rst | 2 +- docs/happybase-table.rst | 2 +- gcloud/bigtable/__init__.py | 22 +++++++++++++++++----- 18 files changed, 34 insertions(+), 22 deletions(-) diff --git a/docs/bigtable-client-intro.rst b/docs/bigtable-client-intro.rst index 22925def4a3b..46dbb0b24544 100644 --- a/docs/bigtable-client-intro.rst +++ b/docs/bigtable-client-intro.rst @@ -5,7 +5,7 @@ Base for Everything gRPC is required for using the Cloud Bigtable API. As of May 2016, ``grpcio`` is only supported in Python 2.7, so importing - :mod:`gcloud.bigtable` will fail. + :mod:`gcloud.bigtable` in other versions of Python in other versions of Python will fail. To use the API, the :class:`Client ` class defines a high-level interface which handles authorization diff --git a/docs/bigtable-client.rst b/docs/bigtable-client.rst index 08e721601cb4..97dc99f1d177 100644 --- a/docs/bigtable-client.rst +++ b/docs/bigtable-client.rst @@ -5,7 +5,7 @@ Client gRPC is required for using the Cloud Bigtable API. As of May 2016, ``grpcio`` is only supported in Python 2.7, so importing - :mod:`gcloud.bigtable` will fail. + :mod:`gcloud.bigtable` in other versions of Python will fail. .. automodule:: gcloud.bigtable.client :members: diff --git a/docs/bigtable-cluster-api.rst b/docs/bigtable-cluster-api.rst index b5b6aacbd859..1266fa8e893a 100644 --- a/docs/bigtable-cluster-api.rst +++ b/docs/bigtable-cluster-api.rst @@ -5,7 +5,7 @@ Cluster Admin API gRPC is required for using the Cloud Bigtable API. As of May 2016, ``grpcio`` is only supported in Python 2.7, so importing - :mod:`gcloud.bigtable` will fail. + :mod:`gcloud.bigtable` in other versions of Python will fail. After creating a :class:`Client `, you can interact with individual clusters, groups of clusters or available diff --git a/docs/bigtable-cluster.rst b/docs/bigtable-cluster.rst index 09a183836c65..f2986b820253 100644 --- a/docs/bigtable-cluster.rst +++ b/docs/bigtable-cluster.rst @@ -5,7 +5,7 @@ Cluster gRPC is required for using the Cloud Bigtable API. As of May 2016, ``grpcio`` is only supported in Python 2.7, so importing - :mod:`gcloud.bigtable` will fail. + :mod:`gcloud.bigtable` in other versions of Python will fail. .. automodule:: gcloud.bigtable.cluster :members: diff --git a/docs/bigtable-column-family.rst b/docs/bigtable-column-family.rst index 37ff32fdb5da..10eb6307dc56 100644 --- a/docs/bigtable-column-family.rst +++ b/docs/bigtable-column-family.rst @@ -5,7 +5,7 @@ Column Families gRPC is required for using the Cloud Bigtable API. As of May 2016, ``grpcio`` is only supported in Python 2.7, so importing - :mod:`gcloud.bigtable` will fail. + :mod:`gcloud.bigtable` in other versions of Python will fail. When creating a :class:`ColumnFamily `, it is diff --git a/docs/bigtable-data-api.rst b/docs/bigtable-data-api.rst index 360041d61b07..13ffd706b373 100644 --- a/docs/bigtable-data-api.rst +++ b/docs/bigtable-data-api.rst @@ -5,7 +5,7 @@ Data API gRPC is required for using the Cloud Bigtable API. As of May 2016, ``grpcio`` is only supported in Python 2.7, so importing - :mod:`gcloud.bigtable` will fail. + :mod:`gcloud.bigtable` in other versions of Python will fail. After creating a :class:`Table ` and some column families, you are ready to store and retrieve data. diff --git a/docs/bigtable-row-data.rst b/docs/bigtable-row-data.rst index aaf474f81080..1d45bb5f2962 100644 --- a/docs/bigtable-row-data.rst +++ b/docs/bigtable-row-data.rst @@ -5,7 +5,7 @@ Row Data gRPC is required for using the Cloud Bigtable API. As of May 2016, ``grpcio`` is only supported in Python 2.7, so importing - :mod:`gcloud.bigtable` will fail. + :mod:`gcloud.bigtable` in other versions of Python will fail. .. automodule:: gcloud.bigtable.row_data :members: diff --git a/docs/bigtable-row-filters.rst b/docs/bigtable-row-filters.rst index 32d59089e392..1b03ef7ef59a 100644 --- a/docs/bigtable-row-filters.rst +++ b/docs/bigtable-row-filters.rst @@ -5,7 +5,7 @@ Bigtable Row Filters gRPC is required for using the Cloud Bigtable API. As of May 2016, ``grpcio`` is only supported in Python 2.7, so importing - :mod:`gcloud.bigtable` will fail. + :mod:`gcloud.bigtable` in other versions of Python will fail. It is possible to use a :class:`RowFilter ` diff --git a/docs/bigtable-row.rst b/docs/bigtable-row.rst index 42976d98e74c..e5c95728fb42 100644 --- a/docs/bigtable-row.rst +++ b/docs/bigtable-row.rst @@ -5,7 +5,7 @@ Bigtable Row gRPC is required for using the Cloud Bigtable API. As of May 2016, ``grpcio`` is only supported in Python 2.7, so importing - :mod:`gcloud.bigtable` will fail. + :mod:`gcloud.bigtable` in other versions of Python will fail. .. automodule:: gcloud.bigtable.row :members: diff --git a/docs/bigtable-table-api.rst b/docs/bigtable-table-api.rst index 4a08dc8b0ac9..6ef4dba1e7e0 100644 --- a/docs/bigtable-table-api.rst +++ b/docs/bigtable-table-api.rst @@ -5,7 +5,7 @@ Table Admin API gRPC is required for using the Cloud Bigtable API. As of May 2016, ``grpcio`` is only supported in Python 2.7, so importing - :mod:`gcloud.bigtable` will fail. + :mod:`gcloud.bigtable` in other versions of Python will fail. After creating a :class:`Cluster `, you can interact with individual tables, groups of tables or column families within diff --git a/docs/bigtable-table.rst b/docs/bigtable-table.rst index b191a0ad3e47..414d567bfd03 100644 --- a/docs/bigtable-table.rst +++ b/docs/bigtable-table.rst @@ -5,7 +5,7 @@ Table gRPC is required for using the Cloud Bigtable API. As of May 2016, ``grpcio`` is only supported in Python 2.7, so importing - :mod:`gcloud.bigtable` will fail. + :mod:`gcloud.bigtable` in other versions of Python will fail. .. automodule:: gcloud.bigtable.table :members: diff --git a/docs/bigtable-usage.rst b/docs/bigtable-usage.rst index c23db80ad14f..61966ac21795 100644 --- a/docs/bigtable-usage.rst +++ b/docs/bigtable-usage.rst @@ -5,7 +5,7 @@ Using the API `gRPC`_ is required for using the Cloud Bigtable API. As of May 2016, `grpcio`_ is only supported in Python 2.7, so importing - :mod:`gcloud.bigtable` will fail. + :mod:`gcloud.bigtable` in other versions of Python will fail. API requests are sent to the `Google Cloud Bigtable`_ API via RPC over HTTP/2. In order to support this, we'll rely on `gRPC`_. We are working with the gRPC diff --git a/docs/happybase-batch.rst b/docs/happybase-batch.rst index 8cda4c5d622d..ebeab35082f5 100644 --- a/docs/happybase-batch.rst +++ b/docs/happybase-batch.rst @@ -5,7 +5,7 @@ HappyBase Batch gRPC is required for using the Cloud Bigtable API. As of May 2016, ``grpcio`` is only supported in Python 2.7, so importing - :mod:`gcloud.bigtable` will fail. + :mod:`gcloud.bigtable` in other versions of Python will fail. .. automodule:: gcloud.bigtable.happybase.batch :members: diff --git a/docs/happybase-connection.rst b/docs/happybase-connection.rst index 0cf93a0f51ff..ccdd762d9f44 100644 --- a/docs/happybase-connection.rst +++ b/docs/happybase-connection.rst @@ -5,7 +5,7 @@ HappyBase Connection gRPC is required for using the Cloud Bigtable API. As of May 2016, ``grpcio`` is only supported in Python 2.7, so importing - :mod:`gcloud.bigtable` will fail. + :mod:`gcloud.bigtable` in other versions of Python will fail. .. automodule:: gcloud.bigtable.happybase.connection :members: diff --git a/docs/happybase-package.rst b/docs/happybase-package.rst index 2727ea1128c8..19d15c4788e2 100644 --- a/docs/happybase-package.rst +++ b/docs/happybase-package.rst @@ -5,7 +5,7 @@ HappyBase Package gRPC is required for using the Cloud Bigtable API. As of May 2016, ``grpcio`` is only supported in Python 2.7, so importing - :mod:`gcloud.bigtable` will fail. + :mod:`gcloud.bigtable` in other versions of Python will fail. .. automodule:: gcloud.bigtable.happybase.__init__ :members: diff --git a/docs/happybase-pool.rst b/docs/happybase-pool.rst index 4fb624d8aa4b..566008445cc5 100644 --- a/docs/happybase-pool.rst +++ b/docs/happybase-pool.rst @@ -5,7 +5,7 @@ HappyBase Connection Pool gRPC is required for using the Cloud Bigtable API. As of May 2016, ``grpcio`` is only supported in Python 2.7, so importing - :mod:`gcloud.bigtable` will fail. + :mod:`gcloud.bigtable` in other versions of Python will fail. .. automodule:: gcloud.bigtable.happybase.pool :members: diff --git a/docs/happybase-table.rst b/docs/happybase-table.rst index 588377ff0c0c..44cd8f6bb86c 100644 --- a/docs/happybase-table.rst +++ b/docs/happybase-table.rst @@ -5,7 +5,7 @@ HappyBase Table gRPC is required for using the Cloud Bigtable API. As of May 2016, ``grpcio`` is only supported in Python 2.7, so importing - :mod:`gcloud.bigtable` will fail. + :mod:`gcloud.bigtable` in other versions of Python will fail. .. automodule:: gcloud.bigtable.happybase.table :members: diff --git a/gcloud/bigtable/__init__.py b/gcloud/bigtable/__init__.py index ee49e8bb1af1..6b4e26681733 100644 --- a/gcloud/bigtable/__init__.py +++ b/gcloud/bigtable/__init__.py @@ -17,10 +17,22 @@ from gcloud.bigtable.client import Client + +_ERR_MSG = """\ +gRPC is required for using the Cloud Bigtable API, but +importing the gRPC library (grpcio in PyPI) has failed. + +As of June 2016, grpcio is only supported in Python 2.7, +which unfortunately means the Cloud Bigtable API isn't +available if you're using Python 3 or Python < 2.7. + +If you're using Python 2.7 and importing / installing +grpcio has failed, this likely means you have a non-standard version +of Python installed. Check http://grpc.io if you're +having trouble installing the grpcio package. +""" + try: import grpc.beta.implementations -except ImportError as exc: - message = ('gRPC is required for using the Cloud Bigtable API. ' - 'Importing the grpc library (grpcio in PyPI) has failed. ' - 'As of May 2016, grpcio is only supported in Python 2.7.') - raise ImportError(message, exc) +except ImportError as exc: # pragma: NO COVER + raise ImportError(_ERR_MSG, exc) From e11832f788f0ee2190b9531a1d93c76128ba9b33 Mon Sep 17 00:00:00 2001 From: Danny Hermes Date: Tue, 7 Jun 2016 10:01:16 -0700 Subject: [PATCH 3/3] Fix sed error. --- docs/bigtable-client-intro.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/bigtable-client-intro.rst b/docs/bigtable-client-intro.rst index 46dbb0b24544..55111ad1dfb5 100644 --- a/docs/bigtable-client-intro.rst +++ b/docs/bigtable-client-intro.rst @@ -5,7 +5,7 @@ Base for Everything gRPC is required for using the Cloud Bigtable API. As of May 2016, ``grpcio`` is only supported in Python 2.7, so importing - :mod:`gcloud.bigtable` in other versions of Python in other versions of Python will fail. + :mod:`gcloud.bigtable` in other versions of Python will fail. To use the API, the :class:`Client ` class defines a high-level interface which handles authorization