blob: 67143a622e32cd2f8b0d821502bb80fcba508740 [file] [log] [blame] [view]
release-please[bot]a9c7ddc2021-03-03 21:52:06 +00001# 2.0.0 Migration Guide
2
3The 2.0 release of `google-api-python-client` is a significant upgrade as only
4python 3.6 and newer is supported. If you are not able to upgrade python, then
5please continue to use version 1.x as we will continue supporting python 2.7+ in
6[v1](https://github.com/googleapis/google-api-python-client/tree/v1).
7
8In addition, discovery documents will no longer be retrieved dynamically when
9you call `discovery.build()`. The discovery documents will instead be retrieved
Anthonios Partheniou22807c92021-03-15 12:18:03 -040010from the client library directly. As a result of caching the discovery
11documents, the size of this package is at least 50 MB larger compared to the
12previous version.
13
Anthonios Parthenioua6f17062021-03-15 10:18:02 -040014
15For users of public APIs
16------------------------
17Existing code written for earlier versions of this library will not require
18updating. We believe this new default behaviour will provide a more predictable
19experience for users. If always using the latest version of a service definition
20is more important than reliability, users should set the `static_discovery`
21argument of `discovery.build()` to `False` to retrieve the service definition
22from the internet.
23
24For users of private APIs
25-------------------------
26If the discovery document requires an authentication key to access it, the
27discovery document is private and it will not be shipped with the library.
28Only discovery documents listed in [this public directory](https://www.googleapis.com/discovery/v1/apis/)
29are included in the library. Users of private APIs should set the
30`static_discovery` argument of `discovery.build()` to `False` to continue to
release-please[bot]a9c7ddc2021-03-03 21:52:06 +000031retrieve the service definition from the internet.
32
33If you experience issues or have questions, please file an [issue](https://github.com/googleapis/google-api-python-client/issues).
34
35## Supported Python Versions
36
37> **WARNING**: Breaking change
38
39The 2.0.0 release requires Python 3.6+, as such you must upgrade to Python 3.6+
40to use version 2.0.0.
41
42## Method Calls
43
44**Note**: Existing code written for earlier versions of this library will not
45require updating. You should only update your code if always using the latest
Anthonios Parthenioua6f17062021-03-15 10:18:02 -040046version of a service definition is more important than reliability or if you
47are using an API which does not have a public discovery document.
release-please[bot]a9c7ddc2021-03-03 21:52:06 +000048
49> **WARNING**: Breaking change
50
51The 2.0.0 release no longer retrieves discovery documents dynamically on each
52call to `discovery.build()`. Instead, discovery documents are retrieved from
53the client library itself.
54
55Under the hood, the `discovery.build()` function retrieves a discovery artifact
56in order to construct the service object. The breaking change is that the
57`discovery.build()` function will no longer retrieve discovery artifacts
58dynamically. Instead it will use service definitions shipped in the library.
59
60
61**Before:**
62```py
63from googleapiclient.discovery import build
64
65# Retrieve discovery artifacts from the internet
66with build('drive', 'v3') as service:
67 # ...
68```
69
70**After:**
71```py
72from googleapiclient.discovery import build
73
74# Retrieve discovery artifacts from the client library
75with build('drive', 'v3') as service:
76 # ...
77
78# Retrieve discovery artifacts from the internet
79with build('drive', 'v3', static_discovery=False) as service:
80 # ...
81```