Skip to content

Commit 0d496c6

Browse files
authored
docs: adds UPGRADING.md, not to readme, to help inform users about migration to v2 (#113)
* docs: adds UPGRADING.md, not to readme, to help inform users about migration to v2 * Update UPGRADING.md Co-authored-by: BenWhitehead <BenWhitehead@users.noreply.github.com> * docs: clarify enums statement * docs: add migration section to docs index Co-authored-by: BenWhitehead <BenWhitehead@users.noreply.github.com> release-as: 2.0.0
1 parent aabc0fd commit 0d496c6

File tree

4 files changed

+278
-0
lines changed

4 files changed

+278
-0
lines changed

README.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ Supported Python Versions
5555
^^^^^^^^^^^^^^^^^^^^^^^^^
5656
Python >= 3.6
5757

58+
The last version of this library compatible with Python 2.7 is google-cloud-datastore==1.15.3
5859

5960
Mac/Linux
6061
^^^^^^^^^

UPGRADING.md

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
# 2.0.0 Migration Guide
2+
3+
The 2.0 release of the `google-cloud-datastore` client is a significant upgrade based on a [next-gen code generator](https://github.com/googleapis/gapic-generator-python), and includes substantial interface changes. Existing code written for earlier versions of this library may require updates to use this version. This document describes the changes that have been made, and what you need to do to update your usage.
4+
5+
If you experience issues or have questions, please file an [issue](https://github.com/googleapis/python-datastore/issues).
6+
7+
## Supported Python Versions
8+
9+
> **WARNING**: Breaking change
10+
11+
The 2.0.0 release requires Python 3.6+.
12+
13+
14+
## Method Calls
15+
16+
> **WARNING**: Breaking change
17+
18+
If you previously were using modules or functions under the namespace
19+
`google.cloud.datastore_v1.gapic` there is a high likelihood you have incompatible code.
20+
To assist with this, we have included some helpful scripts to make some of the code
21+
modifications required to use 2.0.0.
22+
23+
* Install the library
24+
25+
```py
26+
python3 -m pip install google-cloud-datastore
27+
```
28+
29+
* The scripts `fixup_datastore_v1_keywords.py` and `fixup_datastore_admin_v1_keywords.py`
30+
is shipped with the library. It expects an input directory (with the code to convert)
31+
and an empty destination directory.
32+
33+
```sh
34+
$ fixup_datastore_v1_keywords.py --input-directory .samples/ --output-directory samples/
35+
$ fixup_datastore_admin_v1_keywords.py --input-directory .samples/ --output-directory samples/
36+
```
37+
38+
### More Details
39+
40+
In `google-cloud-datastore<2.0.0`, parameters required by the API were positional parameters and optional parameters were keyword parameters.
41+
42+
**Before:**
43+
```py
44+
def a_method(
45+
self,
46+
param1,
47+
param2,
48+
param3,
49+
retry=google.api_core.gapic_v1.method.DEFAULT,
50+
timeout=google.api_core.gapic_v1.method.DEFAULT,
51+
metadata=None,
52+
):
53+
```
54+
55+
In the 2.0.0 release, all methods have a single positional parameter `request`. Method docstrings indicate whether a parameter is required or optional.
56+
57+
Some methods have additional keyword only parameters. The available parameters depend on the `google.api.method_signature` annotation specified by the API producer.
58+
59+
60+
**After:**
61+
```py
62+
def a_method(
63+
self,
64+
request: RequestType = None,
65+
*
66+
param1,
67+
param2,
68+
param3,
69+
retry=google.api_core.gapic_v1.method.DEFAULT,
70+
timeout=google.api_core.gapic_v1.method.DEFAULT,
71+
metadata=None,
72+
):
73+
```
74+
75+
> **NOTE:** The `request` parameter and flattened keyword parameters for the API are mutually exclusive.
76+
> Passing both will result in an error.
77+
78+
79+
Both of these calls are valid:
80+
81+
```py
82+
response = client.a_method(
83+
request={
84+
"param1": param1,
85+
"param2": param2,
86+
"param3": param3
87+
}
88+
)
89+
```
90+
91+
```py
92+
response = client.a_method(
93+
param1=param1,
94+
param2=param2,
95+
param3=param3
96+
)
97+
```
98+
99+
This call is invalid because it mixes `request` with a keyword argument `param1`. Executing this code
100+
will result in an error.
101+
102+
```py
103+
response = client.a_method(
104+
request={
105+
"param1": param1,
106+
"param2": param2
107+
},
108+
param2=param2
109+
)
110+
```
111+
112+
113+
114+
## Enums and Types
115+
116+
117+
> **WARNING**: Breaking change
118+
119+
The `enums` submodule has been removed.
120+
121+
**Before:**
122+
```py
123+
from google.cloud import datastore_v1
124+
125+
direction = datastore_v1.enums.CommitRequest.Mode.TRANSACTIONAL
126+
```
127+
128+
129+
**After:**
130+
```py
131+
from google.cloud import datastore_v1
132+
133+
direction = datastore_v1.types.CommitRequest.Mode.TRANSACTIONAL
134+
```

docs/UPGRADING.md

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
# 2.0.0 Migration Guide
2+
3+
The 2.0 release of the `google-cloud-datastore` client is a significant upgrade based on a [next-gen code generator](https://github.com/googleapis/gapic-generator-python), and includes substantial interface changes. Existing code written for earlier versions of this library may require updates to use this version. This document describes the changes that have been made, and what you need to do to update your usage.
4+
5+
If you experience issues or have questions, please file an [issue](https://github.com/googleapis/python-datastore/issues).
6+
7+
## Supported Python Versions
8+
9+
> **WARNING**: Breaking change
10+
11+
The 2.0.0 release requires Python 3.6+.
12+
13+
14+
## Method Calls
15+
16+
> **WARNING**: Breaking change
17+
18+
If you previously were using modules or functions under the namespace
19+
`google.cloud.datastore_v1.gapic` there is a high likelihood you have incompatible code.
20+
To assist with this, we have includes some helpful scripts to make some of the code
21+
modifications required to use 2.0.0.
22+
23+
* Install the library
24+
25+
```py
26+
python3 -m pip install google-cloud-datastore
27+
```
28+
29+
* The scripts `fixup_datastore_v1_keywords.py` and `fixup_datastore_admin_v1_keywords.py`
30+
is shipped with the library. It expects an input directory (with the code to convert)
31+
and an empty destination directory.
32+
33+
```sh
34+
$ fixup_datastore_v1_keywords.py --input-directory .samples/ --output-directory samples/
35+
$ fixup_datastore_admin_v1_keywords.py --input-directory .samples/ --output-directory samples/
36+
```
37+
38+
### More Details
39+
40+
In `google-cloud-datastore<2.0.0`, parameters required by the API were positional parameters and optional parameters were keyword parameters.
41+
42+
**Before:**
43+
```py
44+
def a_method(
45+
self,
46+
param1,
47+
param2,
48+
param3,
49+
retry=google.api_core.gapic_v1.method.DEFAULT,
50+
timeout=google.api_core.gapic_v1.method.DEFAULT,
51+
metadata=None,
52+
):
53+
```
54+
55+
In the 2.0.0 release, all methods have a single positional parameter `request`. Method docstrings indicate whether a parameter is required or optional.
56+
57+
Some methods have additional keyword only parameters. The available parameters depend on the `google.api.method_signature` annotation specified by the API producer.
58+
59+
60+
**After:**
61+
```py
62+
def a_method(
63+
self,
64+
request: RequestType = None,
65+
*
66+
param1,
67+
param2,
68+
param3,
69+
retry=google.api_core.gapic_v1.method.DEFAULT,
70+
timeout=google.api_core.gapic_v1.method.DEFAULT,
71+
metadata=None,
72+
):
73+
```
74+
75+
> **NOTE:** The `request` parameter and flattened keyword parameters for the API are mutually exclusive.
76+
> Passing both will result in an error.
77+
78+
79+
Both of these calls are valid:
80+
81+
```py
82+
response = client.a_method(
83+
request={
84+
"param1": param1,
85+
"param2": param2,
86+
"param3": param3
87+
}
88+
)
89+
```
90+
91+
```py
92+
response = client.a_method(
93+
param1=param1,
94+
param2=param2,
95+
param3=param3
96+
)
97+
```
98+
99+
This call is invalid because it mixes `request` with a keyword argument `param1`. Executing this code
100+
will result in an error.
101+
102+
```py
103+
response = client.a_method(
104+
request={
105+
"param1": param1,
106+
"param2": param2
107+
},
108+
param2=param2
109+
)
110+
```
111+
112+
113+
114+
## Enums and Types
115+
116+
117+
> **WARNING**: Breaking change
118+
119+
The `enums` submodule has been removed.
120+
121+
**Before:**
122+
```py
123+
from google.cloud import datastore_v1
124+
125+
direction = datastore_v1.enums.CommitRequest.Mode.TRANSACTIONAL
126+
```
127+
128+
129+
**After:**
130+
```py
131+
from google.cloud import datastore_v1
132+
133+
direction = datastore_v1.types.CommitRequest.Mode.TRANSACTIONAL
134+
```

docs/index.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,15 @@ API Reference
2323
helpers
2424
admin_client
2525

26+
Migration Guide
27+
---------------
28+
29+
See the guide below for instructions on migrating to the 2.x release of this library.
30+
31+
.. toctree::
32+
:maxdepth: 2
33+
34+
UPGRADING
2635

2736
Changelog
2837
---------

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy