-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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 datastore code into a subpackage #2417
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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__ |
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 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
Python Client for Google Cloud Datastore | ||
======================================== | ||
|
||
Python idiomatic client for `Google Cloud Datastore`_ | ||
|
||
.. _Google Cloud Datastore: https://cloud.google.com/datastore/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-datastore | ||
|
||
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 | ||
------------- | ||
|
||
Google `Cloud Datastore`_ (`Datastore API docs`_) is a fully managed, | ||
schemaless database for storing non-relational data. Cloud Datastore | ||
automatically scales with your users and supports ACID transactions, high | ||
availability of reads and writes, strong consistency for reads and ancestor | ||
queries, and eventual consistency for all other queries. | ||
|
||
.. _Cloud Datastore: https://cloud.google.com/datastore/docs | ||
.. _Datastore API docs: https://cloud.google.com/datastore/docs/ | ||
|
||
See the ``google-cloud-python`` API `datastore documentation`_ to learn how to | ||
interact with the Cloud Datastore using this Client Library. | ||
|
||
.. _datastore documentation: https://googlecloudplatform.github.io/google-cloud-python/stable/datastore-client.html | ||
|
||
See the `official Google Cloud Datastore documentation`_ for more details on | ||
how to activate Cloud Datastore for your project. | ||
|
||
.. _official Google Cloud Datastore documentation: https://cloud.google.com/datastore/docs/activate | ||
|
||
.. code:: python | ||
|
||
from google.cloud import datastore | ||
# Create, populate and persist an entity | ||
entity = datastore.Entity(key=datastore.Key('EntityKind')) | ||
entity.update({ | ||
'foo': u'bar', | ||
'baz': 1337, | ||
'qux': False, | ||
}) | ||
# Then query for entities | ||
query = datastore.Query(kind='EntityKind') | ||
for result in query.fetch(): | ||
print(result) |
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__) |
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__) |
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', | ||
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
Sorry, something went wrong. |
||
'grpcio >= 1.0.0', | ||
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
Sorry, something went wrong. |
||
] | ||
|
||
setup( | ||
name='google-cloud-datastore', | ||
version='0.20.0dev', | ||
description='Python Client for Google Cloud Datastore', | ||
long_description=README, | ||
namespace_packages=[ | ||
'google', | ||
'google.cloud', | ||
], | ||
packages=find_packages(), | ||
install_requires=REQUIREMENTS, | ||
**SETUP_BASE | ||
) |
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.datastore \ | ||
--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 |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,6 +61,7 @@ | |
'', | ||
'bigtable', | ||
'core', | ||
'datastore', | ||
'storage', | ||
) | ||
|
||
|
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
Sorry, something went wrong.