Skip to content
This repository was archived by the owner on Nov 12, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/release-please.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
releaseType: python
handleGHRelease: true
manifest: true
# NOTE: this section is generated by synthtool.languages.python
# See https://github.com/googleapis/synthtool/blob/master/synthtool/languages/python.py
branches:
Expand Down
4 changes: 4 additions & 0 deletions .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
".": "2.16.2"
}

1 change: 0 additions & 1 deletion google/cloud/bigquery_storage/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
)

from google.cloud.bigquery_storage_v1 import gapic_types as types
from google.cloud.bigquery_storage_v1 import __version__
from google.cloud.bigquery_storage_v1.types.arrow import ArrowRecordBatch
from google.cloud.bigquery_storage_v1.types.arrow import ArrowSchema
from google.cloud.bigquery_storage_v1.types.arrow import ArrowSerializationOptions
Expand Down
2 changes: 1 addition & 1 deletion google/cloud/bigquery_storage/gapic_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
__version__ = "0.1.0"
__version__ = "2.16.2" # {x-release-please-version}
6 changes: 2 additions & 4 deletions google/cloud/bigquery_storage_v1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,9 @@

from __future__ import absolute_import

import pkg_resources
from google.cloud.bigquery_storage_v1 import gapic_version as package_version

__version__ = pkg_resources.get_distribution(
"google-cloud-bigquery-storage"
).version # noqa
__version__ = package_version.__version__

from google.cloud.bigquery_storage_v1 import client
from google.cloud.bigquery_storage_v1 import types
Expand Down
16 changes: 16 additions & 0 deletions google/cloud/bigquery_storage_v1/gapic_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
__version__ = "2.16.2" # {x-release-please-version}
6 changes: 2 additions & 4 deletions google/cloud/bigquery_storage_v1beta2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,9 @@

from __future__ import absolute_import

import pkg_resources
from google.cloud.bigquery_storage_v1beta2 import gapic_version as package_version

__version__ = pkg_resources.get_distribution(
"google-cloud-bigquery-storage"
).version # noqa
__version__ = package_version.__version__

from google.cloud.bigquery_storage_v1beta2 import client
from google.cloud.bigquery_storage_v1beta2 import types
Expand Down
16 changes: 16 additions & 0 deletions google/cloud/bigquery_storage_v1beta2/gapic_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
__version__ = "2.16.2" # {x-release-please-version}
97 changes: 36 additions & 61 deletions owlbot.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2018 Google LLC
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -12,25 +12,27 @@
# See the License for the specific language governing permissions and
# limitations under the License.

"""This script is used to synthesize generated parts of this library."""
import json
from pathlib import Path
import shutil

import synthtool as s
from synthtool import gcp
import synthtool.gcp as gcp
from synthtool.languages import python

common = gcp.CommonTemplates()
# ----------------------------------------------------------------------------
# Copy the generated client from the owl-bot staging directory
# ----------------------------------------------------------------------------

default_version = "v1"
clean_up_generated_samples = True

# Load the default version defined in .repo-metadata.json.
default_version = json.load(open(".repo-metadata.json", "rt")).get("default_version")

for library in s.get_staging_dirs(default_version):
# Work around gapic generator bug https://github.com/googleapis/gapic-generator-python/issues/902
s.replace(
library / f"google/cloud/bigquery_storage_{library.name}/types/arrow.py",
r""".
Attributes:""",
r""".\n
Attributes:""",
)
if clean_up_generated_samples:
shutil.rmtree("samples/generated_samples", ignore_errors=True)
clean_up_generated_samples = False

# We don't want the generated client to be accessible through
# "google.cloud.bigquery_storage", replace it with the hand written client that
Expand All @@ -57,30 +59,20 @@
"",
)

# We want types and __version__ to be accessible through the "main" library
# entry point.
s.replace(
library / "google/cloud/bigquery_storage/__init__.py",
f"from google\\.cloud\\.bigquery_storage_{library.name}\\.types\\.arrow import ArrowRecordBatch",
(
f"from google.cloud.bigquery_storage_{library.name} import types\n"
f"from google.cloud.bigquery_storage_{library.name} import __version__\n"
"\\g<0>"
),
)
s.replace(
library / "google/cloud/bigquery_storage/__init__.py",
r"""["']ArrowRecordBatch["']""",
('"__version__",\n' ' "types",\n' " \\g<0>"),
)

# We want to expose all types through "google.cloud.bigquery_storage.types",
# not just the types generated for the BQ Storage library. For example, we also
# want to include common proto types such as Timestamp.
# We want types to be accessible through the "main" library
s.replace(
library / "google/cloud/bigquery_storage/__init__.py",
r"import types",
"import gapic_types as types",
f"from google\\.cloud\\.bigquery_storage_{library.name}\\.types\\.arrow import ArrowRecordBatch",
(
f"from google.cloud.bigquery_storage_{library.name} import gapic_types as types\n"
"\\g<0>"
),
)

# The DataFormat enum is not exposed in bigquery_storage_v1/types, add it there.
Expand All @@ -95,59 +87,42 @@
'"DataFormat",\n \\g<0>',
)

# The append_rows method doesn't contain keyword arguments that build request
# objects, so flattened tests are not needed and break with TypeError.
s.replace(
library
/ f"tests/unit/gapic/bigquery_storage_{library.name}*/test_big_query_write.py",
r"(@[a-z.()\n]*\n)?(async )?"
r"def test_append_rows_flattened[_a-z]*\(\):\n"
r"( {4}.*|\n)+",
"\n",
)

s.move(
library,
[library],
excludes=[
"bigquery-storage-*-py.tar.gz",
"docs/conf.py",
"docs/index.rst",
"setup.py",
f"google/cloud/bigquery_storage_{library.name}/__init__.py",
# v1beta2 was first generated after the microgenerator migration.
"scripts/fixup_bigquery_storage_v1beta2_keywords.py",
"README.rst",
"nox*.py",
"setup.py",
"setup.cfg",
"**/gapic_version.py",
"docs/index.rst",
"testing/constraints-3.7.txt",
],
)

s.remove_staging_dirs()

# ----------------------------------------------------------------------------
# Add templated files
# ----------------------------------------------------------------------------

extras = ["fastavro", "pandas", "pyarrow"]
unit_test_extras = ["tests"] + extras

templated_files = common.py_library(
templated_files = gcp.CommonTemplates().py_library(
cov_level=98,
microgenerator=True,
samples=True,
unit_test_extras=unit_test_extras,
system_test_extras=extras,
system_test_external_dependencies=["google-cloud-bigquery"],
cov_level=98,
versions=gcp.common.detect_versions(path="./google", default_first=True),
)
s.move(
templated_files, excludes=[".coveragerc"]
) # microgenerator has a good .coveragerc file

python.configure_previous_major_version_branches()

# ----------------------------------------------------------------------------
# Samples templates
# ----------------------------------------------------------------------------
templated_files,
excludes=[".coveragerc", ".github/release-please.yml", "docs/index.rst"],
)

python.py_samples(skip_readmes=True)

s.shell.run(["nox", "-s", "blacken"], hide_output=False)
# run format session for all directories which have a noxfile
for noxfile in Path(".").glob("**/noxfile.py"):
s.shell.run(["nox", "-s", "blacken"], cwd=noxfile.parent, hide_output=False)
31 changes: 31 additions & 0 deletions release-please-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json",
"packages": {
".": {
"release-type": "python",
"extra-files": [
"google/cloud/bigquery_storage_v1/gapic_version.py",
"google/cloud/bigquery_storage_v1beta2/gapic_version.py",
"google/cloud/bigquery_storage/gapic_version.py",
{
"type": "json",
"path": "samples/generated_samples/snippet_metadata_google.cloud.bigquery.storage.v1.json",
"jsonpath": "$.clientLibrary.version"
},
{
"type": "json",
"path": "samples/generated_samples/snippet_metadata_google.cloud.bigquery.storage.v1beta2.json",
"jsonpath": "$.clientLibrary.version"
}
]
}
},
"release-type": "python",
"plugins": [
{
"type": "sentence-case"
}
],
"initial-version": "0.1.0"
}

Loading