From 230267c428bfcd9e3bab59752f5af2b4beb19cea Mon Sep 17 00:00:00 2001 From: Danny Hermes Date: Mon, 26 Sep 2016 16:11:16 -0700 Subject: [PATCH 1/2] Moving all resource-manager files into subdirectory. Done via: $ mkdir -p resource_manager/google/cloud $ cp google/__init__.py resource_manager/google/__init__.py $ git add resource_manager/google/__init__.py $ cp google/cloud/__init__.py resource_manager/google/cloud/__init__.py $ git add resource_manager/google/cloud/__init__.py $ git mv google/cloud/resource_manager resource_manager/google/cloud/resource_manager $ git mv unit_tests/resource_manager resource_manager/unit_tests --- resource_manager/google/__init__.py | 20 +++++++++++++++++++ resource_manager/google/cloud/__init__.py | 20 +++++++++++++++++++ .../cloud/resource_manager/__init__.py | 0 .../google}/cloud/resource_manager/client.py | 0 .../cloud/resource_manager/connection.py | 0 .../google}/cloud/resource_manager/project.py | 0 .../unit_tests}/__init__.py | 0 .../unit_tests}/test_client.py | 0 .../unit_tests}/test_connection.py | 0 .../unit_tests}/test_project.py | 0 10 files changed, 40 insertions(+) create mode 100644 resource_manager/google/__init__.py create mode 100644 resource_manager/google/cloud/__init__.py rename {google => resource_manager/google}/cloud/resource_manager/__init__.py (100%) rename {google => resource_manager/google}/cloud/resource_manager/client.py (100%) rename {google => resource_manager/google}/cloud/resource_manager/connection.py (100%) rename {google => resource_manager/google}/cloud/resource_manager/project.py (100%) rename {unit_tests/resource_manager => resource_manager/unit_tests}/__init__.py (100%) rename {unit_tests/resource_manager => resource_manager/unit_tests}/test_client.py (100%) rename {unit_tests/resource_manager => resource_manager/unit_tests}/test_connection.py (100%) rename {unit_tests/resource_manager => resource_manager/unit_tests}/test_project.py (100%) diff --git a/resource_manager/google/__init__.py b/resource_manager/google/__init__.py new file mode 100644 index 000000000000..b2b833373882 --- /dev/null +++ b/resource_manager/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/resource_manager/google/cloud/__init__.py b/resource_manager/google/cloud/__init__.py new file mode 100644 index 000000000000..8ac7b74af136 --- /dev/null +++ b/resource_manager/google/cloud/__init__.py @@ -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__) diff --git a/google/cloud/resource_manager/__init__.py b/resource_manager/google/cloud/resource_manager/__init__.py similarity index 100% rename from google/cloud/resource_manager/__init__.py rename to resource_manager/google/cloud/resource_manager/__init__.py diff --git a/google/cloud/resource_manager/client.py b/resource_manager/google/cloud/resource_manager/client.py similarity index 100% rename from google/cloud/resource_manager/client.py rename to resource_manager/google/cloud/resource_manager/client.py diff --git a/google/cloud/resource_manager/connection.py b/resource_manager/google/cloud/resource_manager/connection.py similarity index 100% rename from google/cloud/resource_manager/connection.py rename to resource_manager/google/cloud/resource_manager/connection.py diff --git a/google/cloud/resource_manager/project.py b/resource_manager/google/cloud/resource_manager/project.py similarity index 100% rename from google/cloud/resource_manager/project.py rename to resource_manager/google/cloud/resource_manager/project.py diff --git a/unit_tests/resource_manager/__init__.py b/resource_manager/unit_tests/__init__.py similarity index 100% rename from unit_tests/resource_manager/__init__.py rename to resource_manager/unit_tests/__init__.py diff --git a/unit_tests/resource_manager/test_client.py b/resource_manager/unit_tests/test_client.py similarity index 100% rename from unit_tests/resource_manager/test_client.py rename to resource_manager/unit_tests/test_client.py diff --git a/unit_tests/resource_manager/test_connection.py b/resource_manager/unit_tests/test_connection.py similarity index 100% rename from unit_tests/resource_manager/test_connection.py rename to resource_manager/unit_tests/test_connection.py diff --git a/unit_tests/resource_manager/test_project.py b/resource_manager/unit_tests/test_project.py similarity index 100% rename from unit_tests/resource_manager/test_project.py rename to resource_manager/unit_tests/test_project.py From 7cb86b47acea2339c6c18cb70189d2b0c347ec5e Mon Sep 17 00:00:00 2001 From: Danny Hermes Date: Mon, 26 Sep 2016 16:11:16 -0700 Subject: [PATCH 2/2] Making resource-manager subpackage into a proper package. - Adding README, setup.py, MANIFEST.in, .coveragerc and tox.ini - Adding google-cloud-resource-manager as a dependency to the umbrella package - Adding the resource_manager subdirectory into the list of packages for verifying the docs - Incorporating the resource_manager subdirectory into the umbrella coverage report - Adding the resource-manager only tox tests to the Travis config - Adding {toxinidir}/../core as a dependency for the resource-manager tox config --- .travis.yml | 3 ++ resource_manager/.coveragerc | 11 +++++ resource_manager/MANIFEST.in | 4 ++ resource_manager/README.rst | 45 ++++++++++++++++++++ resource_manager/setup.py | 68 ++++++++++++++++++++++++++++++ resource_manager/tox.ini | 30 +++++++++++++ scripts/verify_included_modules.py | 1 + setup.py | 1 + tox.ini | 7 +++ 9 files changed, 170 insertions(+) create mode 100644 resource_manager/.coveragerc create mode 100644 resource_manager/MANIFEST.in create mode 100644 resource_manager/README.rst create mode 100644 resource_manager/setup.py create mode 100644 resource_manager/tox.ini diff --git a/.travis.yml b/.travis.yml index 114bbc18e0b0..26f11bed27c9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,6 +16,7 @@ script: - (cd dns && tox -e py27) - (cd language && tox -e py27) - (cd error_reporting && tox -e py27) + - (cd resource_manager && tox -e py27) - tox -e py34 - (cd core && tox -e py34) - (cd bigtable && tox -e py34) @@ -27,6 +28,7 @@ script: - (cd dns && tox -e py34) - (cd language && tox -e py34) - (cd error_reporting && tox -e py34) + - (cd resource_manager && tox -e py34) - tox -e lint - tox -e cover - (cd core && tox -e cover) @@ -39,6 +41,7 @@ script: - (cd dns && tox -e cover) - (cd language && tox -e cover) - (cd error_reporting && tox -e cover) + - (cd resource_manager && tox -e cover) - tox -e system-tests - tox -e system-tests3 - scripts/update_docs.sh diff --git a/resource_manager/.coveragerc b/resource_manager/.coveragerc new file mode 100644 index 000000000000..a54b99aa14b7 --- /dev/null +++ b/resource_manager/.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/resource_manager/MANIFEST.in b/resource_manager/MANIFEST.in new file mode 100644 index 000000000000..cb3a2b9ef4fa --- /dev/null +++ b/resource_manager/MANIFEST.in @@ -0,0 +1,4 @@ +include README.rst +graft google +graft unit_tests +global-exclude *.pyc diff --git a/resource_manager/README.rst b/resource_manager/README.rst new file mode 100644 index 000000000000..f70e3839322f --- /dev/null +++ b/resource_manager/README.rst @@ -0,0 +1,45 @@ +Python Client for Google Cloud Resource Manager +=============================================== + + Python idiomatic client for `Google Cloud Resource Manager`_ + +.. _Google Cloud Resource Manager: https://cloud.google.com/resource-manager/ + +- `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-resource-manager + +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 +------------- + +The Cloud `Resource Manager`_ API (`Resource Manager API docs`_) provides +methods that you can use to programmatically manage your projects in the +Google Cloud Platform. + +.. _Resource Manager: https://cloud.google.com/resource-manager/ +.. _Resource Manager API docs: https://cloud.google.com/resource-manager/reference/rest/ + +See the ``google-cloud-python`` API `Resource Manager documentation`_ to learn +how to manage projects using this Client Library. + +.. _Resource Manager documentation: https://googlecloudplatform.github.io/google-cloud-python/stable/resource-manager-api.html diff --git a/resource_manager/setup.py b/resource_manager/setup.py new file mode 100644 index 000000000000..3c7282a4005c --- /dev/null +++ b/resource_manager/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', +] + +setup( + name='google-cloud-resource-manager', + version='0.20.0dev', + description='Python Client for Google Cloud Resource Manager', + long_description=README, + namespace_packages=[ + 'google', + 'google.cloud', + ], + packages=find_packages(), + install_requires=REQUIREMENTS, + **SETUP_BASE +) diff --git a/resource_manager/tox.ini b/resource_manager/tox.ini new file mode 100644 index 000000000000..9ec0730ee03c --- /dev/null +++ b/resource_manager/tox.ini @@ -0,0 +1,30 @@ +[tox] +envlist = + py27,py34,py35,cover + +[testing] +deps = + {toxinidir}/../core + pytest +covercmd = + py.test --quiet \ + --cov=google.cloud.resource-manager \ + --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/scripts/verify_included_modules.py b/scripts/verify_included_modules.py index 990bdb79f847..bca71e2521dd 100644 --- a/scripts/verify_included_modules.py +++ b/scripts/verify_included_modules.py @@ -68,6 +68,7 @@ 'language', 'logging', 'pubsub', + 'resource_manager', 'storage', ) diff --git a/setup.py b/setup.py index d042277405bc..7d992a5b61d8 100644 --- a/setup.py +++ b/setup.py @@ -59,6 +59,7 @@ 'google-cloud-language', 'google-cloud-logging', 'google-cloud-pubsub', + 'google-cloud-resource-manager', 'google-cloud-storage', ] diff --git a/tox.ini b/tox.ini index e4ee360c29a1..4d83c46460f8 100644 --- a/tox.ini +++ b/tox.ini @@ -14,6 +14,7 @@ deps = {toxinidir}/dns {toxinidir}/language {toxinidir}/error_reporting + {toxinidir}/resource_manager pytest covercmd = py.test --quiet \ @@ -81,6 +82,12 @@ covercmd = --cov-append \ --cov-config {toxinidir}/.coveragerc \ error_reporting/unit_tests + py.test --quiet \ + --cov=google.cloud \ + --cov=unit_tests \ + --cov-append \ + --cov-config {toxinidir}/.coveragerc \ + resource_manager/unit_tests coverage report --show-missing --fail-under=100 [testenv]