Skip to content

Commit

Permalink
Merge pull request #2438 from dhermes/move-final-subpackage
Browse files Browse the repository at this point in the history
Move speech code into a subpackage **AND** remove all remnants of umbrella packages
  • Loading branch information
dhermes authored Sep 27, 2016
2 parents 77899d4 + 07c1047 commit b7f004e
Show file tree
Hide file tree
Showing 20 changed files with 172 additions and 43 deletions.
5 changes: 3 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ install:
- pip install --upgrade pip tox

script:
- tox -e py27
- (cd core && tox -e py27)
- (cd bigtable && tox -e py27)
- (cd storage && tox -e py27)
Expand All @@ -20,7 +19,7 @@ script:
- (cd monitoring && tox -e py27)
- (cd vision && tox -e py27)
- (cd translate && tox -e py27)
- tox -e py34
- (cd speech && tox -e py27)
- (cd core && tox -e py34)
- (cd bigtable && tox -e py34)
- (cd storage && tox -e py34)
Expand All @@ -35,6 +34,7 @@ script:
- (cd monitoring && tox -e py34)
- (cd vision && tox -e py34)
- (cd translate && tox -e py34)
- (cd speech && tox -e py34)
- tox -e lint
- tox -e cover
- (cd core && tox -e cover)
Expand All @@ -51,6 +51,7 @@ script:
- (cd monitoring && tox -e cover)
- (cd vision && tox -e cover)
- (cd translate && tox -e cover)
- (cd speech && tox -e cover)
- tox -e system-tests
- tox -e system-tests3
- scripts/update_docs.sh
Expand Down
1 change: 1 addition & 0 deletions scripts/verify_included_modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
'monitoring',
'pubsub',
'resource_manager',
'speech',
'storage',
'translate',
'vision',
Expand Down
5 changes: 0 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,6 @@
version='0.20.0dev',
description='API Client library for Google Cloud',
long_description=README,
namespace_packages=[
'google',
'google.cloud',
],
packages=find_packages(),
install_requires=REQUIREMENTS,
**SETUP_BASE
)
11 changes: 11 additions & 0 deletions speech/.coveragerc
Original file line number Diff line number Diff line change
@@ -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__
4 changes: 4 additions & 0 deletions speech/MANIFEST.in
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
44 changes: 44 additions & 0 deletions speech/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
Python Client for Google Cloud Speech
=====================================

Python idiomatic client for `Google Cloud Speech`_

.. _Google Cloud Speech: https://cloud.google.com/speech/

- `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-speech

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
-------------

`Cloud Speech API`_ enables easy integration of Google speech
recognition technologies into developer applications. Send audio
and receive a text transcription from the Cloud Speech API service.

.. _Cloud Speech API: https://cloud.google.com/speech/

See the ``google-cloud-python`` API `speech documentation`_ to learn how to
connect to the Google Cloud Speech API using this Client Library.

.. _speech documentation: https://googlecloudplatform.github.io/google-cloud-python/stable/speech-usage.html
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
68 changes: 68 additions & 0 deletions speech/setup.py
Original file line number Diff line number Diff line change
@@ -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-speech',
version='0.20.0dev',
description='Python Client for Google Cloud Speech',
long_description=README,
namespace_packages=[
'google',
'google.cloud',
],
packages=find_packages(),
install_requires=REQUIREMENTS,
**SETUP_BASE
)
30 changes: 30 additions & 0 deletions speech/tox.ini
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.speech \
--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
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def test_sync_recognize_content_with_optional_parameters(self):
import base64
from google.cloud._helpers import _to_bytes
from google.cloud.speech.client import Encoding
from unit_tests.speech._fixtures import SYNC_RECOGNIZE_RESPONSE
from unit_tests._fixtures import SYNC_RECOGNIZE_RESPONSE

_AUDIO_CONTENT = _to_bytes('/9j/4QNURXhpZgAASUkq')
_B64_AUDIO_CONTENT = base64.b64encode(_AUDIO_CONTENT)
Expand Down Expand Up @@ -89,7 +89,7 @@ def test_sync_recognize_content_with_optional_parameters(self):

def test_sync_recognize_source_uri_without_optional_parameters(self):
from google.cloud.speech.client import Encoding
from unit_tests.speech._fixtures import SYNC_RECOGNIZE_RESPONSE
from unit_tests._fixtures import SYNC_RECOGNIZE_RESPONSE

RETURNED = SYNC_RECOGNIZE_RESPONSE
REQUEST = {
Expand Down Expand Up @@ -162,7 +162,7 @@ def test_sync_recognize_without_samplerate(self):

def test_sync_recognize_with_empty_results(self):
from google.cloud.speech.client import Encoding
from unit_tests.speech._fixtures import SYNC_RECOGNIZE_EMPTY_RESPONSE
from unit_tests._fixtures import SYNC_RECOGNIZE_EMPTY_RESPONSE

credentials = _Credentials()
client = self._makeOne(credentials=credentials)
Expand Down
File renamed without changes.
15 changes: 8 additions & 7 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tox]
envlist =
py27,py34,py35,cover,docs,lint
cover,docs,lint

[testing]
deps =
Expand All @@ -18,18 +18,13 @@ deps =
{toxinidir}/monitoring
{toxinidir}/vision
{toxinidir}/translate
{toxinidir}/speech
pytest
covercmd =
py.test --quiet \
--cov=google.cloud \
--cov=unit_tests \
--cov-config {toxinidir}/.coveragerc \
unit_tests
py.test --quiet \
--cov=google.cloud \
--cov=unit_tests \
--cov-append \
--cov-config {toxinidir}/.coveragerc \
core/unit_tests
py.test --quiet \
--cov=google.cloud \
Expand Down Expand Up @@ -109,6 +104,12 @@ covercmd =
--cov-append \
--cov-config {toxinidir}/.coveragerc \
translate/unit_tests
py.test --quiet \
--cov=google.cloud \
--cov=unit_tests \
--cov-append \
--cov-config {toxinidir}/.coveragerc \
speech/unit_tests
coverage report --show-missing --fail-under=100

[testenv]
Expand Down
13 changes: 0 additions & 13 deletions unit_tests/speech/__init__.py

This file was deleted.

13 changes: 0 additions & 13 deletions unit_tests/streaming/__init__.py

This file was deleted.

0 comments on commit b7f004e

Please sign in to comment.