Skip to content

Commit a41f08f

Browse files
authored
Merge pull request #2416 from dhermes/make-storage-subpackage
Move storage code into a subpackage
2 parents d1dd186 + b01ffb4 commit a41f08f

27 files changed

+230
-1
lines changed

.travis.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,16 @@ script:
88
- tox -e py27
99
- (cd core && tox -e py27)
1010
- (cd bigtable && tox -e py27)
11+
- (cd storage && tox -e py27)
1112
- tox -e py34
1213
- (cd core && tox -e py34)
1314
- (cd bigtable && tox -e py34)
15+
- (cd storage && tox -e py34)
1416
- tox -e lint
1517
- tox -e cover
1618
- (cd core && tox -e cover)
1719
- (cd bigtable && tox -e cover)
20+
- (cd storage && tox -e cover)
1821
- tox -e system-tests
1922
- tox -e system-tests3
2023
- scripts/update_docs.sh

scripts/verify_included_modules.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
'',
6262
'bigtable',
6363
'core',
64+
'storage',
6465
)
6566

6667

setup.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,9 @@
5050

5151

5252
REQUIREMENTS = [
53-
'google-cloud-core',
5453
'google-cloud-bigtable',
54+
'google-cloud-core',
55+
'google-cloud-storage',
5556
]
5657

5758
GRPC_PACKAGES = [

storage/.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__

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

storage/README.rst

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
Python Client for Google Cloud Storage
2+
======================================
3+
4+
Python idiomatic client for `Google Cloud Storage`_
5+
6+
.. _Google Cloud Storage: https://cloud.google.com/storage/docs
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-storage
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+
Google `Cloud Storage`_ (`Storage API docs`_) allows you to store data on
36+
Google infrastructure with very high reliability, performance and
37+
availability, and can be used to distribute large data objects to users
38+
via direct download.
39+
40+
.. _Cloud Storage: https://cloud.google.com/storage/docs
41+
.. _Storage API docs: https://cloud.google.com/storage/docs/json_api/v1
42+
43+
See the ``google-cloud-python`` API `storage documentation`_ to learn how to
44+
connect to Cloud Storage using this Client Library.
45+
46+
.. _storage documentation: https://googlecloudplatform.github.io/google-cloud-python/stable/storage-client.html
47+
48+
You need to create a Google Cloud Storage bucket to use this client library.
49+
Follow along with the `official Google Cloud Storage documentation`_ to learn
50+
how to create a bucket.
51+
52+
.. _official Google Cloud Storage documentation: https://cloud.google.com/storage/docs/cloud-console#_creatingbuckets
53+
54+
.. code:: python
55+
56+
from google.cloud import storage
57+
client = storage.Client()
58+
bucket = client.get_bucket('bucket-id-here')
59+
# Then do other things...
60+
blob = bucket.get_blob('remote/path/to/file.txt')
61+
print(blob.download_as_string())
62+
blob.upload_from_string('New contents!')
63+
blob2 = bucket.blob('remote/path/storage.txt')
64+
blob2.upload_from_filename(filename='/local/path.txt')

storage/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__)

storage/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__)

0 commit comments

Comments
 (0)