Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move bigtable code into a subpackage #2410

Merged
merged 2 commits into from
Sep 26, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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`_.
Expand Down
13 changes: 13 additions & 0 deletions bigtable/.coveragerc
Original file line number Diff line number Diff line change
@@ -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__
4 changes: 4 additions & 0 deletions bigtable/MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
include README.rst
graft google
graft unit_tests
global-exclude *.pyc
44 changes: 44 additions & 0 deletions bigtable/README.rst
Original file line number Diff line number Diff line change
@@ -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
20 changes: 20 additions & 0 deletions bigtable/google/__init__.py
Original file line number Diff line number Diff line change
@@ -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__)
20 changes: 20 additions & 0 deletions bigtable/google/cloud/__init__.py
Original file line number Diff line number Diff line change
@@ -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__)
File renamed without changes.
File renamed without changes.
69 changes: 69 additions & 0 deletions bigtable/setup.py
Original file line number Diff line number Diff line change
@@ -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
)
30 changes: 30 additions & 0 deletions bigtable/tox.ini
Original file line number Diff line number Diff line change
@@ -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
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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 (
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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]
Expand Down Expand Up @@ -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)
Expand Down
Loading