blob: 9ac0088393ca71fe6df5bfbe9e35a860f176fbfb [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
Anthonios Partheniou3b4f2e22021-03-19 11:36:01 -040031retrieve the service definition from the internet. As of version 2.1.0,
32for backwards compatability with version 1.x, if `static_discovery` is not
33specified, the default value for `static_discovery` will be `True` when
34the `discoveryServiceUrl` argument of `discovery.build()` is provided.
release-please[bot]a9c7ddc2021-03-03 21:52:06 +000035
36If you experience issues or have questions, please file an [issue](https://github.com/googleapis/google-api-python-client/issues).
37
38## Supported Python Versions
39
40> **WARNING**: Breaking change
41
42The 2.0.0 release requires Python 3.6+, as such you must upgrade to Python 3.6+
43to use version 2.0.0.
44
45## Method Calls
46
47**Note**: Existing code written for earlier versions of this library will not
48require updating. You should only update your code if always using the latest
Anthonios Parthenioua6f17062021-03-15 10:18:02 -040049version of a service definition is more important than reliability or if you
50are using an API which does not have a public discovery document.
release-please[bot]a9c7ddc2021-03-03 21:52:06 +000051
52> **WARNING**: Breaking change
53
54The 2.0.0 release no longer retrieves discovery documents dynamically on each
55call to `discovery.build()`. Instead, discovery documents are retrieved from
56the client library itself.
57
58Under the hood, the `discovery.build()` function retrieves a discovery artifact
59in order to construct the service object. The breaking change is that the
60`discovery.build()` function will no longer retrieve discovery artifacts
61dynamically. Instead it will use service definitions shipped in the library.
62
63
64**Before:**
65```py
66from googleapiclient.discovery import build
67
68# Retrieve discovery artifacts from the internet
69with build('drive', 'v3') as service:
70 # ...
71```
72
73**After:**
74```py
75from googleapiclient.discovery import build
76
77# Retrieve discovery artifacts from the client library
78with build('drive', 'v3') as service:
79 # ...
80
81# Retrieve discovery artifacts from the internet
82with build('drive', 'v3', static_discovery=False) as service:
83 # ...
84```