Skip to content
This repository was archived by the owner on Mar 31, 2026. It is now read-only.

Commit 4bb4622

Browse files
authored
chore: onboard to librarian (#1454)
Towards googleapis/librarian#2460
1 parent e08260f commit 4bb4622

23 files changed

+810
-235
lines changed

.github/.OwlBot.lock.yaml

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

.github/.OwlBot.yaml

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

.github/auto-approve.yml

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

.github/release-please.yml

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

.github/release-trigger.yml

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

.github/snippet-bot.yml

Whitespace-only changes.

.github/sync-repo-settings.yaml

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

.github/workflows/presubmit.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
- name: Setup Python
1818
uses: actions/setup-python@v6
1919
with:
20-
python-version: 3.13
20+
python-version: 3.14
2121
- name: Install nox
2222
run: python -m pip install nox
2323
- name: Check formatting
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"name": "spanner",
3+
"name_pretty": "Cloud Spanner",
4+
"product_documentation": "https://cloud.google.com/spanner/docs/",
5+
"client_documentation": "https://cloud.google.com/python/docs/reference/spanner/latest",
6+
"issue_tracker": "https://issuetracker.google.com/issues?q=componentid:190851%2B%20status:open",
7+
"release_level": "stable",
8+
"language": "python",
9+
"library_type": "GAPIC_COMBO",
10+
"repo": "googleapis/python-spanner",
11+
"distribution_name": "google-cloud-spanner",
12+
"api_id": "spanner.googleapis.com",
13+
"requires_billing": true,
14+
"default_version": "v1",
15+
"codeowner_team": "@googleapis/spanner-client-libraries-python",
16+
"api_shortname": "spanner",
17+
"api_description": "is a fully managed, mission-critical, \nrelational database service that offers transactional consistency at global scale, \nschemas, SQL (ANSI 2011 with extensions), and automatic, synchronous replication \nfor high availability.\n\nBe sure to activate the Cloud Spanner API on the Developer's Console to\nuse Cloud Spanner from your project."
18+
}

owlbot.py renamed to .librarian/generator-input/librarian.py

Lines changed: 14 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -25,58 +25,9 @@
2525

2626
common = gcp.CommonTemplates()
2727

28-
29-
def get_staging_dirs(
30-
# This is a customized version of the s.get_staging_dirs() function
31-
# from synthtool to # cater for copying 3 different folders from
32-
# googleapis-gen:
33-
# spanner, spanner/admin/instance and spanner/admin/database.
34-
# Source:
35-
# https://github.com/googleapis/synthtool/blob/master/synthtool/transforms.py#L280
36-
default_version: Optional[str] = None,
37-
sub_directory: Optional[str] = None,
38-
) -> List[Path]:
39-
"""Returns the list of directories, one per version, copied from
40-
https://github.com/googleapis/googleapis-gen. Will return in lexical sorting
41-
order with the exception of the default_version which will be last (if specified).
42-
43-
Args:
44-
default_version (str): the default version of the API. The directory for this version
45-
will be the last item in the returned list if specified.
46-
sub_directory (str): if a `sub_directory` is provided, only the directories within the
47-
specified `sub_directory` will be returned.
48-
49-
Returns: the empty list if no file were copied.
50-
"""
51-
52-
staging = Path("owl-bot-staging")
53-
54-
if sub_directory:
55-
staging /= sub_directory
56-
57-
if staging.is_dir():
58-
# Collect the subdirectories of the staging directory.
59-
versions = [v.name for v in staging.iterdir() if v.is_dir()]
60-
# Reorder the versions so the default version always comes last.
61-
versions = [v for v in versions if v != default_version]
62-
versions.sort()
63-
if default_version is not None:
64-
versions += [default_version]
65-
dirs = [staging / v for v in versions]
66-
for dir in dirs:
67-
s._tracked_paths.add(dir)
68-
return dirs
69-
else:
70-
return []
71-
72-
73-
spanner_default_version = "v1"
74-
spanner_admin_instance_default_version = "v1"
75-
spanner_admin_database_default_version = "v1"
76-
7728
clean_up_generated_samples = True
7829

79-
for library in get_staging_dirs(spanner_default_version, "spanner"):
30+
for library in s.get_staging_dirs("v1"):
8031
if clean_up_generated_samples:
8132
shutil.rmtree("samples/generated_samples", ignore_errors=True)
8233
clean_up_generated_samples = False
@@ -202,22 +153,6 @@ def get_staging_dirs(
202153
if count < 1:
203154
raise Exception("Expected replacements for gRPC channel options not made.")
204155

205-
s.move(
206-
library,
207-
excludes=[
208-
"google/cloud/spanner/**",
209-
"*.*",
210-
"noxfile.py",
211-
"docs/index.rst",
212-
"google/cloud/spanner_v1/__init__.py",
213-
"**/gapic_version.py",
214-
"testing/constraints-3.7.txt",
215-
],
216-
)
217-
218-
for library in get_staging_dirs(
219-
spanner_admin_instance_default_version, "spanner_admin_instance"
220-
):
221156
count = s.replace(
222157
[
223158
library / "google/cloud/spanner_admin_instance_v1/services/*/transports/grpc*",
@@ -233,14 +168,7 @@ def get_staging_dirs(
233168
)
234169
if count < 1:
235170
raise Exception("Expected replacements for gRPC channel options not made.")
236-
s.move(
237-
library,
238-
excludes=["google/cloud/spanner_admin_instance/**", "*.*", "docs/index.rst", "noxfile.py", "**/gapic_version.py", "testing/constraints-3.7.txt",],
239-
)
240171

241-
for library in get_staging_dirs(
242-
spanner_admin_database_default_version, "spanner_admin_database"
243-
):
244172
count = s.replace(
245173
[
246174
library / "google/cloud/spanner_admin_database_v1/services/*/transports/grpc*",
@@ -258,7 +186,16 @@ def get_staging_dirs(
258186
raise Exception("Expected replacements for gRPC channel options not made.")
259187
s.move(
260188
library,
261-
excludes=["google/cloud/spanner_admin_database/**", "*.*", "docs/index.rst", "noxfile.py", "**/gapic_version.py", "testing/constraints-3.7.txt",],
189+
excludes=[
190+
"google/cloud/spanner/**",
191+
"*.*",
192+
"noxfile.py",
193+
"docs/index.rst",
194+
"google/cloud/spanner_v1/__init__.py",
195+
"testing/constraints-3.7.txt",
196+
"google/cloud/spanner_admin_instance/**",
197+
"google/cloud/spanner_admin_database/**"
198+
],
262199
)
263200

264201
s.remove_staging_dirs()
@@ -278,27 +215,12 @@ def get_staging_dirs(
278215
templated_files,
279216
excludes=[
280217
".coveragerc",
281-
".github/workflows", # exclude gh actions as credentials are needed for tests
218+
".github/**",
219+
".kokoro/**",
282220
"README.rst",
283-
".github/release-please.yml",
284-
".kokoro/test-samples-impl.sh",
285-
".kokoro/presubmit/presubmit.cfg",
286-
".kokoro/samples/python3.7/**",
287-
".kokoro/samples/python3.8/**",
288221
],
289222
)
290223

291-
# Ensure CI runs on a new instance each time
292-
s.replace(
293-
".kokoro/build.sh",
294-
"# Setup project id.",
295-
"""\
296-
# Set up creating a new instance for each system test run
297-
export GOOGLE_CLOUD_TESTS_CREATE_SPANNER_INSTANCE=true
298-
299-
# Setup project id.""",
300-
)
301-
302224
# Update samples folder in CONTRIBUTING.rst
303225
s.replace("CONTRIBUTING.rst", "samples/snippets", "samples/samples")
304226

@@ -321,4 +243,4 @@ def get_staging_dirs(
321243

322244
# Use a python runtime which is available in the owlbot post processor here
323245
# https://github.com/googleapis/synthtool/blob/master/docker/owlbot/python/Dockerfile
324-
s.shell.run(["nox", "-s", "blacken-3.10"], hide_output=False)
246+
s.shell.run(["nox", "-s", "blacken-3.14"], hide_output=False)

0 commit comments

Comments
 (0)