Skip to content

Commit e8838a7

Browse files
authored
chore: migrate to owl bot (#663)
* chore: migrate to owl bot * chore: copy files from googleapis-gen f2de93abafa306b2ebadf1d10d947db8bcf2bf15 * chore: run the post processor
1 parent 506b268 commit e8838a7

File tree

6 files changed

+85
-207
lines changed

6 files changed

+85
-207
lines changed

.github/.OwlBot.lock.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
docker:
2+
digest: sha256:457583330eec64daa02aeb7a72a04d33e7be2428f646671ce4045dcbc0191b1e
3+
image: gcr.io/repo-automation-bots/owlbot-python:latest
4+

.github/.OwlBot.yaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Copyright 2021 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
docker:
16+
image: gcr.io/repo-automation-bots/owlbot-python:latest
17+
18+
deep-remove-regex:
19+
- /owl-bot-staging
20+
21+
deep-copy-regex:
22+
- source: /google/cloud/bigquery/(v.*)/.*-py/(.*)
23+
dest: /owl-bot-staging/$1/$2
24+
25+
begin-after-commit-hash: f2de93abafa306b2ebadf1d10d947db8bcf2bf15
26+

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@ repos:
2626
hooks:
2727
- id: black
2828
- repo: https://gitlab.com/pycqa/flake8
29-
rev: 3.9.0
29+
rev: 3.9.1
3030
hooks:
3131
- id: flake8

CONTRIBUTING.rst

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -160,21 +160,7 @@ Running System Tests
160160
auth settings and change some configuration in your project to
161161
run all the tests.
162162

163-
- System tests will be run against an actual project and
164-
so you'll need to provide some environment variables to facilitate
165-
authentication to your project:
166-
167-
- ``GOOGLE_APPLICATION_CREDENTIALS``: The path to a JSON key file;
168-
Such a file can be downloaded directly from the developer's console by clicking
169-
"Generate new JSON key". See private key
170-
`docs <https://cloud.google.com/storage/docs/authentication#generating-a-private-key>`__
171-
for more details.
172-
173-
- Once you have downloaded your json keys, set the environment variable
174-
``GOOGLE_APPLICATION_CREDENTIALS`` to the absolute path of the json file::
175-
176-
$ export GOOGLE_APPLICATION_CREDENTIALS="/Users/<your_username>/path/to/app_credentials.json"
177-
163+
- System tests will be run against an actual project. You should use local credentials from gcloud when possible. See `Best practices for application authentication <https://cloud.google.com/docs/authentication/best-practices-applications#local_development_and_testing_with_the>`__. Some tests require a service account. For those tests see `Authenticating as a service account <https://cloud.google.com/docs/authentication/production>`__.
178164

179165
*************
180166
Test Coverage

synth.py renamed to owlbot.py

Lines changed: 53 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -19,36 +19,61 @@
1919
from synthtool import gcp
2020
from synthtool.languages import python
2121

22-
gapic = gcp.GAPICBazel()
2322
common = gcp.CommonTemplates()
24-
version = "v2"
2523

26-
library = gapic.py_library(
27-
service="bigquery",
28-
version=version,
29-
bazel_target=f"//google/cloud/bigquery/{version}:bigquery-{version}-py",
30-
include_protos=True,
31-
)
32-
33-
s.move(
34-
library,
35-
excludes=[
36-
"*.tar.gz",
37-
"docs/index.rst",
38-
"docs/bigquery_v2/*_service.rst",
39-
"docs/bigquery_v2/services.rst",
40-
"README.rst",
41-
"noxfile.py",
42-
"setup.py",
43-
"scripts/fixup_bigquery_v2_keywords.py",
44-
library / f"google/cloud/bigquery/__init__.py",
45-
library / f"google/cloud/bigquery/py.typed",
46-
# There are no public API endpoints for the generated ModelServiceClient,
47-
# thus there's no point in generating it and its tests.
48-
library / f"google/cloud/bigquery_{version}/services/**",
49-
library / f"tests/unit/gapic/bigquery_{version}/**",
50-
],
51-
)
24+
default_version = "v2"
25+
26+
for library in s.get_staging_dirs(default_version):
27+
# Do not expose ModelServiceClient, as there is no public API endpoint for the
28+
# models service.
29+
s.replace(
30+
library / f"google/cloud/bigquery_{library.name}/__init__.py",
31+
r"from \.services\.model_service import ModelServiceClient",
32+
"",
33+
)
34+
s.replace(
35+
library / f"google/cloud/bigquery_{library.name}/__init__.py",
36+
r"""["']ModelServiceClient["'],""",
37+
"",
38+
)
39+
40+
# Adjust Model docstring so that Sphinx does not think that "predicted_" is
41+
# a reference to something, issuing a false warning.
42+
s.replace(
43+
library / f"google/cloud/bigquery_{library.name}/types/model.py",
44+
r'will have a "predicted_"',
45+
"will have a `predicted_`",
46+
)
47+
48+
# Avoid breaking change due to change in field renames.
49+
# https://github.com/googleapis/python-bigquery/issues/319
50+
s.replace(
51+
library / f"google/cloud/bigquery_{library.name}/types/standard_sql.py",
52+
r"type_ ",
53+
"type "
54+
)
55+
56+
s.move(
57+
library,
58+
excludes=[
59+
"*.tar.gz",
60+
"docs/index.rst",
61+
f"docs/bigquery_{library.name}/*_service.rst",
62+
f"docs/bigquery_{library.name}/services.rst",
63+
"README.rst",
64+
"noxfile.py",
65+
"setup.py",
66+
f"scripts/fixup_bigquery_{library.name}_keywords.py",
67+
f"google/cloud/bigquery/__init__.py",
68+
f"google/cloud/bigquery/py.typed",
69+
# There are no public API endpoints for the generated ModelServiceClient,
70+
# thus there's no point in generating it and its tests.
71+
f"google/cloud/bigquery_{library.name}/services/**",
72+
f"tests/unit/gapic/bigquery_{library.name}/**",
73+
],
74+
)
75+
76+
s.remove_staging_dirs()
5277

5378
# ----------------------------------------------------------------------------
5479
# Add templated files
@@ -79,41 +104,12 @@
79104

80105
python.py_samples()
81106

82-
# Do not expose ModelServiceClient, as there is no public API endpoint for the
83-
# models service.
84-
s.replace(
85-
"google/cloud/bigquery_v2/__init__.py",
86-
r"from \.services\.model_service import ModelServiceClient",
87-
"",
88-
)
89-
s.replace(
90-
"google/cloud/bigquery_v2/__init__.py",
91-
r"""["']ModelServiceClient["'],""",
92-
"",
93-
)
94-
95-
# Adjust Model docstring so that Sphinx does not think that "predicted_" is
96-
# a reference to something, issuing a false warning.
97-
s.replace(
98-
"google/cloud/bigquery_v2/types/model.py",
99-
r'will have a "predicted_"',
100-
"will have a `predicted_`",
101-
)
102-
103107
s.replace(
104108
"docs/conf.py",
105109
r'\{"members": True\}',
106110
'{"members": True, "inherited-members": True}'
107111
)
108112

109-
# Avoid breaking change due to change in field renames.
110-
# https://github.com/googleapis/python-bigquery/issues/319
111-
s.replace(
112-
"google/cloud/bigquery_v2/types/standard_sql.py",
113-
r"type_ ",
114-
"type "
115-
)
116-
117113
# Tell Sphinx to ingore autogenerated docs files.
118114
s.replace(
119115
"docs/conf.py",

synth.metadata

Lines changed: 0 additions & 134 deletions
This file was deleted.

0 commit comments

Comments
 (0)