Skip to content

Commit 77899d4

Browse files
authored
Merge pull request #2432 from dhermes/make-translate-subpackage
Move translate code into a subpackage
2 parents 7307429 + f80cdfc commit 77899d4

17 files changed

Lines changed: 209 additions & 0 deletions

.travis.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ script:
1919
- (cd resource_manager && tox -e py27)
2020
- (cd monitoring && tox -e py27)
2121
- (cd vision && tox -e py27)
22+
- (cd translate && tox -e py27)
2223
- tox -e py34
2324
- (cd core && tox -e py34)
2425
- (cd bigtable && tox -e py34)
@@ -33,6 +34,7 @@ script:
3334
- (cd resource_manager && tox -e py34)
3435
- (cd monitoring && tox -e py34)
3536
- (cd vision && tox -e py34)
37+
- (cd translate && tox -e py34)
3638
- tox -e lint
3739
- tox -e cover
3840
- (cd core && tox -e cover)
@@ -48,6 +50,7 @@ script:
4850
- (cd resource_manager && tox -e cover)
4951
- (cd monitoring && tox -e cover)
5052
- (cd vision && tox -e cover)
53+
- (cd translate && tox -e cover)
5154
- tox -e system-tests
5255
- tox -e system-tests3
5356
- scripts/update_docs.sh

scripts/verify_included_modules.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@
7171
'pubsub',
7272
'resource_manager',
7373
'storage',
74+
'translate',
7475
'vision',
7576
)
7677

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
'google-cloud-pubsub',
6363
'google-cloud-resource-manager',
6464
'google-cloud-storage',
65+
'google-cloud-translate',
6566
'google-cloud-vision',
6667
]
6768

tox.ini

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ deps =
1717
{toxinidir}/resource_manager
1818
{toxinidir}/monitoring
1919
{toxinidir}/vision
20+
{toxinidir}/translate
2021
pytest
2122
covercmd =
2223
py.test --quiet \
@@ -102,6 +103,12 @@ covercmd =
102103
--cov-append \
103104
--cov-config {toxinidir}/.coveragerc \
104105
vision/unit_tests
106+
py.test --quiet \
107+
--cov=google.cloud \
108+
--cov=unit_tests \
109+
--cov-append \
110+
--cov-config {toxinidir}/.coveragerc \
111+
translate/unit_tests
105112
coverage report --show-missing --fail-under=100
106113

107114
[testenv]

translate/.coveragerc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[run]
2+
branch = True
3+
4+
[report]
5+
fail_under = 100
6+
show_missing = True
7+
exclude_lines =
8+
# Re-enable the standard pragma
9+
pragma: NO COVER
10+
# Ignore debug-only repr
11+
def __repr__

translate/MANIFEST.in

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
include README.rst
2+
graft google
3+
graft unit_tests
4+
global-exclude *.pyc

translate/README.rst

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
Python Client for Google Translate
2+
==================================
3+
4+
Python idiomatic client for `Google Translate`_
5+
6+
.. _Google Translate: https://cloud.google.com/translate/
7+
8+
- `Homepage`_
9+
- `API Documentation`_
10+
11+
.. _Homepage: https://googlecloudplatform.github.io/google-cloud-python/
12+
.. _API Documentation: http://googlecloudplatform.github.io/google-cloud-python/
13+
14+
Quick Start
15+
-----------
16+
17+
::
18+
19+
$ pip install --upgrade google-cloud-translate
20+
21+
Authentication
22+
--------------
23+
24+
With ``google-cloud-python`` we try to make authentication as painless as
25+
possible. Check out the `Authentication section`_ in our documentation to
26+
learn more. You may also find the `authentication document`_ shared by all
27+
the ``google-cloud-*`` libraries to be helpful.
28+
29+
.. _Authentication section: http://google-cloud-python.readthedocs.io/en/latest/google-cloud-auth.html
30+
.. _authentication document: https://github.com/GoogleCloudPlatform/gcloud-common/tree/master/authentication
31+
32+
Using the API
33+
-------------
34+
35+
With the Google `Translate`_ API (`Translate API docs`_), you can
36+
dynamically translate text between thousands of language pairs.
37+
38+
.. _Translate: https://cloud.google.com/translate/
39+
.. _Translate API docs: https://cloud.google.com/translate/docs/apis
40+
41+
See the ``google-cloud-python`` API `Translate documentation`_ to learn
42+
how to translate text using this library.
43+
44+
.. _Translate documentation: https://google-cloud-python.readthedocs.io/en/stable/translate-usage.html

translate/google/__init__.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Copyright 2016 Google Inc.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
try:
16+
import pkg_resources
17+
pkg_resources.declare_namespace(__name__)
18+
except ImportError:
19+
import pkgutil
20+
__path__ = pkgutil.extend_path(__path__, __name__)

translate/google/cloud/__init__.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Copyright 2014 Google Inc.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
try:
16+
import pkg_resources
17+
pkg_resources.declare_namespace(__name__)
18+
except ImportError:
19+
import pkgutil
20+
__path__ = pkgutil.extend_path(__path__, __name__)
File renamed without changes.

0 commit comments

Comments
 (0)