Skip to content

Commit b70df72

Browse files
committed
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
1 parent bae133e commit b70df72

17 files changed

+203
-29
lines changed

.travis.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,14 @@ install:
77
script:
88
- tox -e py27
99
- (cd core && tox -e py27)
10+
- (cd bigtable && tox -e py27)
1011
- tox -e py34
1112
- (cd core && tox -e py34)
13+
- (cd bigtable && tox -e py34)
1214
- tox -e lint
1315
- tox -e cover
1416
- (cd core && tox -e cover)
17+
- (cd bigtable && tox -e cover)
1518
- tox -e system-tests
1619
- tox -e system-tests3
1720
- scripts/update_docs.sh

README.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ This client supports the following Google Cloud Platform services:
2222
- `Google Cloud Resource Manager`_
2323
- `Google Stackdriver Logging`_
2424
- `Google Stackdriver Monitoring`_
25+
- `Google Cloud Bigtable`_
2526

2627
.. _Google Cloud Datastore: https://github.com/GoogleCloudPlatform/google-cloud-python#google-cloud-datastore
2728
.. _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:
3031
.. _Google Cloud Resource Manager: https://github.com/GoogleCloudPlatform/google-cloud-python#google-cloud-resource-manager
3132
.. _Google Stackdriver Logging: https://github.com/GoogleCloudPlatform/google-cloud-python#google-stackdriver-logging
3233
.. _Google Stackdriver Monitoring: https://github.com/GoogleCloudPlatform/google-cloud-python#google-stackdriver-monitoring
34+
.. _Google Cloud Bigtable: https://github.com/GoogleCloudPlatform/google-cloud-python/tree/master/bigtable
3335

3436
If you need support for other Google APIs, check out the
3537
`Google APIs Python Client library`_.

bigtable/.coveragerc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
[run]
2+
branch = True
3+
4+
[report]
5+
omit =
6+
*/_generated/*.py
7+
fail_under = 100
8+
show_missing = True
9+
exclude_lines =
10+
# Re-enable the standard pragma
11+
pragma: NO COVER
12+
# Ignore debug-only repr
13+
def __repr__

bigtable/MANIFEST.in

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
include README.rst
2+
graft google
3+
graft unit_tests
4+
global-exclude *.pyc

bigtable/README.rst

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
Python Client for Google Cloud Bigtable
2+
=======================================
3+
4+
Python idiomatic client for `Google Cloud Bigtable`_
5+
6+
.. _Google Cloud Bigtable: https://cloud.google.com/bigtable/docs/
7+
8+
- `Homepage`_
9+
- `API Documentation`_
10+
11+
.. _Homepage: https://googlecloudplatform.github.io/google-cloud-python/
12+
.. _API Documentation: http://googlecloudplatform.github.io/google-cloud-python/
13+
14+
Quick Start
15+
-----------
16+
17+
::
18+
19+
$ pip install --upgrade google-cloud-bigtable
20+
21+
Authentication
22+
--------------
23+
24+
With ``google-cloud-python`` we try to make authentication as painless as
25+
possible. Check out the `Authentication section`_ in our documentation to
26+
learn more. You may also find the `authentication document`_ shared by all
27+
the ``google-cloud-*`` libraries to be helpful.
28+
29+
.. _Authentication section: http://google-cloud-python.readthedocs.io/en/latest/google-cloud-auth.html
30+
.. _authentication document: https://github.com/GoogleCloudPlatform/gcloud-common/tree/master/authentication
31+
32+
Using the API
33+
-------------
34+
35+
Cloud `Bigtable`_ is Google's NoSQL Big Data database service. It's the same
36+
database that powers many core Google services, including Search,
37+
Analytics, Maps, and Gmail.
38+
39+
.. _Bigtable: https://cloud.google.com/bigtable/docs/
40+
41+
See the ``google-cloud-python`` API `Bigtable documentation`_ to learn
42+
how to manage your data in Bigtable tables.
43+
44+
.. _Bigtable documentation: https://google-cloud-python.readthedocs.io/en/stable/bigtable-usage.html

bigtable/setup.py

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# Copyright 2016 Google Inc.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
import os
16+
17+
from setuptools import find_packages
18+
from setuptools import setup
19+
20+
21+
PACKAGE_ROOT = os.path.abspath(os.path.dirname(__file__))
22+
23+
with open(os.path.join(PACKAGE_ROOT, 'README.rst')) as file_obj:
24+
README = file_obj.read()
25+
26+
# NOTE: This is duplicated throughout and we should try to
27+
# consolidate.
28+
SETUP_BASE = {
29+
'author': 'Google Cloud Platform',
30+
'author_email': 'jjg+google-cloud-python@google.com',
31+
'scripts': [],
32+
'url': 'https://github.com/GoogleCloudPlatform/google-cloud-python',
33+
'license': 'Apache 2.0',
34+
'platforms': 'Posix; MacOS X; Windows',
35+
'include_package_data': True,
36+
'zip_safe': False,
37+
'classifiers': [
38+
'Development Status :: 4 - Beta',
39+
'Intended Audience :: Developers',
40+
'License :: OSI Approved :: Apache Software License',
41+
'Operating System :: OS Independent',
42+
'Programming Language :: Python :: 2',
43+
'Programming Language :: Python :: 2.7',
44+
'Programming Language :: Python :: 3',
45+
'Programming Language :: Python :: 3.4',
46+
'Programming Language :: Python :: 3.5',
47+
'Topic :: Internet',
48+
],
49+
}
50+
51+
52+
REQUIREMENTS = [
53+
'google-cloud-core',
54+
'grpcio >= 1.0.0',
55+
]
56+
57+
setup(
58+
name='google-cloud-bigtable',
59+
version='0.20.0dev',
60+
description='Python Client for Google Cloud Bigtable',
61+
long_description=README,
62+
namespace_packages=[
63+
'google',
64+
'google.cloud',
65+
],
66+
packages=find_packages(),
67+
install_requires=REQUIREMENTS,
68+
**SETUP_BASE
69+
)

bigtable/tox.ini

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
[tox]
2+
envlist =
3+
py27,py34,py35,cover
4+
5+
[testing]
6+
deps =
7+
{toxinidir}/../core
8+
pytest
9+
covercmd =
10+
py.test --quiet \
11+
--cov=google.cloud.bigtable \
12+
--cov=unit_tests \
13+
--cov-config {toxinidir}/.coveragerc \
14+
unit_tests
15+
16+
[testenv]
17+
commands =
18+
py.test --quiet {posargs} unit_tests
19+
deps =
20+
{[testing]deps}
21+
22+
[testenv:cover]
23+
basepython =
24+
python2.7
25+
commands =
26+
{[testing]covercmd}
27+
deps =
28+
{[testenv]deps}
29+
coverage
30+
pytest-cov

bigtable/unit_tests/test_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,7 @@ def test_list_instances(self):
553553
instance_pb2 as data_v2_pb2)
554554
from google.cloud.bigtable._generated import (
555555
bigtable_instance_admin_pb2 as messages_v2_pb2)
556-
from unit_tests.bigtable._testing import _FakeStub
556+
from unit_tests._testing import _FakeStub
557557

558558
LOCATION = 'projects/' + self.PROJECT + '/locations/locname'
559559
FAILED_LOCATION = 'FAILED'

bigtable/unit_tests/test_cluster.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ def test___ne__(self):
187187
self.assertNotEqual(cluster1, cluster2)
188188

189189
def test_reload(self):
190-
from unit_tests.bigtable._testing import _FakeStub
190+
from unit_tests._testing import _FakeStub
191191
from google.cloud.bigtable.cluster import DEFAULT_SERVE_NODES
192192

193193
SERVE_NODES = 31
@@ -232,7 +232,7 @@ def test_create(self):
232232
from google.cloud.operation import Operation
233233
from google.cloud.bigtable._generated import (
234234
bigtable_instance_admin_pb2 as messages_v2_pb2)
235-
from unit_tests.bigtable._testing import _FakeStub
235+
from unit_tests._testing import _FakeStub
236236

237237
SERVE_NODES = 4
238238
client = _Client(self.PROJECT)
@@ -281,7 +281,7 @@ def test_update(self):
281281
instance_pb2 as data_v2_pb2)
282282
from google.cloud.bigtable._generated import (
283283
bigtable_instance_admin_pb2 as messages_v2_pb2)
284-
from unit_tests.bigtable._testing import _FakeStub
284+
from unit_tests._testing import _FakeStub
285285
from google.cloud.bigtable.cluster import _UPDATE_CLUSTER_METADATA_URL
286286

287287
NOW = datetime.datetime.utcnow()
@@ -339,7 +339,7 @@ def test_update(self):
339339

340340
def test_delete(self):
341341
from google.protobuf import empty_pb2
342-
from unit_tests.bigtable._testing import _FakeStub
342+
from unit_tests._testing import _FakeStub
343343

344344
client = _Client(self.PROJECT)
345345
instance = _Instance(self.INSTANCE_ID, client)

bigtable/unit_tests/test_column_family.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ def test_to_pb_with_rule(self):
409409
def _create_test_helper(self, gc_rule=None):
410410
from google.cloud.bigtable._generated import (
411411
bigtable_table_admin_pb2 as table_admin_v2_pb2)
412-
from unit_tests.bigtable._testing import _FakeStub
412+
from unit_tests._testing import _FakeStub
413413

414414
project_id = 'project-id'
415415
zone = 'zone'
@@ -465,7 +465,7 @@ def test_create_with_gc_rule(self):
465465
self._create_test_helper(gc_rule=gc_rule)
466466

467467
def _update_test_helper(self, gc_rule=None):
468-
from unit_tests.bigtable._testing import _FakeStub
468+
from unit_tests._testing import _FakeStub
469469
from google.cloud.bigtable._generated import (
470470
bigtable_table_admin_pb2 as table_admin_v2_pb2)
471471

@@ -526,7 +526,7 @@ def test_delete(self):
526526
from google.protobuf import empty_pb2
527527
from google.cloud.bigtable._generated import (
528528
bigtable_table_admin_pb2 as table_admin_v2_pb2)
529-
from unit_tests.bigtable._testing import _FakeStub
529+
from unit_tests._testing import _FakeStub
530530

531531
project_id = 'project-id'
532532
zone = 'zone'

0 commit comments

Comments
 (0)