Skip to content

Commit 115f86e

Browse files
committed
Making datastore subpackage into a proper package.
- Adding README, setup.py, MANIFEST.in, .coveragerc and tox.ini - Adding google-cloud-datastore as a dependency to the umbrella package - Adding the datastore subdirectory into the list of packages for verifying the docs - Incorporating the datastore subdirectory into the umbrella coverage report - Adding the datastore only tox tests to the Travis config - Adding {toxinidir}/../core as a dependency for the datastore tox config
1 parent 5050282 commit 115f86e

9 files changed

Lines changed: 195 additions & 0 deletions

File tree

.travis.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,18 @@ script:
99
- (cd core && tox -e py27)
1010
- (cd bigtable && tox -e py27)
1111
- (cd storage && tox -e py27)
12+
- (cd datastore && tox -e py27)
1213
- tox -e py34
1314
- (cd core && tox -e py34)
1415
- (cd bigtable && tox -e py34)
1516
- (cd storage && tox -e py34)
17+
- (cd datastore && tox -e py34)
1618
- tox -e lint
1719
- tox -e cover
1820
- (cd core && tox -e cover)
1921
- (cd bigtable && tox -e cover)
2022
- (cd storage && tox -e cover)
23+
- (cd datastore && tox -e cover)
2124
- tox -e system-tests
2225
- tox -e system-tests3
2326
- scripts/update_docs.sh

datastore/.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__

datastore/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

datastore/README.rst

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
Python Client for Google Cloud Datastore
2+
========================================
3+
4+
Python idiomatic client for `Google Cloud Datastore`_
5+
6+
.. _Google Cloud Datastore: https://cloud.google.com/datastore/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-datastore
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+
Google `Cloud Datastore`_ (`Datastore API docs`_) is a fully managed,
36+
schemaless database for storing non-relational data. Cloud Datastore
37+
automatically scales with your users and supports ACID transactions, high
38+
availability of reads and writes, strong consistency for reads and ancestor
39+
queries, and eventual consistency for all other queries.
40+
41+
.. _Cloud Datastore: https://cloud.google.com/datastore/docs
42+
.. _Datastore API docs: https://cloud.google.com/datastore/docs/
43+
44+
See the ``google-cloud-python`` API `datastore documentation`_ to learn how to
45+
interact with the Cloud Datastore using this Client Library.
46+
47+
.. _datastore documentation: https://googlecloudplatform.github.io/google-cloud-python/stable/datastore-client.html
48+
49+
See the `official Google Cloud Datastore documentation`_ for more details on
50+
how to activate Cloud Datastore for your project.
51+
52+
.. _official Google Cloud Datastore documentation: https://cloud.google.com/datastore/docs/activate
53+
54+
.. code:: python
55+
56+
from google.cloud import datastore
57+
# Create, populate and persist an entity
58+
entity = datastore.Entity(key=datastore.Key('EntityKind'))
59+
entity.update({
60+
'foo': u'bar',
61+
'baz': 1337,
62+
'qux': False,
63+
})
64+
# Then query for entities
65+
query = datastore.Query(kind='EntityKind')
66+
for result in query.fetch():
67+
print(result)

datastore/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-datastore',
59+
version='0.20.0dev',
60+
description='Python Client for Google Cloud Datastore',
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+
)

datastore/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.datastore \
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

scripts/verify_included_modules.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
'',
6262
'bigtable',
6363
'core',
64+
'datastore',
6465
'storage',
6566
)
6667

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
REQUIREMENTS = [
5353
'google-cloud-bigtable',
5454
'google-cloud-core',
55+
'google-cloud-datastore',
5556
'google-cloud-storage',
5657
]
5758

tox.ini

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ deps =
77
{toxinidir}/core
88
{toxinidir}/bigtable
99
{toxinidir}/storage
10+
{toxinidir}/datastore
1011
pytest
1112
covercmd =
1213
py.test --quiet \
@@ -32,6 +33,12 @@ covercmd =
3233
--cov-append \
3334
--cov-config {toxinidir}/.coveragerc \
3435
storage/unit_tests
36+
py.test --quiet \
37+
--cov=google.cloud \
38+
--cov=unit_tests \
39+
--cov-append \
40+
--cov-config {toxinidir}/.coveragerc \
41+
datastore/unit_tests
3542
coverage report --show-missing --fail-under=100
3643

3744
[testenv]

0 commit comments

Comments
 (0)