diff --git a/docs/firestore.rst b/docs/firestore.rst new file mode 100644 index 0000000000000..0dbe39ad59363 --- /dev/null +++ b/docs/firestore.rst @@ -0,0 +1,12 @@ +Firestore +========= + +.. automodule:: google.cloud.firestore + :members: + :show-inheritance: + +Firestore Client +~~~~~~~~~~~~~~~~ +.. automodule:: google.cloud.firestore.client + :members: + :show-inheritance: diff --git a/docs/index.rst b/docs/index.rst index a8401af0aff45..b098aa20b66b9 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -23,6 +23,13 @@ datastore-batches datastore-helpers +.. toctree:: + :maxdepth: 0 + :hidden: + :caption: Firestore + + firestore + .. toctree:: :maxdepth: 0 :hidden: diff --git a/firestore/.coveragerc b/firestore/.coveragerc new file mode 100644 index 0000000000000..a54b99aa14b7a --- /dev/null +++ b/firestore/.coveragerc @@ -0,0 +1,11 @@ +[run] +branch = True + +[report] +fail_under = 100 +show_missing = True +exclude_lines = + # Re-enable the standard pragma + pragma: NO COVER + # Ignore debug-only repr + def __repr__ diff --git a/firestore/MANIFEST.in b/firestore/MANIFEST.in new file mode 100644 index 0000000000000..cb3a2b9ef4fa6 --- /dev/null +++ b/firestore/MANIFEST.in @@ -0,0 +1,4 @@ +include README.rst +graft google +graft unit_tests +global-exclude *.pyc diff --git a/firestore/README.rst b/firestore/README.rst new file mode 100644 index 0000000000000..df0cb635f03be --- /dev/null +++ b/firestore/README.rst @@ -0,0 +1,2 @@ +Google Cloud Firestore SDK +========================== diff --git a/firestore/google/__init__.py b/firestore/google/__init__.py new file mode 100644 index 0000000000000..b2b8333738826 --- /dev/null +++ b/firestore/google/__init__.py @@ -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__) diff --git a/firestore/google/cloud/__init__.py b/firestore/google/cloud/__init__.py new file mode 100644 index 0000000000000..b2b8333738826 --- /dev/null +++ b/firestore/google/cloud/__init__.py @@ -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__) diff --git a/firestore/google/cloud/firestore/__init__.py b/firestore/google/cloud/firestore/__init__.py new file mode 100644 index 0000000000000..940950865ba17 --- /dev/null +++ b/firestore/google/cloud/firestore/__init__.py @@ -0,0 +1,17 @@ +# Copyright 2016 Google Inc. All rights reserved. +# +# 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. + +"""Firestore database API public classes.""" + +from google.cloud.firestore.client import Client diff --git a/firestore/google/cloud/firestore/client.py b/firestore/google/cloud/firestore/client.py new file mode 100644 index 0000000000000..baf286d981e9c --- /dev/null +++ b/firestore/google/cloud/firestore/client.py @@ -0,0 +1,26 @@ +# Copyright 2016 Google Inc. All rights reserved. +# +# 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. + +"""Firestore database SDK Client.""" + + +class Client(object): + """Firestore Client. + + :type project: str + :param project: (optional) Project containing the Firestore database. + """ + + def __init__(self, project=None): + raise NotImplementedError() diff --git a/firestore/setup.cfg b/firestore/setup.cfg new file mode 100644 index 0000000000000..2a9acf13daa95 --- /dev/null +++ b/firestore/setup.cfg @@ -0,0 +1,2 @@ +[bdist_wheel] +universal = 1 diff --git a/firestore/setup.py b/firestore/setup.py new file mode 100644 index 0000000000000..1d3ecd68a37c6 --- /dev/null +++ b/firestore/setup.py @@ -0,0 +1,68 @@ +# 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 >= 0.20', +] + +setup( + name='google-cloud-firestore', + version='0.20.0', + description='Python Client for Google Cloud Firestore', + long_description=README, + namespace_packages=[ + 'google', + 'google.cloud', + ], + packages=find_packages(), + install_requires=REQUIREMENTS, + **SETUP_BASE +) diff --git a/firestore/tox.ini b/firestore/tox.ini new file mode 100644 index 0000000000000..81f175dfdf880 --- /dev/null +++ b/firestore/tox.ini @@ -0,0 +1,30 @@ +[tox] +envlist = + py27,py34,py35,cover + +[testing] +deps = + {toxinidir}/../core + pytest +covercmd = + py.test --quiet \ + --cov=google.cloud.firestore \ + --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 diff --git a/firestore/unit_tests/test_client.py b/firestore/unit_tests/test_client.py new file mode 100644 index 0000000000000..a768e78ff636c --- /dev/null +++ b/firestore/unit_tests/test_client.py @@ -0,0 +1,23 @@ +# Copyright 2016 Google Inc. All rights reserved. +# +# 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 unittest + +from google.cloud.firestore import Client + + +class TestFirestore(unittest.TestCase): + def test_constructor(self): + with self.assertRaises(NotImplementedError): + Client('my-project-id') diff --git a/scripts/verify_included_modules.py b/scripts/verify_included_modules.py index 2e300e196a069..862b495435c7c 100644 --- a/scripts/verify_included_modules.py +++ b/scripts/verify_included_modules.py @@ -62,6 +62,7 @@ 'datastore', 'dns', 'error_reporting', + 'firestore', 'language', 'logging', 'monitoring', diff --git a/tox.ini b/tox.ini index af0055a4b1394..4ca5944498552 100644 --- a/tox.ini +++ b/tox.ini @@ -8,6 +8,7 @@ deps = {toxinidir}/bigtable {toxinidir}/storage {toxinidir}/datastore + {toxinidir}/firestore {toxinidir}/bigquery {toxinidir}/pubsub {toxinidir}/logging @@ -45,6 +46,12 @@ covercmd = --cov-append \ --cov-config {toxinidir}/.coveragerc \ datastore/unit_tests + py.test --quiet \ + --cov=google.cloud \ + --cov=unit_tests \ + --cov-append \ + --cov-config {toxinidir}/.coveragerc \ + firestore/unit_tests py.test --quiet \ --cov=google.cloud \ --cov=unit_tests \