Skip to content

Commit 59f234b

Browse files
authored
Merge pull request #2417 from dhermes/make-datastore-subpackage
Move datastore code into a subpackage
2 parents a41f08f + 0401983 commit 59f234b

38 files changed

+237
-2
lines changed

.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/google/__init__.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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+
try:
16+
import pkg_resources
17+
pkg_resources.declare_namespace(__name__)
18+
except ImportError:
19+
import pkgutil
20+
__path__ = pkgutil.extend_path(__path__, __name__)

datastore/google/cloud/__init__.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Copyright 2014 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+
try:
16+
import pkg_resources
17+
pkg_resources.declare_namespace(__name__)
18+
except ImportError:
19+
import pkgutil
20+
__path__ = pkgutil.extend_path(__path__, __name__)
File renamed without changes.
File renamed without changes.

google/cloud/datastore/_generated/_datastore.proto renamed to datastore/google/cloud/datastore/_generated/_datastore.proto

File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)