From bae133e795669cb7c51d70fc914ff7ccb58a5acf Mon Sep 17 00:00:00 2001 From: Danny Hermes Date: Fri, 23 Sep 2016 12:32:17 -0700 Subject: [PATCH 1/2] Moving all bigtable files into subdirectory. Done via: $ mkdir -p bigtable/google/cloud $ cp google/__init__.py bigtable/google/__init__.py $ git add bigtable/google/__init__.py $ cp google/cloud/__init__.py bigtable/google/cloud/__init__.py $ git add bigtable/google/cloud/__init__.py $ git mv google/cloud/bigtable bigtable/google/cloud/bigtable $ git mv unit_tests/bigtable bigtable/unit_tests --- bigtable/google/__init__.py | 20 +++++++++++++++++++ bigtable/google/cloud/__init__.py | 20 +++++++++++++++++++ .../google}/cloud/bigtable/__init__.py | 0 .../cloud/bigtable/_generated/__init__.py | 0 .../cloud/bigtable/_generated/_bigtable.proto | 0 .../_generated/_bigtable_instance_admin.proto | 0 .../_generated/_bigtable_table_admin.proto | 0 .../cloud/bigtable/_generated/_common.proto | 0 .../cloud/bigtable/_generated/_data.proto | 0 .../cloud/bigtable/_generated/_instance.proto | 0 .../bigtable/_generated/_operations.proto | 0 .../cloud/bigtable/_generated/_table.proto | 0 .../_generated/bigtable_instance_admin_pb2.py | 0 .../cloud/bigtable/_generated/bigtable_pb2.py | 0 .../_generated/bigtable_table_admin_pb2.py | 0 .../cloud/bigtable/_generated/common_pb2.py | 0 .../cloud/bigtable/_generated/data_pb2.py | 0 .../cloud/bigtable/_generated/instance_pb2.py | 0 .../_generated/operations_grpc_pb2.py | 0 .../cloud/bigtable/_generated/table_pb2.py | 0 .../google}/cloud/bigtable/client.py | 0 .../google}/cloud/bigtable/cluster.py | 0 .../google}/cloud/bigtable/column_family.py | 0 .../google}/cloud/bigtable/instance.py | 0 .../google}/cloud/bigtable/row.py | 0 .../google}/cloud/bigtable/row_data.py | 0 .../google}/cloud/bigtable/row_filters.py | 0 .../google}/cloud/bigtable/table.py | 0 .../unit_tests}/__init__.py | 0 .../unit_tests}/_testing.py | 0 .../read-rows-acceptance-test.json | 0 .../unit_tests}/test_client.py | 0 .../unit_tests}/test_cluster.py | 0 .../unit_tests}/test_column_family.py | 0 .../unit_tests}/test_instance.py | 0 .../unit_tests}/test_row.py | 0 .../unit_tests}/test_row_data.py | 0 .../unit_tests}/test_row_filters.py | 0 .../unit_tests}/test_table.py | 0 39 files changed, 40 insertions(+) create mode 100644 bigtable/google/__init__.py create mode 100644 bigtable/google/cloud/__init__.py rename {google => bigtable/google}/cloud/bigtable/__init__.py (100%) rename {google => bigtable/google}/cloud/bigtable/_generated/__init__.py (100%) rename {google => bigtable/google}/cloud/bigtable/_generated/_bigtable.proto (100%) rename {google => bigtable/google}/cloud/bigtable/_generated/_bigtable_instance_admin.proto (100%) rename {google => bigtable/google}/cloud/bigtable/_generated/_bigtable_table_admin.proto (100%) rename {google => bigtable/google}/cloud/bigtable/_generated/_common.proto (100%) rename {google => bigtable/google}/cloud/bigtable/_generated/_data.proto (100%) rename {google => bigtable/google}/cloud/bigtable/_generated/_instance.proto (100%) rename {google => bigtable/google}/cloud/bigtable/_generated/_operations.proto (100%) rename {google => bigtable/google}/cloud/bigtable/_generated/_table.proto (100%) rename {google => bigtable/google}/cloud/bigtable/_generated/bigtable_instance_admin_pb2.py (100%) rename {google => bigtable/google}/cloud/bigtable/_generated/bigtable_pb2.py (100%) rename {google => bigtable/google}/cloud/bigtable/_generated/bigtable_table_admin_pb2.py (100%) rename {google => bigtable/google}/cloud/bigtable/_generated/common_pb2.py (100%) rename {google => bigtable/google}/cloud/bigtable/_generated/data_pb2.py (100%) rename {google => bigtable/google}/cloud/bigtable/_generated/instance_pb2.py (100%) rename {google => bigtable/google}/cloud/bigtable/_generated/operations_grpc_pb2.py (100%) rename {google => bigtable/google}/cloud/bigtable/_generated/table_pb2.py (100%) rename {google => bigtable/google}/cloud/bigtable/client.py (100%) rename {google => bigtable/google}/cloud/bigtable/cluster.py (100%) rename {google => bigtable/google}/cloud/bigtable/column_family.py (100%) rename {google => bigtable/google}/cloud/bigtable/instance.py (100%) rename {google => bigtable/google}/cloud/bigtable/row.py (100%) rename {google => bigtable/google}/cloud/bigtable/row_data.py (100%) rename {google => bigtable/google}/cloud/bigtable/row_filters.py (100%) rename {google => bigtable/google}/cloud/bigtable/table.py (100%) rename {unit_tests/bigtable => bigtable/unit_tests}/__init__.py (100%) rename {unit_tests/bigtable => bigtable/unit_tests}/_testing.py (100%) rename {unit_tests/bigtable => bigtable/unit_tests}/read-rows-acceptance-test.json (100%) rename {unit_tests/bigtable => bigtable/unit_tests}/test_client.py (100%) rename {unit_tests/bigtable => bigtable/unit_tests}/test_cluster.py (100%) rename {unit_tests/bigtable => bigtable/unit_tests}/test_column_family.py (100%) rename {unit_tests/bigtable => bigtable/unit_tests}/test_instance.py (100%) rename {unit_tests/bigtable => bigtable/unit_tests}/test_row.py (100%) rename {unit_tests/bigtable => bigtable/unit_tests}/test_row_data.py (100%) rename {unit_tests/bigtable => bigtable/unit_tests}/test_row_filters.py (100%) rename {unit_tests/bigtable => bigtable/unit_tests}/test_table.py (100%) diff --git a/bigtable/google/__init__.py b/bigtable/google/__init__.py new file mode 100644 index 000000000000..b2b833373882 --- /dev/null +++ b/bigtable/google/__init__.py @@ -0,0 +1,20 @@ +# Copyright 2016 Google Inc. +# +# 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 +# +# 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. + +try: + import pkg_resources + pkg_resources.declare_namespace(__name__) +except ImportError: + import pkgutil + __path__ = pkgutil.extend_path(__path__, __name__) diff --git a/bigtable/google/cloud/__init__.py b/bigtable/google/cloud/__init__.py new file mode 100644 index 000000000000..8ac7b74af136 --- /dev/null +++ b/bigtable/google/cloud/__init__.py @@ -0,0 +1,20 @@ +# Copyright 2014 Google Inc. +# +# 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 +# +# 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. + +try: + import pkg_resources + pkg_resources.declare_namespace(__name__) +except ImportError: + import pkgutil + __path__ = pkgutil.extend_path(__path__, __name__) diff --git a/google/cloud/bigtable/__init__.py b/bigtable/google/cloud/bigtable/__init__.py similarity index 100% rename from google/cloud/bigtable/__init__.py rename to bigtable/google/cloud/bigtable/__init__.py diff --git a/google/cloud/bigtable/_generated/__init__.py b/bigtable/google/cloud/bigtable/_generated/__init__.py similarity index 100% rename from google/cloud/bigtable/_generated/__init__.py rename to bigtable/google/cloud/bigtable/_generated/__init__.py diff --git a/google/cloud/bigtable/_generated/_bigtable.proto b/bigtable/google/cloud/bigtable/_generated/_bigtable.proto similarity index 100% rename from google/cloud/bigtable/_generated/_bigtable.proto rename to bigtable/google/cloud/bigtable/_generated/_bigtable.proto diff --git a/google/cloud/bigtable/_generated/_bigtable_instance_admin.proto b/bigtable/google/cloud/bigtable/_generated/_bigtable_instance_admin.proto similarity index 100% rename from google/cloud/bigtable/_generated/_bigtable_instance_admin.proto rename to bigtable/google/cloud/bigtable/_generated/_bigtable_instance_admin.proto diff --git a/google/cloud/bigtable/_generated/_bigtable_table_admin.proto b/bigtable/google/cloud/bigtable/_generated/_bigtable_table_admin.proto similarity index 100% rename from google/cloud/bigtable/_generated/_bigtable_table_admin.proto rename to bigtable/google/cloud/bigtable/_generated/_bigtable_table_admin.proto diff --git a/google/cloud/bigtable/_generated/_common.proto b/bigtable/google/cloud/bigtable/_generated/_common.proto similarity index 100% rename from google/cloud/bigtable/_generated/_common.proto rename to bigtable/google/cloud/bigtable/_generated/_common.proto diff --git a/google/cloud/bigtable/_generated/_data.proto b/bigtable/google/cloud/bigtable/_generated/_data.proto similarity index 100% rename from google/cloud/bigtable/_generated/_data.proto rename to bigtable/google/cloud/bigtable/_generated/_data.proto diff --git a/google/cloud/bigtable/_generated/_instance.proto b/bigtable/google/cloud/bigtable/_generated/_instance.proto similarity index 100% rename from google/cloud/bigtable/_generated/_instance.proto rename to bigtable/google/cloud/bigtable/_generated/_instance.proto diff --git a/google/cloud/bigtable/_generated/_operations.proto b/bigtable/google/cloud/bigtable/_generated/_operations.proto similarity index 100% rename from google/cloud/bigtable/_generated/_operations.proto rename to bigtable/google/cloud/bigtable/_generated/_operations.proto diff --git a/google/cloud/bigtable/_generated/_table.proto b/bigtable/google/cloud/bigtable/_generated/_table.proto similarity index 100% rename from google/cloud/bigtable/_generated/_table.proto rename to bigtable/google/cloud/bigtable/_generated/_table.proto diff --git a/google/cloud/bigtable/_generated/bigtable_instance_admin_pb2.py b/bigtable/google/cloud/bigtable/_generated/bigtable_instance_admin_pb2.py similarity index 100% rename from google/cloud/bigtable/_generated/bigtable_instance_admin_pb2.py rename to bigtable/google/cloud/bigtable/_generated/bigtable_instance_admin_pb2.py diff --git a/google/cloud/bigtable/_generated/bigtable_pb2.py b/bigtable/google/cloud/bigtable/_generated/bigtable_pb2.py similarity index 100% rename from google/cloud/bigtable/_generated/bigtable_pb2.py rename to bigtable/google/cloud/bigtable/_generated/bigtable_pb2.py diff --git a/google/cloud/bigtable/_generated/bigtable_table_admin_pb2.py b/bigtable/google/cloud/bigtable/_generated/bigtable_table_admin_pb2.py similarity index 100% rename from google/cloud/bigtable/_generated/bigtable_table_admin_pb2.py rename to bigtable/google/cloud/bigtable/_generated/bigtable_table_admin_pb2.py diff --git a/google/cloud/bigtable/_generated/common_pb2.py b/bigtable/google/cloud/bigtable/_generated/common_pb2.py similarity index 100% rename from google/cloud/bigtable/_generated/common_pb2.py rename to bigtable/google/cloud/bigtable/_generated/common_pb2.py diff --git a/google/cloud/bigtable/_generated/data_pb2.py b/bigtable/google/cloud/bigtable/_generated/data_pb2.py similarity index 100% rename from google/cloud/bigtable/_generated/data_pb2.py rename to bigtable/google/cloud/bigtable/_generated/data_pb2.py diff --git a/google/cloud/bigtable/_generated/instance_pb2.py b/bigtable/google/cloud/bigtable/_generated/instance_pb2.py similarity index 100% rename from google/cloud/bigtable/_generated/instance_pb2.py rename to bigtable/google/cloud/bigtable/_generated/instance_pb2.py diff --git a/google/cloud/bigtable/_generated/operations_grpc_pb2.py b/bigtable/google/cloud/bigtable/_generated/operations_grpc_pb2.py similarity index 100% rename from google/cloud/bigtable/_generated/operations_grpc_pb2.py rename to bigtable/google/cloud/bigtable/_generated/operations_grpc_pb2.py diff --git a/google/cloud/bigtable/_generated/table_pb2.py b/bigtable/google/cloud/bigtable/_generated/table_pb2.py similarity index 100% rename from google/cloud/bigtable/_generated/table_pb2.py rename to bigtable/google/cloud/bigtable/_generated/table_pb2.py diff --git a/google/cloud/bigtable/client.py b/bigtable/google/cloud/bigtable/client.py similarity index 100% rename from google/cloud/bigtable/client.py rename to bigtable/google/cloud/bigtable/client.py diff --git a/google/cloud/bigtable/cluster.py b/bigtable/google/cloud/bigtable/cluster.py similarity index 100% rename from google/cloud/bigtable/cluster.py rename to bigtable/google/cloud/bigtable/cluster.py diff --git a/google/cloud/bigtable/column_family.py b/bigtable/google/cloud/bigtable/column_family.py similarity index 100% rename from google/cloud/bigtable/column_family.py rename to bigtable/google/cloud/bigtable/column_family.py diff --git a/google/cloud/bigtable/instance.py b/bigtable/google/cloud/bigtable/instance.py similarity index 100% rename from google/cloud/bigtable/instance.py rename to bigtable/google/cloud/bigtable/instance.py diff --git a/google/cloud/bigtable/row.py b/bigtable/google/cloud/bigtable/row.py similarity index 100% rename from google/cloud/bigtable/row.py rename to bigtable/google/cloud/bigtable/row.py diff --git a/google/cloud/bigtable/row_data.py b/bigtable/google/cloud/bigtable/row_data.py similarity index 100% rename from google/cloud/bigtable/row_data.py rename to bigtable/google/cloud/bigtable/row_data.py diff --git a/google/cloud/bigtable/row_filters.py b/bigtable/google/cloud/bigtable/row_filters.py similarity index 100% rename from google/cloud/bigtable/row_filters.py rename to bigtable/google/cloud/bigtable/row_filters.py diff --git a/google/cloud/bigtable/table.py b/bigtable/google/cloud/bigtable/table.py similarity index 100% rename from google/cloud/bigtable/table.py rename to bigtable/google/cloud/bigtable/table.py diff --git a/unit_tests/bigtable/__init__.py b/bigtable/unit_tests/__init__.py similarity index 100% rename from unit_tests/bigtable/__init__.py rename to bigtable/unit_tests/__init__.py diff --git a/unit_tests/bigtable/_testing.py b/bigtable/unit_tests/_testing.py similarity index 100% rename from unit_tests/bigtable/_testing.py rename to bigtable/unit_tests/_testing.py diff --git a/unit_tests/bigtable/read-rows-acceptance-test.json b/bigtable/unit_tests/read-rows-acceptance-test.json similarity index 100% rename from unit_tests/bigtable/read-rows-acceptance-test.json rename to bigtable/unit_tests/read-rows-acceptance-test.json diff --git a/unit_tests/bigtable/test_client.py b/bigtable/unit_tests/test_client.py similarity index 100% rename from unit_tests/bigtable/test_client.py rename to bigtable/unit_tests/test_client.py diff --git a/unit_tests/bigtable/test_cluster.py b/bigtable/unit_tests/test_cluster.py similarity index 100% rename from unit_tests/bigtable/test_cluster.py rename to bigtable/unit_tests/test_cluster.py diff --git a/unit_tests/bigtable/test_column_family.py b/bigtable/unit_tests/test_column_family.py similarity index 100% rename from unit_tests/bigtable/test_column_family.py rename to bigtable/unit_tests/test_column_family.py diff --git a/unit_tests/bigtable/test_instance.py b/bigtable/unit_tests/test_instance.py similarity index 100% rename from unit_tests/bigtable/test_instance.py rename to bigtable/unit_tests/test_instance.py diff --git a/unit_tests/bigtable/test_row.py b/bigtable/unit_tests/test_row.py similarity index 100% rename from unit_tests/bigtable/test_row.py rename to bigtable/unit_tests/test_row.py diff --git a/unit_tests/bigtable/test_row_data.py b/bigtable/unit_tests/test_row_data.py similarity index 100% rename from unit_tests/bigtable/test_row_data.py rename to bigtable/unit_tests/test_row_data.py diff --git a/unit_tests/bigtable/test_row_filters.py b/bigtable/unit_tests/test_row_filters.py similarity index 100% rename from unit_tests/bigtable/test_row_filters.py rename to bigtable/unit_tests/test_row_filters.py diff --git a/unit_tests/bigtable/test_table.py b/bigtable/unit_tests/test_table.py similarity index 100% rename from unit_tests/bigtable/test_table.py rename to bigtable/unit_tests/test_table.py From b70df726aff01c5b98ac99bd548f5b85ef307252 Mon Sep 17 00:00:00 2001 From: Danny Hermes Date: Fri, 23 Sep 2016 13:14:38 -0700 Subject: [PATCH 2/2] Making bigtable subpackage into a proper package. - Adding setup.py, MANIFEST.in, README, .coveragerc and tox.ini - Adding google-cloud-bigtable as a dependency to the umbrella package - Adding the bigtable subdirectory into the list of packages for verifying the docs - Incorporating the bigtable subdirectory into the umbrella coverage report - Adding the bigtable only tox tests to the Travis config - Updating the project main README to refer the bigtable subdirectory - Renamed bigtable _testing imports (since in a new place) - Adding {toxinidir}/../core as a dependency for the bigtable tox config - Updating the location of the ignored bigtable generated files both in the `pycodestyle` config in `tox.ini` and in `run_pylint` Changed the bigtable test helper import via: $ git grep -l 'from unit_tests.bigtable._testing import _FakeStub' | > xargs sed -i s/'from unit_tests.bigtable._testing import _FakeStub'/'from unit_tests._testing import _FakeStub'/g --- .travis.yml | 3 + README.rst | 2 + bigtable/.coveragerc | 13 +++++ bigtable/MANIFEST.in | 4 ++ bigtable/README.rst | 44 +++++++++++++++ bigtable/setup.py | 69 +++++++++++++++++++++++ bigtable/tox.ini | 30 ++++++++++ bigtable/unit_tests/test_client.py | 2 +- bigtable/unit_tests/test_cluster.py | 8 +-- bigtable/unit_tests/test_column_family.py | 6 +- bigtable/unit_tests/test_instance.py | 14 ++--- bigtable/unit_tests/test_row.py | 12 ++-- bigtable/unit_tests/test_table.py | 12 ++-- scripts/run_pylint.py | 2 +- scripts/verify_included_modules.py | 1 + setup.py | 1 + tox.ini | 9 ++- 17 files changed, 203 insertions(+), 29 deletions(-) create mode 100644 bigtable/.coveragerc create mode 100644 bigtable/MANIFEST.in create mode 100644 bigtable/README.rst create mode 100644 bigtable/setup.py create mode 100644 bigtable/tox.ini diff --git a/.travis.yml b/.travis.yml index 0f41c7853963..aadc6de8d8ad 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,11 +7,14 @@ install: script: - tox -e py27 - (cd core && tox -e py27) + - (cd bigtable && tox -e py27) - tox -e py34 - (cd core && tox -e py34) + - (cd bigtable && tox -e py34) - tox -e lint - tox -e cover - (cd core && tox -e cover) + - (cd bigtable && tox -e cover) - tox -e system-tests - tox -e system-tests3 - scripts/update_docs.sh diff --git a/README.rst b/README.rst index 6654dd82495a..1070a52f7b18 100644 --- a/README.rst +++ b/README.rst @@ -22,6 +22,7 @@ This client supports the following Google Cloud Platform services: - `Google Cloud Resource Manager`_ - `Google Stackdriver Logging`_ - `Google Stackdriver Monitoring`_ +- `Google Cloud Bigtable`_ .. _Google Cloud Datastore: https://github.com/GoogleCloudPlatform/google-cloud-python#google-cloud-datastore .. _Google Cloud Storage: https://github.com/GoogleCloudPlatform/google-cloud-python#google-cloud-storage @@ -30,6 +31,7 @@ This client supports the following Google Cloud Platform services: .. _Google Cloud Resource Manager: https://github.com/GoogleCloudPlatform/google-cloud-python#google-cloud-resource-manager .. _Google Stackdriver Logging: https://github.com/GoogleCloudPlatform/google-cloud-python#google-stackdriver-logging .. _Google Stackdriver Monitoring: https://github.com/GoogleCloudPlatform/google-cloud-python#google-stackdriver-monitoring +.. _Google Cloud Bigtable: https://github.com/GoogleCloudPlatform/google-cloud-python/tree/master/bigtable If you need support for other Google APIs, check out the `Google APIs Python Client library`_. diff --git a/bigtable/.coveragerc b/bigtable/.coveragerc new file mode 100644 index 000000000000..08f3fdea2433 --- /dev/null +++ b/bigtable/.coveragerc @@ -0,0 +1,13 @@ +[run] +branch = True + +[report] +omit = + */_generated/*.py +fail_under = 100 +show_missing = True +exclude_lines = + # Re-enable the standard pragma + pragma: NO COVER + # Ignore debug-only repr + def __repr__ diff --git a/bigtable/MANIFEST.in b/bigtable/MANIFEST.in new file mode 100644 index 000000000000..cb3a2b9ef4fa --- /dev/null +++ b/bigtable/MANIFEST.in @@ -0,0 +1,4 @@ +include README.rst +graft google +graft unit_tests +global-exclude *.pyc diff --git a/bigtable/README.rst b/bigtable/README.rst new file mode 100644 index 000000000000..619a0e15663d --- /dev/null +++ b/bigtable/README.rst @@ -0,0 +1,44 @@ +Python Client for Google Cloud Bigtable +======================================= + + Python idiomatic client for `Google Cloud Bigtable`_ + +.. _Google Cloud Bigtable: https://cloud.google.com/bigtable/docs/ + +- `Homepage`_ +- `API Documentation`_ + +.. _Homepage: https://googlecloudplatform.github.io/google-cloud-python/ +.. _API Documentation: http://googlecloudplatform.github.io/google-cloud-python/ + +Quick Start +----------- + +:: + + $ pip install --upgrade google-cloud-bigtable + +Authentication +-------------- + +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. + +.. _Authentication section: http://google-cloud-python.readthedocs.io/en/latest/google-cloud-auth.html +.. _authentication document: https://github.com/GoogleCloudPlatform/gcloud-common/tree/master/authentication + +Using the API +------------- + +Cloud `Bigtable`_ is Google's NoSQL Big Data database service. It's the same +database that powers many core Google services, including Search, +Analytics, Maps, and Gmail. + +.. _Bigtable: https://cloud.google.com/bigtable/docs/ + +See the ``google-cloud-python`` API `Bigtable documentation`_ to learn +how to manage your data in Bigtable tables. + +.. _Bigtable documentation: https://google-cloud-python.readthedocs.io/en/stable/bigtable-usage.html diff --git a/bigtable/setup.py b/bigtable/setup.py new file mode 100644 index 000000000000..71b82d119b6c --- /dev/null +++ b/bigtable/setup.py @@ -0,0 +1,69 @@ +# Copyright 2016 Google Inc. +# +# 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 +# +# 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. + +import os + +from setuptools import find_packages +from setuptools import setup + + +PACKAGE_ROOT = os.path.abspath(os.path.dirname(__file__)) + +with open(os.path.join(PACKAGE_ROOT, 'README.rst')) as file_obj: + README = file_obj.read() + +# NOTE: This is duplicated throughout and we should try to +# consolidate. +SETUP_BASE = { + 'author': 'Google Cloud Platform', + 'author_email': 'jjg+google-cloud-python@google.com', + 'scripts': [], + 'url': 'https://github.com/GoogleCloudPlatform/google-cloud-python', + 'license': 'Apache 2.0', + 'platforms': 'Posix; MacOS X; Windows', + 'include_package_data': True, + 'zip_safe': False, + 'classifiers': [ + 'Development Status :: 4 - Beta', + 'Intended Audience :: Developers', + 'License :: OSI Approved :: Apache Software License', + 'Operating System :: OS Independent', + 'Programming Language :: Python :: 2', + 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.4', + 'Programming Language :: Python :: 3.5', + 'Topic :: Internet', + ], +} + + +REQUIREMENTS = [ + 'google-cloud-core', + 'grpcio >= 1.0.0', +] + +setup( + name='google-cloud-bigtable', + version='0.20.0dev', + description='Python Client for Google Cloud Bigtable', + long_description=README, + namespace_packages=[ + 'google', + 'google.cloud', + ], + packages=find_packages(), + install_requires=REQUIREMENTS, + **SETUP_BASE +) diff --git a/bigtable/tox.ini b/bigtable/tox.ini new file mode 100644 index 000000000000..b5b080543a4c --- /dev/null +++ b/bigtable/tox.ini @@ -0,0 +1,30 @@ +[tox] +envlist = + py27,py34,py35,cover + +[testing] +deps = + {toxinidir}/../core + pytest +covercmd = + py.test --quiet \ + --cov=google.cloud.bigtable \ + --cov=unit_tests \ + --cov-config {toxinidir}/.coveragerc \ + unit_tests + +[testenv] +commands = + py.test --quiet {posargs} unit_tests +deps = + {[testing]deps} + +[testenv:cover] +basepython = + python2.7 +commands = + {[testing]covercmd} +deps = + {[testenv]deps} + coverage + pytest-cov diff --git a/bigtable/unit_tests/test_client.py b/bigtable/unit_tests/test_client.py index 237011c9807d..eb1048d35ec4 100644 --- a/bigtable/unit_tests/test_client.py +++ b/bigtable/unit_tests/test_client.py @@ -553,7 +553,7 @@ def test_list_instances(self): instance_pb2 as data_v2_pb2) from google.cloud.bigtable._generated import ( bigtable_instance_admin_pb2 as messages_v2_pb2) - from unit_tests.bigtable._testing import _FakeStub + from unit_tests._testing import _FakeStub LOCATION = 'projects/' + self.PROJECT + '/locations/locname' FAILED_LOCATION = 'FAILED' diff --git a/bigtable/unit_tests/test_cluster.py b/bigtable/unit_tests/test_cluster.py index 82335b293f0f..e497a025fd2c 100644 --- a/bigtable/unit_tests/test_cluster.py +++ b/bigtable/unit_tests/test_cluster.py @@ -187,7 +187,7 @@ def test___ne__(self): self.assertNotEqual(cluster1, cluster2) def test_reload(self): - from unit_tests.bigtable._testing import _FakeStub + from unit_tests._testing import _FakeStub from google.cloud.bigtable.cluster import DEFAULT_SERVE_NODES SERVE_NODES = 31 @@ -232,7 +232,7 @@ def test_create(self): from google.cloud.operation import Operation from google.cloud.bigtable._generated import ( bigtable_instance_admin_pb2 as messages_v2_pb2) - from unit_tests.bigtable._testing import _FakeStub + from unit_tests._testing import _FakeStub SERVE_NODES = 4 client = _Client(self.PROJECT) @@ -281,7 +281,7 @@ def test_update(self): instance_pb2 as data_v2_pb2) from google.cloud.bigtable._generated import ( bigtable_instance_admin_pb2 as messages_v2_pb2) - from unit_tests.bigtable._testing import _FakeStub + from unit_tests._testing import _FakeStub from google.cloud.bigtable.cluster import _UPDATE_CLUSTER_METADATA_URL NOW = datetime.datetime.utcnow() @@ -339,7 +339,7 @@ def test_update(self): def test_delete(self): from google.protobuf import empty_pb2 - from unit_tests.bigtable._testing import _FakeStub + from unit_tests._testing import _FakeStub client = _Client(self.PROJECT) instance = _Instance(self.INSTANCE_ID, client) diff --git a/bigtable/unit_tests/test_column_family.py b/bigtable/unit_tests/test_column_family.py index c2ad847694b7..dee8db4e169b 100644 --- a/bigtable/unit_tests/test_column_family.py +++ b/bigtable/unit_tests/test_column_family.py @@ -409,7 +409,7 @@ def test_to_pb_with_rule(self): def _create_test_helper(self, gc_rule=None): from google.cloud.bigtable._generated import ( bigtable_table_admin_pb2 as table_admin_v2_pb2) - from unit_tests.bigtable._testing import _FakeStub + from unit_tests._testing import _FakeStub project_id = 'project-id' zone = 'zone' @@ -465,7 +465,7 @@ def test_create_with_gc_rule(self): self._create_test_helper(gc_rule=gc_rule) def _update_test_helper(self, gc_rule=None): - from unit_tests.bigtable._testing import _FakeStub + from unit_tests._testing import _FakeStub from google.cloud.bigtable._generated import ( bigtable_table_admin_pb2 as table_admin_v2_pb2) @@ -526,7 +526,7 @@ def test_delete(self): from google.protobuf import empty_pb2 from google.cloud.bigtable._generated import ( bigtable_table_admin_pb2 as table_admin_v2_pb2) - from unit_tests.bigtable._testing import _FakeStub + from unit_tests._testing import _FakeStub project_id = 'project-id' zone = 'zone' diff --git a/bigtable/unit_tests/test_instance.py b/bigtable/unit_tests/test_instance.py index cc2c49366c90..bf47ab4f62a3 100644 --- a/bigtable/unit_tests/test_instance.py +++ b/bigtable/unit_tests/test_instance.py @@ -190,7 +190,7 @@ def test_reload(self): instance_pb2 as data_v2_pb2) from google.cloud.bigtable._generated import ( bigtable_instance_admin_pb2 as messages_v2_pb) - from unit_tests.bigtable._testing import _FakeStub + from unit_tests._testing import _FakeStub client = _Client(self.PROJECT) instance = self._makeOne(self.INSTANCE_ID, client, self.LOCATION_ID) @@ -233,7 +233,7 @@ def test_create(self): from google.cloud.bigtable._generated import ( bigtable_instance_admin_pb2 as messages_v2_pb2) from google.cloud._helpers import _datetime_to_pb_timestamp - from unit_tests.bigtable._testing import _FakeStub + from unit_tests._testing import _FakeStub from google.cloud.operation import Operation from google.cloud.bigtable.cluster import DEFAULT_SERVE_NODES from google.cloud.bigtable.instance import ( @@ -287,7 +287,7 @@ def test_create_w_explicit_serve_nodes(self): from google.longrunning import operations_pb2 from google.cloud.bigtable._generated import ( bigtable_instance_admin_pb2 as messages_v2_pb2) - from unit_tests.bigtable._testing import _FakeStub + from unit_tests._testing import _FakeStub from google.cloud.operation import Operation SERVE_NODES = 5 @@ -326,7 +326,7 @@ def test_create_w_explicit_serve_nodes(self): def test_update(self): from google.cloud.bigtable._generated import ( instance_pb2 as data_v2_pb2) - from unit_tests.bigtable._testing import _FakeStub + from unit_tests._testing import _FakeStub client = _Client(self.PROJECT) instance = self._makeOne(self.INSTANCE_ID, client, self.LOCATION_ID, @@ -361,7 +361,7 @@ def test_delete(self): from google.protobuf import empty_pb2 from google.cloud.bigtable._generated import ( bigtable_instance_admin_pb2 as messages_v2_pb) - from unit_tests.bigtable._testing import _FakeStub + from unit_tests._testing import _FakeStub client = _Client(self.PROJECT) instance = self._makeOne(self.INSTANCE_ID, client, self.LOCATION_ID) @@ -394,7 +394,7 @@ def test_list_clusters(self): instance_pb2 as instance_v2_pb2) from google.cloud.bigtable._generated import ( bigtable_instance_admin_pb2 as messages_v2_pb2) - from unit_tests.bigtable._testing import _FakeStub + from unit_tests._testing import _FakeStub FAILED_LOCATION = 'FAILED' FAILED_LOCATIONS = [FAILED_LOCATION] @@ -451,7 +451,7 @@ def _list_tables_helper(self, table_name=None): table_pb2 as table_data_v2_pb2) from google.cloud.bigtable._generated import ( bigtable_table_admin_pb2 as table_messages_v1_pb2) - from unit_tests.bigtable._testing import _FakeStub + from unit_tests._testing import _FakeStub client = _Client(self.PROJECT) instance = self._makeOne(self.INSTANCE_ID, client, self.LOCATION_ID) diff --git a/bigtable/unit_tests/test_row.py b/bigtable/unit_tests/test_row.py index 0a495bbbe433..d40d6b64b720 100644 --- a/bigtable/unit_tests/test_row.py +++ b/bigtable/unit_tests/test_row.py @@ -296,7 +296,7 @@ def test_delete_cells_with_string_columns(self): def test_commit(self): from google.protobuf import empty_pb2 - from unit_tests.bigtable._testing import _FakeStub + from unit_tests._testing import _FakeStub row_key = b'row_key' table_name = 'projects/more-stuff' @@ -356,7 +356,7 @@ def test_commit_too_many_mutations(self): row.commit() def test_commit_no_mutations(self): - from unit_tests.bigtable._testing import _FakeStub + from unit_tests._testing import _FakeStub row_key = b'row_key' client = _Client() @@ -407,7 +407,7 @@ def test__get_mutations(self): self.assertIs(false_mutations, row._get_mutations(None)) def test_commit(self): - from unit_tests.bigtable._testing import _FakeStub + from unit_tests._testing import _FakeStub from google.cloud.bigtable.row_filters import RowSampleFilter row_key = b'row_key' @@ -495,7 +495,7 @@ def test_commit_too_many_mutations(self): row.commit() def test_commit_no_mutations(self): - from unit_tests.bigtable._testing import _FakeStub + from unit_tests._testing import _FakeStub row_key = b'row_key' client = _Client() @@ -573,7 +573,7 @@ def test_increment_cell_value(self): def test_commit(self): from google.cloud._testing import _Monkey - from unit_tests.bigtable._testing import _FakeStub + from unit_tests._testing import _FakeStub from google.cloud.bigtable import row as MUT row_key = b'row_key' @@ -628,7 +628,7 @@ def mock_parse_rmw_row_response(row_response): self.assertEqual(row._rule_pb_list, []) def test_commit_no_rules(self): - from unit_tests.bigtable._testing import _FakeStub + from unit_tests._testing import _FakeStub row_key = b'row_key' client = _Client() diff --git a/bigtable/unit_tests/test_table.py b/bigtable/unit_tests/test_table.py index 113cfa0bbd64..7dca91768861 100644 --- a/bigtable/unit_tests/test_table.py +++ b/bigtable/unit_tests/test_table.py @@ -134,7 +134,7 @@ def test___ne__(self): def _create_test_helper(self, initial_split_keys, column_families=()): from google.cloud._helpers import _to_bytes - from unit_tests.bigtable._testing import _FakeStub + from unit_tests._testing import _FakeStub client = _Client() instance = _Instance(self.INSTANCE_NAME, client=client) @@ -201,7 +201,7 @@ def test_create_with_column_families(self): column_families=column_families) def _list_column_families_helper(self): - from unit_tests.bigtable._testing import _FakeStub + from unit_tests._testing import _FakeStub client = _Client() instance = _Instance(self.INSTANCE_NAME, client=client) @@ -239,7 +239,7 @@ def test_list_column_families(self): def test_delete(self): from google.protobuf import empty_pb2 - from unit_tests.bigtable._testing import _FakeStub + from unit_tests._testing import _FakeStub client = _Client() instance = _Instance(self.INSTANCE_NAME, client=client) @@ -268,7 +268,7 @@ def test_delete(self): def _read_row_helper(self, chunks, expected_result): from google.cloud._testing import _Monkey - from unit_tests.bigtable._testing import _FakeStub + from unit_tests._testing import _FakeStub from google.cloud.bigtable import table as MUT client = _Client() @@ -348,7 +348,7 @@ def test_read_row_still_partial(self): def test_read_rows(self): from google.cloud._testing import _Monkey - from unit_tests.bigtable._testing import _FakeStub + from unit_tests._testing import _FakeStub from google.cloud.bigtable.row_data import PartialRowsData from google.cloud.bigtable import table as MUT @@ -398,7 +398,7 @@ def mock_create_row_request(table_name, **kwargs): self.assertEqual(mock_created, [(table.name, created_kwargs)]) def test_sample_row_keys(self): - from unit_tests.bigtable._testing import _FakeStub + from unit_tests._testing import _FakeStub client = _Client() instance = _Instance(self.INSTANCE_NAME, client=client) diff --git a/scripts/run_pylint.py b/scripts/run_pylint.py index 7dbe24bf2dbe..e50202cb71c0 100644 --- a/scripts/run_pylint.py +++ b/scripts/run_pylint.py @@ -31,7 +31,7 @@ IGNORED_DIRECTORIES = [ - os.path.join('google', 'cloud', 'bigtable', '_generated'), + os.path.join('bigtable', 'google', 'cloud', 'bigtable', '_generated'), os.path.join('google', 'cloud', 'datastore', '_generated'), ] IGNORED_FILES = [ diff --git a/scripts/verify_included_modules.py b/scripts/verify_included_modules.py index 264d7876c9cc..7bde7e5949bb 100644 --- a/scripts/verify_included_modules.py +++ b/scripts/verify_included_modules.py @@ -59,6 +59,7 @@ ]) PACKAGES = ( '', + 'bigtable', 'core', ) diff --git a/setup.py b/setup.py index 5662b02e3b02..598e4fd7d13a 100644 --- a/setup.py +++ b/setup.py @@ -51,6 +51,7 @@ REQUIREMENTS = [ 'google-cloud-core', + 'google-cloud-bigtable', ] GRPC_PACKAGES = [ diff --git a/tox.ini b/tox.ini index 1e2eba979c5f..8ff2760dc531 100644 --- a/tox.ini +++ b/tox.ini @@ -5,6 +5,7 @@ envlist = [testing] deps = {toxinidir}/core + {toxinidir}/bigtable pytest covercmd = py.test --quiet \ @@ -18,6 +19,12 @@ covercmd = --cov-append \ --cov-config {toxinidir}/.coveragerc \ core/unit_tests + py.test --quiet \ + --cov=google.cloud \ + --cov=unit_tests \ + --cov-append \ + --cov-config {toxinidir}/.coveragerc \ + bigtable/unit_tests coverage report --show-missing --fail-under=100 [testenv] @@ -90,7 +97,7 @@ passenv = {[testenv:system-tests]passenv} SPHINX_RELEASE READTHEDOCS [pep8] exclude = docs/conf.py, - google/cloud/bigtable/_generated*/*, + bigtable/google/cloud/bigtable/_generated/*, google/cloud/datastore/_generated/* verbose = 1