Skip to content
This repository was archived by the owner on Sep 5, 2023. It is now read-only.

Commit 14fbdb8

Browse files
hkdevandlaRicardo Mendesgguussdpebotkurtisvg
authored
feat: Migrate API client to Microgenerator (#54)
* Add samples for Data Catalog lookup_entry [(#2148)](GoogleCloudPlatform/python-docs-samples#2148) * Add samples for Data Catalog lookup_entry * Add tests for Data Catalog lookup_entry * Add samples for lookup_entry by SQL Resource * Add README.rst * Improve command line interface * Removed the "lookup-" prefix from commands * Handle the --sql-resource optional argument by subparsers * Refer to GCP public assets in tests * Add region tags to support Data Catalog docs [(#2169)](GoogleCloudPlatform/python-docs-samples#2169) * Adds updates including compute [(#2436)](GoogleCloudPlatform/python-docs-samples#2436) * Adds updates including compute * Python 2 compat pytest * Fixing weird \r\n issue from GH merge * Put asset tests back in * Re-add pod operator test * Hack parameter for k8s pod operator * Auto-update dependencies. [(#2005)](GoogleCloudPlatform/python-docs-samples#2005) * Auto-update dependencies. * Revert update of appengine/flexible/datastore. * revert update of appengine/flexible/scipy * revert update of bigquery/bqml * revert update of bigquery/cloud-client * revert update of bigquery/datalab-migration * revert update of bigtable/quickstart * revert update of compute/api * revert update of container_registry/container_analysis * revert update of dataflow/run_template * revert update of datastore/cloud-ndb * revert update of dialogflow/cloud-client * revert update of dlp * revert update of functions/imagemagick * revert update of functions/ocr/app * revert update of healthcare/api-client/fhir * revert update of iam/api-client * revert update of iot/api-client/gcs_file_to_device * revert update of iot/api-client/mqtt_example * revert update of language/automl * revert update of run/image-processing * revert update of vision/automl * revert update testing/requirements.txt * revert update of vision/cloud-client/detect * revert update of vision/cloud-client/product_search * revert update of jobs/v2/api_client * revert update of jobs/v3/api_client * revert update of opencensus * revert update of translate/cloud-client * revert update to speech/cloud-client Co-authored-by: Kurtis Van Gent <31518063+kurtisvg@users.noreply.github.com> Co-authored-by: Doug Mahugh <dmahugh@gmail.com> * chore(deps): update dependency google-cloud-datacatalog to v0.6.0 [(#3069)](GoogleCloudPlatform/python-docs-samples#3069) This PR contains the following updates: | Package | Update | Change | |---|---|---| | [google-cloud-datacatalog](https://togithub.com/googleapis/python-datacatalog) | minor | `==0.5.0` -> `==0.6.0` | --- ### Release Notes <details> <summary>googleapis/python-datacatalog</summary> ### [`v0.6.0`](https://togithub.com/googleapis/python-datacatalog/blob/master/CHANGELOG.md#&#8203;060httpswwwgithubcomgoogleapispython-datacatalogcomparev050v060-2020-02-24) [Compare Source](https://togithub.com/googleapis/python-datacatalog/compare/v0.5.0...v0.6.0) ##### Features - **datacatalog:** add sample for create a fileset entry quickstart ([#&#8203;9977](https://www.github.com/googleapis/python-datacatalog/issues/9977)) ([16eaf4b](https://www.github.com/googleapis/python-datacatalog/commit/16eaf4b16cdc0ce7361afb1d8dac666cea2a9db0)) - **datacatalog:** undeprecate resource name helper methods, bump copyright year to 2020, tweak docstring formatting (via synth) ([#&#8203;10228](https://www.github.com/googleapis/python-datacatalog/issues/10228)) ([84e5e7c](https://www.github.com/googleapis/python-datacatalog/commit/84e5e7c340fa189ce4cffca4fdee82cc7ded9f70)) - add `list_entry_groups`, `list_entries`, `update_entry_group` methods to v1beta1 (via synth) ([#&#8203;6](https://www.github.com/googleapis/python-datacatalog/issues/6)) ([b51902e](https://www.github.com/googleapis/python-datacatalog/commit/b51902e26d590f52c9412756a178265850b7d516)) ##### Bug Fixes - **datacatalog:** deprecate resource name helper methods (via synth) ([#&#8203;9831](https://www.github.com/googleapis/python-datacatalog/issues/9831)) ([22db3f0](https://www.github.com/googleapis/python-datacatalog/commit/22db3f0683b8aca544cd96c0063dcc8157ad7335)) </details> --- ### Renovate configuration :date: **Schedule**: At any time (no schedule defined). :vertical_traffic_light: **Automerge**: Disabled by config. Please merge this manually once you are satisfied. :recycle: **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. :no_bell: **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#GoogleCloudPlatform/python-docs-samples). * Simplify noxfile setup. [(#2806)](GoogleCloudPlatform/python-docs-samples#2806) * chore(deps): update dependency requests to v2.23.0 * Simplify noxfile and add version control. * Configure appengine/standard to only test Python 2.7. * Update Kokokro configs to match noxfile. * Add requirements-test to each folder. * Remove Py2 versions from everything execept appengine/standard. * Remove conftest.py. * Remove appengine/standard/conftest.py * Remove 'no-sucess-flaky-report' from pytest.ini. * Add GAE SDK back to appengine/standard tests. * Fix typo. * Roll pytest to python 2 version. * Add a bunch of testing requirements. * Remove typo. * Add appengine lib directory back in. * Add some additional requirements. * Fix issue with flake8 args. * Even more requirements. * Readd appengine conftest.py. * Add a few more requirements. * Even more Appengine requirements. * Add webtest for appengine/standard/mailgun. * Add some additional requirements. * Add workaround for issue with mailjet-rest. * Add responses for appengine/standard/mailjet. Co-authored-by: Renovate Bot <bot@renovateapp.com> * Update dependency google-cloud-datacatalog to v0.7.0 [(#3320)](GoogleCloudPlatform/python-docs-samples#3320) Co-authored-by: Bu Sun Kim <8822365+busunkim96@users.noreply.github.com> * Update Data Catalog samples to V1 [(#3382)](GoogleCloudPlatform/python-docs-samples#3382) Co-authored-by: Takashi Matsuo <tmatsuo@google.com> * chore(deps): update dependency google-cloud-datacatalog to v0.8.0 [(#3850)](GoogleCloudPlatform/python-docs-samples#3850) * Update dependency google-cloud-datacatalog to v1 [(#4115)](GoogleCloudPlatform/python-docs-samples#4115) * chore(deps): update dependency pytest to v5.4.3 [(#4279)](GoogleCloudPlatform/python-docs-samples#4279) * chore(deps): update dependency pytest to v5.4.3 * specify pytest for python 2 in appengine Co-authored-by: Leah Cole <coleleah@google.com> * Update dependency pytest to v6 [(#4390)](GoogleCloudPlatform/python-docs-samples#4390) * chore: update templates * chore: update templates * feat: Migrate to use Microgenerator * feat: Migrate to use Microgenerator * feat: Migrate to use Microgenerator * Migrate API to microgenerator * Migrate API to microgenerator * Samples tests * fix samples tests * fix lint errors and test coverage metrics * docs update * fix docs * fix docs * fix docs * remove .python-version file Co-authored-by: Ricardo Mendes <50331050+ricardosm-cit@users.noreply.github.com> Co-authored-by: Gus Class <gguuss@gmail.com> Co-authored-by: DPEBot <dpebot@google.com> Co-authored-by: Kurtis Van Gent <31518063+kurtisvg@users.noreply.github.com> Co-authored-by: Doug Mahugh <dmahugh@gmail.com> Co-authored-by: WhiteSource Renovate <bot@renovateapp.com> Co-authored-by: Bu Sun Kim <8822365+busunkim96@users.noreply.github.com> Co-authored-by: Marcelo Costa <mycelo19@gmail.com> Co-authored-by: Takashi Matsuo <tmatsuo@google.com> Co-authored-by: Leah Cole <coleleah@google.com>
1 parent 4efd7b7 commit 14fbdb8

File tree

175 files changed

+50245
-32197
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

175 files changed

+50245
-32197
lines changed

.coveragerc

+6-5
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,16 @@ branch = True
2121
[report]
2222
fail_under = 100
2323
show_missing = True
24+
omit = google/cloud/datacatalog/__init.py
2425
exclude_lines =
2526
# Re-enable the standard pragma
2627
pragma: NO COVER
2728
# Ignore debug-only repr
2829
def __repr__
2930
# Ignore abstract methods
3031
raise NotImplementedError
31-
omit =
32-
*/gapic/*.py
33-
*/proto/*.py
34-
*/core/*.py
35-
*/site-packages/*.py
32+
# Ignore pkg_resources exceptions.
33+
# This is added at the module level as a safeguard for if someone
34+
# generates the code and tries to run it without pip installing. This
35+
# makes it virtually impossible to test properly.
36+
except pkg_resources.DistributionNotFound

README.rst

+11
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,17 @@ In order to use this library, you first need to go through the following steps:
3535
.. _Enable the Google Cloud Data Catalog API.: https://cloud.google.com/data-catalog
3636
.. _Setup Authentication.: https://googleapis.dev/python/google-api-core/latest/auth.html
3737

38+
39+
Supported Python Versions
40+
^^^^^^^^^^^^^^^^^^^^^^^^^
41+
Python >= 3.6
42+
43+
Deprecated Python Versions
44+
^^^^^^^^^^^^^^^^^^^^^^^^^^
45+
Python == 2.7.
46+
47+
The last version of this library compatible with Python 2.7 is google-cloud-datacatalog==1.0.0.
48+
3849
Installation
3950
~~~~~~~~~~~~
4051

UPGRADING.md

+150
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
# 2.0.0 Migration Guide
2+
3+
The 2.0 release of the `google-cloud-datacatalog` 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 will likely 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-datacatalog/issues).
6+
7+
## Supported Python Versions
8+
9+
> **WARNING**: Breaking change
10+
The 2.0.0 release requires Python 3.6+.
11+
12+
13+
## Method Calls
14+
15+
> **WARNING**: Breaking change
16+
Methods expect request objects. We provide a script that will convert most common use cases.
17+
18+
* Install the library
19+
20+
```py
21+
python3 -m pip install google-cloud-datacatalog
22+
```
23+
24+
* The script `fixup_datacatalog_v1_keywords.py` is shipped with the library. It expects
25+
an input directory (with the code to convert) and an empty destination directory.
26+
27+
```sh
28+
$ fixup_datacatalog_v1_keywords.py --input-directory .samples/ --output-directory samples/
29+
```
30+
31+
**Before:**
32+
```py
33+
from google.cloud import datacatalog_v1
34+
datacatalog = datacatalog_v1.DataCatalogClient()
35+
return datacatalog.lookup_entry(linked_resource=resource_name)
36+
```
37+
38+
39+
**After:**
40+
```py
41+
from google.cloud import datacatalog_v1
42+
datacatalog = datacatalog_v1.DataCatalogClient()
43+
return datacatalog.lookup_entry(request={'linked_resource': resource_name})
44+
```
45+
46+
### More Details
47+
48+
In `google-cloud-datacatalog<2.0.0`, parameters required by the API were positional parameters and optional parameters were keyword parameters.
49+
50+
**Before:**
51+
```py
52+
def create_entry_group(
53+
self,
54+
parent,
55+
entry_group_id,
56+
entry_group=None,
57+
retry=google.api_core.gapic_v1.method.DEFAULT,
58+
timeout=google.api_core.gapic_v1.method.DEFAULT,
59+
metadata=None,
60+
):
61+
```
62+
63+
In the 2.0.0 release, all methods have a single positional parameter `request`. Method docstrings indicate whether a parameter is required or optional.
64+
65+
Some methods have additional keyword only parameters. The available parameters depend on the `google.api.method_signature` annotation specified by the API producer.
66+
67+
68+
**After:**
69+
```py
70+
def create_entry_group(
71+
self,
72+
request: datacatalog.CreateEntryGroupRequest = None,
73+
*,
74+
parent: str = None,
75+
entry_group_id: str = None,
76+
entry_group: datacatalog.EntryGroup = None,
77+
retry: retries.Retry = gapic_v1.method.DEFAULT,
78+
timeout: float = None,
79+
metadata: Sequence[Tuple[str, str]] = (),
80+
) -> datacatalog.EntryGroup:
81+
```
82+
83+
> **NOTE:** The `request` parameter and flattened keyword parameters for the API are mutually exclusive.
84+
> Passing both will result in an error.
85+
86+
Both of these calls are valid:
87+
88+
```py
89+
response = client.create_entry_group(
90+
request={
91+
"parent": parent,
92+
"entry_group_id": entry_group_id,
93+
"entry_group": entry_group
94+
}
95+
)
96+
```
97+
98+
```py
99+
response = client.create_entry_group(
100+
parent=parent,
101+
entry_group_id=entry_group_id,
102+
entry_group=entry_group
103+
) # Make an API request.
104+
```
105+
106+
This call is invalid because it mixes `request` with a keyword argument `entry_group`. Executing this code
107+
will result in an error.
108+
109+
```py
110+
response = client.create_entry_group(
111+
request={
112+
"parent": parent,
113+
"entry_group_id"=entry_group_id
114+
},
115+
entry_group=entry_group
116+
)
117+
```
118+
119+
120+
121+
## Enums and Types
122+
123+
124+
> **WARNING**: Breaking change
125+
The submodules `enums` and `types` have been removed.
126+
127+
**Before:**
128+
```py
129+
from google.cloud import datacatalog_v1
130+
entry = datacatalog_v1beta1.types.Entry()
131+
entry.type = datacatalog_v1beta1.enums.EntryType.FILESET
132+
```
133+
134+
135+
**After:**
136+
```py
137+
from google.cloud import datacatalog_v1
138+
entry = datacatalog_v1beta1.Entry()
139+
entry.type = datacatalog_v1beta1.EntryType.FILESET
140+
```
141+
142+
## Project Path Helper Methods
143+
144+
The project path helper method `project_path` has been removed. Please construct
145+
this path manually.
146+
147+
```py
148+
project = 'my-project'
149+
project_path = f'projects/{project}'
150+
```

docs/UPGRADING.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../UPGRADING.md

docs/datacatalog_v1/services.rst

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Services for Google Cloud Datacatalog v1 API
2+
============================================
3+
4+
.. automodule:: google.cloud.datacatalog_v1.services.data_catalog
5+
:members:
6+
:inherited-members:

docs/datacatalog_v1/types.rst

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Types for Google Cloud Datacatalog v1 API
2+
=========================================
3+
4+
.. automodule:: google.cloud.datacatalog_v1.types
5+
:members:

docs/datacatalog_v1beta1/services.rst

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
Services for Google Cloud Datacatalog v1beta1 API
2+
=================================================
3+
4+
.. automodule:: google.cloud.datacatalog_v1beta1.services.data_catalog
5+
:members:
6+
:inherited-members:
7+
.. automodule:: google.cloud.datacatalog_v1beta1.services.policy_tag_manager
8+
:members:
9+
:inherited-members:
10+
.. automodule:: google.cloud.datacatalog_v1beta1.services.policy_tag_manager_serialization
11+
:members:
12+
:inherited-members:
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
Types for Google Cloud Data Catalog API Client
1+
Types for Google Cloud Datacatalog v1beta1 API
22
==============================================
33

44
.. automodule:: google.cloud.datacatalog_v1beta1.types
5-
:members:
5+
:members:

docs/gapic/v1/api.rst

-6
This file was deleted.

docs/gapic/v1/types.rst

-5
This file was deleted.

docs/gapic/v1beta1/api.rst

-6
This file was deleted.

docs/index.rst

+13-5
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,27 @@ v1
88
.. toctree::
99
:maxdepth: 2
1010

11-
gapic/v1/api
12-
gapic/v1/types
13-
11+
datacatalog_v1/services
12+
datacatalog_v1/types
1413

1514
v1beta1
1615
-------------
1716

1817
.. toctree::
1918
:maxdepth: 2
2019

21-
gapic/v1beta1/api
22-
gapic/v1beta1/types
20+
datacatalog_v1beta1/services
21+
datacatalog_v1beta1/types
22+
23+
Migration Guide
24+
---------------
25+
26+
See the guide below for instructions on migrating to the 2.x release of this library.
27+
28+
.. toctree::
29+
:maxdepth: 2
2330

31+
UPGRADING
2432

2533
Changelog
2634
---------

0 commit comments

Comments
 (0)