Skip to content

Commit

Permalink
Moving core into designated package.
Browse files Browse the repository at this point in the history
  • Loading branch information
dhermes committed Sep 20, 2016
1 parent 52e6263 commit d24c138
Show file tree
Hide file tree
Showing 23 changed files with 186 additions and 35 deletions.
20 changes: 20 additions & 0 deletions core/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Core Helpers for Google Cloud Python Client Library
===================================================

This library is not meant to stand-alone. Instead it defines
common helpers (e.g. base ``Client`` and ``Connection`` classes)
used by all of the ``google-cloud-*``.


- `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-core
22 changes: 22 additions & 0 deletions core/google/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# 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.

"""Base ``google`` namespace package."""

try:
import pkg_resources
pkg_resources.declare_namespace(__name__)
except ImportError:
import pkgutil
__path__ = pkgutil.extend_path(__path__, __name__)
22 changes: 22 additions & 0 deletions core/google/cloud/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Copyright 2014 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.

"""Google Cloud API access in idiomatic Python."""

try:
import pkg_resources
pkg_resources.declare_namespace(__name__)
except ImportError:
import pkgutil
__path__ = pkgutil.extend_path(__path__, __name__)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
72 changes: 72 additions & 0 deletions core/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# 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 os

from setuptools import setup
from setuptools import find_packages


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 = [
'httplib2 >= 0.9.1',
'googleapis-common-protos',
'oauth2client >= 2.0.1, < 3.0.0',
'protobuf >= 3.0.0',
'six',
]

setup(
name='google-cloud-core',
version='0.19.0',
description='API Client library for Google Cloud: Core Helpers',
long_description=README,
namespace_packages=[
'google',
'google.cloud',
],
packages=find_packages(),
install_requires=REQUIREMENTS,
**SETUP_BASE
)
6 changes: 5 additions & 1 deletion scripts/run_pylint.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,11 @@
IGNORED_DIRECTORIES = [
os.path.join('google', 'cloud', 'bigtable', '_generated'),
os.path.join('google', 'cloud', 'datastore', '_generated'),
'scripts/verify_included_modules.py',
]
IGNORED_FILES = [
os.path.join('docs', 'conf.py'),
]
IGNORED_POSTFIXES = [
'setup.py',
]
SCRIPTS_DIR = os.path.abspath(os.path.dirname(__file__))
Expand Down Expand Up @@ -113,6 +114,9 @@ def make_test_rc(base_rc_filename, additions_dict,

def valid_filename(filename):
"""Checks if a file is a Python file and is not ignored."""
for postfix in IGNORED_POSTFIXES:
if filename.endswith(postfix):
return False
for directory in IGNORED_DIRECTORIES:
if filename.startswith(directory):
return False
Expand Down
23 changes: 16 additions & 7 deletions scripts/verify_included_modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@
'google.cloud.vision.__init__',
'google.cloud.vision.fixtures',
])
PACKAGES = (
'',
'core',
)


class SphinxApp(object):
Expand Down Expand Up @@ -126,17 +130,24 @@ def main(build_root='_build'):
:param build_root: The root of the directory where docs are built into.
Defaults to ``_build``.
"""
if build_root is None:
parser = get_parser()
args = parser.parse_args()
build_root = args.build_root

object_inventory_relpath = os.path.join(build_root, 'html', 'objects.inv')

mock_uri = ''
inventory = fetch_inventory(SphinxApp, mock_uri,
object_inventory_relpath)
sphinx_mods = set(inventory['py:module'].keys())

library_dir = os.path.join(BASE_DIR, 'google', 'cloud')
public_mods = get_public_modules(library_dir,
base_package='google.cloud')
public_mods = set(public_mods)
public_mods = set()
for package in PACKAGES:
library_dir = os.path.join(BASE_DIR, package, 'google', 'cloud')
package_mods = get_public_modules(library_dir,
base_package='google.cloud')
public_mods.update(package_mods)

if not sphinx_mods <= public_mods:
unexpected_mods = sphinx_mods - public_mods
Expand Down Expand Up @@ -172,6 +183,4 @@ def get_parser():


if __name__ == '__main__':
parser = get_parser()
args = parser.parse_args()
main(build_root=args.build_root)
main(build_root=None)
55 changes: 28 additions & 27 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,42 @@
import os
import sys

from setuptools import setup
from setuptools import find_packages
from setuptools import setup


PROJECT_ROOT = os.path.abspath(os.path.dirname(__file__))

with open(os.path.join(PROJECT_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 = [
'httplib2 >= 0.9.1',
'googleapis-common-protos',
'oauth2client >= 2.0.1',
'protobuf >= 3.0.0',
'six',
'google-cloud-core',
]

GRPC_PACKAGES = [
Expand All @@ -36,31 +56,12 @@
name='google-cloud',
version='0.19.0',
description='API Client library for Google Cloud',
author='Google Cloud Platform',
author_email='jjg+google-cloud-python@google.com',
long_description=README,
scripts=[],
url='https://github.com/GoogleCloudPlatform/google-cloud-python',
namespace_packages=[
'google',
'google.cloud',
],
packages=find_packages(),
license='Apache 2.0',
platforms='Posix; MacOS X; Windows',
include_package_data=True,
zip_safe=False,
install_requires=REQUIREMENTS,
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',
]
**SETUP_BASE
)
1 change: 1 addition & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ envlist =

[testing]
deps =
{toxinidir}/core
pytest
covercmd =
py.test --quiet \
Expand Down

0 comments on commit d24c138

Please sign in to comment.