Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preparing for a release of all packages. #2442

Merged
merged 3 commits into from
Sep 27, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
303 changes: 42 additions & 261 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,54 @@ Google Cloud Python Client

- `Homepage`_
- `API Documentation`_
- `Read The Docs Documentation`_

.. _Homepage: https://googlecloudplatform.github.io/google-cloud-python/
.. _API Documentation: http://googlecloudplatform.github.io/google-cloud-python/
.. _Read The Docs Documentation: http://google-cloud-python.readthedocs.io/en/stable/

This client supports the following Google Cloud Platform services:

- `Google Cloud Datastore`_
- `Google Cloud Storage`_
- `Google Cloud Pub/Sub`_
- `Google BigQuery`_
- `Google Cloud Resource Manager`_
- `Google Stackdriver Logging`_
- `Google Stackdriver Monitoring`_
- `Google Cloud Bigtable`_

.. _Google Cloud Datastore: https://github.com/GoogleCloudPlatform/google-cloud-python#google-cloud-datastore
.. _Google Cloud Storage: https://github.com/GoogleCloudPlatform/google-cloud-python#google-cloud-storage
.. _Google Cloud Pub/Sub: https://github.com/GoogleCloudPlatform/google-cloud-python#google-cloud-pubsub
.. _Google BigQuery: https://github.com/GoogleCloudPlatform/google-cloud-python#google-bigquery
.. _Google Cloud Resource Manager: https://github.com/GoogleCloudPlatform/google-cloud-python#google-cloud-resource-manager
.. _Google Stackdriver Logging: https://github.com/GoogleCloudPlatform/google-cloud-python#google-stackdriver-logging
.. _Google Stackdriver Monitoring: https://github.com/GoogleCloudPlatform/google-cloud-python#google-stackdriver-monitoring
.. _Google Cloud Bigtable: https://github.com/GoogleCloudPlatform/google-cloud-python/tree/master/bigtable
- `Google Cloud Datastore`_ (`Datastore README`_)
- `Google Cloud Storage`_ (`Storage README`_)
- `Google Cloud Pub/Sub`_ (`Pub/Sub README`_)
- `Google BigQuery`_ (`BigQuery README`_)
- `Google Cloud Resource Manager`_ (`Resource Manager README`_)
- `Stackdriver Logging`_ (`Logging README`_)
- `Stackdriver Monitoring`_ (`Monitoring README`_)
- `Google Cloud Bigtable`_ (`Bigtable README`_)
- `Google Cloud DNS`_ (`DNS README`_)
- `Stackdriver Error Reporting`_ (`Error Reporting README`_)
- `Google Cloud Natural Language`_ (`Natural Language README`_)
- `Google Translate`_ (`Translate README`_)
- `Google Cloud Vision`_ (`Vision README`_)

.. _Google Cloud Datastore: https://pypi.python.org/pypi/google-cloud-datastore
.. _Datastore README: https://github.com/GoogleCloudPlatform/google-cloud-python/tree/master/datastore
.. _Google Cloud Storage: https://pypi.python.org/pypi/google-cloud-storage
.. _Storage README: https://github.com/GoogleCloudPlatform/google-cloud-python/tree/master/storage
.. _Google Cloud Pub/Sub: https://pypi.python.org/pypi/google-cloud-pubsub
.. _Pub/Sub README: https://github.com/GoogleCloudPlatform/google-cloud-python/tree/master/pubsub
.. _Google BigQuery: https://pypi.python.org/pypi/google-cloud-bigquery
.. _BigQuery README: https://github.com/GoogleCloudPlatform/google-cloud-python/tree/master/bigquery
.. _Google Cloud Resource Manager: https://pypi.python.org/pypi/google-cloud-resource-manager
.. _Resource Manager README: https://github.com/GoogleCloudPlatform/google-cloud-python/tree/master/resource_manager
.. _Stackdriver Logging: https://pypi.python.org/pypi/google-cloud-logging
.. _Logging README: https://github.com/GoogleCloudPlatform/google-cloud-python/tree/master/logging
.. _Stackdriver Monitoring: https://pypi.python.org/pypi/google-cloud-monitoring
.. _Monitoring README: https://github.com/GoogleCloudPlatform/google-cloud-python/tree/master/monitoring
.. _Google Cloud Bigtable: https://pypi.python.org/pypi/google-cloud-bigtable
.. _Bigtable README: https://github.com/GoogleCloudPlatform/google-cloud-python/tree/master/bigtable
.. _Google Cloud DNS: https://pypi.python.org/pypi/google-cloud-dns
.. _DNS README: https://github.com/GoogleCloudPlatform/google-cloud-python/tree/master/dns
.. _Stackdriver Error Reporting: https://pypi.python.org/pypi/google-cloud-error-reporting
.. _Error Reporting README: https://github.com/GoogleCloudPlatform/google-cloud-python/tree/master/error_reporting
.. _Google Cloud Natural Language: https://pypi.python.org/pypi/google-cloud-language
.. _Natural Language README: https://github.com/GoogleCloudPlatform/google-cloud-python/tree/master/language
.. _Google Translate: https://pypi.python.org/pypi/google-cloud-translate
.. _Translate README: https://github.com/GoogleCloudPlatform/google-cloud-python/tree/master/translate
.. _Google Cloud Vision: https://pypi.python.org/pypi/google-cloud-vision
.. _Vision README: https://github.com/GoogleCloudPlatform/google-cloud-python/tree/master/vision

If you need support for other Google APIs, check out the
`Google APIs Python Client library`_.
Expand Down Expand Up @@ -66,250 +91,6 @@ You may also find the `authentication document`_ shared by all the
.. _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

Google Cloud Datastore
----------------------

Google `Cloud Datastore`_ (`Datastore API docs`_) is a fully managed, schemaless
database for storing non-relational data. Cloud Datastore automatically scales
with your users and supports ACID transactions, high availability of reads and
writes, strong consistency for reads and ancestor queries, and eventual
consistency for all other queries.

.. _Cloud Datastore: https://cloud.google.com/datastore/docs
.. _Datastore API docs: https://cloud.google.com/datastore/docs/

See the ``google-cloud-python`` API `datastore documentation`_ to learn how to
interact with the Cloud Datastore using this Client Library.

.. _datastore documentation: https://googlecloudplatform.github.io/google-cloud-python/stable/datastore-client.html

See the `official Google Cloud Datastore documentation`_ for more details on how
to activate Cloud Datastore for your project.

.. _official Google Cloud Datastore documentation: https://cloud.google.com/datastore/docs/activate

.. code:: python

from google.cloud import datastore
# Create, populate and persist an entity
entity = datastore.Entity(key=datastore.Key('EntityKind'))
entity.update({
'foo': u'bar',
'baz': 1337,
'qux': False,
})
# Then query for entities
query = datastore.Query(kind='EntityKind')
for result in query.fetch():
print(result)

Google Cloud Storage
--------------------

Google `Cloud Storage`_ (`Storage API docs`_) allows you to store data on Google
infrastructure with very high reliability, performance and availability, and can
be used to distribute large data objects to users via direct download.

.. _Cloud Storage: https://cloud.google.com/storage/docs
.. _Storage API docs: https://cloud.google.com/storage/docs/json_api/v1

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

.. _storage documentation: https://googlecloudplatform.github.io/google-cloud-python/stable/storage-client.html

You need to create a Google Cloud Storage bucket to use this client library.
Follow along with the `official Google Cloud Storage documentation`_ to learn
how to create a bucket.

.. _official Google Cloud Storage documentation: https://cloud.google.com/storage/docs/cloud-console#_creatingbuckets

.. code:: python

from google.cloud import storage
client = storage.Client()
bucket = client.get_bucket('bucket-id-here')
# Then do other things...
blob = bucket.get_blob('remote/path/to/file.txt')
print(blob.download_as_string())
blob.upload_from_string('New contents!')
blob2 = bucket.blob('remote/path/storage.txt')
blob2.upload_from_filename(filename='/local/path.txt')

Google Cloud Pub/Sub
--------------------

Google `Cloud Pub/Sub`_ (`Pub/Sub API docs`_) is designed to provide reliable,
many-to-many, asynchronous messaging between applications. Publisher
applications can send messages to a ``topic`` and other applications can
subscribe to that topic to receive the messages. By decoupling senders and
receivers, Google Cloud Pub/Sub allows developers to communicate between
independently written applications.

.. _Cloud Pub/Sub: https://cloud.google.com/pubsub/docs
.. _Pub/Sub API docs: https://cloud.google.com/pubsub/docs/reference/rest/

See the ``google-cloud-python`` API `Pub/Sub documentation`_ to learn how to connect
to Cloud Pub/Sub using this Client Library.

.. _Pub/Sub documentation: https://googlecloudplatform.github.io/google-cloud-python/stable/pubsub-usage.html

To get started with this API, you'll need to create

.. code:: python

from google.cloud import pubsub

client = pubsub.Client()
topic = client.topic('topic_name')
topic.create()

topic.publish('this is the message_payload',
attr1='value1', attr2='value2')

Google BigQuery
---------------

Querying massive datasets can be time consuming and expensive without the
right hardware and infrastructure. Google `BigQuery`_ (`BigQuery API docs`_)
solves this problem by enabling super-fast, SQL-like queries against
append-only tables, using the processing power of Google's infrastructure.

.. _BigQuery: https://cloud.google.com/bigquery/what-is-bigquery
.. _BigQuery API docs: https://cloud.google.com/bigquery/docs/reference/v2/

This package is still being implemented, but it is almost complete!

Load data from CSV
~~~~~~~~~~~~~~~~~~

.. code:: python

import csv

from google.cloud import bigquery
from google.cloud.bigquery import SchemaField

client = bigquery.Client()

dataset = client.dataset('dataset_name')
dataset.create() # API request

SCHEMA = [
SchemaField('full_name', 'STRING', mode='required'),
SchemaField('age', 'INTEGER', mode='required'),
]
table = dataset.table('table_name', SCHEMA)
table.create()

with open('csv_file', 'rb') as readable:
table.upload_from_file(
readable, source_format='CSV', skip_leading_rows=1)

Perform a synchronous query
~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. code:: python

# Perform a synchronous query.
QUERY = (
'SELECT name FROM [bigquery-public-data:usa_names.usa_1910_2013] '
'WHERE state = "TX"')
query = client.run_sync_query('%s LIMIT 100' % QUERY)
query.timeout_ms = TIMEOUT_MS
query.run()

for row in query.rows:
print(row)


See the ``google-cloud-python`` API `BigQuery documentation`_ to learn how to connect
to BigQuery using this Client Library.

.. _BigQuery documentation: https://googlecloudplatform.github.io/google-cloud-python/stable/bigquery-usage.html

Google Cloud Resource Manager
-----------------------------

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

Google Stackdriver Logging
--------------------------

`Stackdriver Logging`_ API (`Logging API docs`_) allows you to store, search,
analyze, monitor, and alert on log data and events from Google Cloud Platform.

.. _Stackdriver Logging: https://cloud.google.com/logging/
.. _Logging API docs: https://cloud.google.com/logging/docs/

.. code:: python

from google.cloud import logging
client = logging.Client()
logger = client.logger('log_name')
logger.log_text("A simple entry") # API call

Example of fetching entries:

.. code:: python

entries, token = logger.list_entries()
for entry in entries:
print(entry.payload)

See the ``google-cloud-python`` API `logging documentation`_ to learn how to connect
to Stackdriver Logging using this Client Library.

.. _logging documentation: https://googlecloudplatform.github.io/google-cloud-python/stable/logging-usage.html

Google Stackdriver Monitoring
-----------------------------

`Stackdriver Monitoring`_ (`Monitoring API docs`_) collects metrics,
events, and metadata from Google Cloud Platform, Amazon Web Services (AWS),
hosted uptime probes, application instrumentation, and a variety of common
application components including Cassandra, Nginx, Apache Web Server,
Elasticsearch and many others. Stackdriver ingests that data and generates
insights via dashboards, charts, and alerts.

This package currently supports all Monitoring API operations other than
writing custom metrics.

.. _Stackdriver Monitoring: https://cloud.google.com/monitoring/
.. _Monitoring API docs: https://cloud.google.com/monitoring/api/ref_v3/rest/

List available metric types:

.. code:: python

from google.cloud import monitoring
client = monitoring.Client()
for descriptor in client.list_metric_descriptors():
print(descriptor.type)

Display CPU utilization across your GCE instances during the last five minutes:

.. code:: python

metric = 'compute.googleapis.com/instance/cpu/utilization'
query = client.query(metric, minutes=5)
print(query.as_dataframe())

See the ``google-cloud-python`` API `monitoring documentation`_ to learn how to connect
to Stackdriver Monitoring using this Client Library.

.. _monitoring documentation: https://googlecloudplatform.github.io/google-cloud-python/stable/monitoring-usage.html

Contributing
------------

Expand Down
2 changes: 2 additions & 0 deletions bigquery/setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[bdist_wheel]
universal = 1
4 changes: 2 additions & 2 deletions bigquery/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@


REQUIREMENTS = [
'google-cloud-core',
'google-cloud-core >= 0.20.0',
]

setup(
name='google-cloud-bigquery',
version='0.20.0dev',
version='0.20.0',
description='Python Client for Google BigQuery',
long_description=README,
namespace_packages=[
Expand Down
2 changes: 2 additions & 0 deletions bigtable/setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[bdist_wheel]
universal = 1
6 changes: 3 additions & 3 deletions bigtable/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@


REQUIREMENTS = [
'google-cloud-core',
'grpcio >= 1.0.0',
'google-cloud-core >= 0.20.0',
'grpcio >= 1.0.0, < 2.0dev',
]

setup(
name='google-cloud-bigtable',
version='0.20.0dev',
version='0.20.0',
description='Python Client for Google Cloud Bigtable',
long_description=README,
namespace_packages=[
Expand Down
2 changes: 2 additions & 0 deletions core/setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[bdist_wheel]
universal = 1
2 changes: 1 addition & 1 deletion core/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@

setup(
name='google-cloud-core',
version='0.20.0dev',
version='0.20.0',
description='API Client library for Google Cloud: Core Helpers',
long_description=README,
namespace_packages=[
Expand Down
2 changes: 2 additions & 0 deletions datastore/setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[bdist_wheel]
universal = 1
6 changes: 3 additions & 3 deletions datastore/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@


REQUIREMENTS = [
'google-cloud-core',
'grpcio >= 1.0.0',
'google-cloud-core >= 0.20.0',
'grpcio >= 1.0.0, < 2.0dev',
]

setup(
name='google-cloud-datastore',
version='0.20.0dev',
version='0.20.0',
description='Python Client for Google Cloud Datastore',
long_description=README,
namespace_packages=[
Expand Down
2 changes: 2 additions & 0 deletions dns/setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[bdist_wheel]
universal = 1
Loading