|
19 | 19 | from synthtool import gcp |
20 | 20 | from synthtool.languages import python |
21 | 21 |
|
22 | | -gapic = gcp.GAPICBazel() |
23 | 22 | common = gcp.CommonTemplates() |
24 | | -version = "v2" |
25 | 23 |
|
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() |
52 | 77 |
|
53 | 78 | # ---------------------------------------------------------------------------- |
54 | 79 | # Add templated files |
|
79 | 104 |
|
80 | 105 | python.py_samples() |
81 | 106 |
|
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 | | - |
103 | 107 | s.replace( |
104 | 108 | "docs/conf.py", |
105 | 109 | r'\{"members": True\}', |
106 | 110 | '{"members": True, "inherited-members": True}' |
107 | 111 | ) |
108 | 112 |
|
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 | | - |
117 | 113 | # Tell Sphinx to ingore autogenerated docs files. |
118 | 114 | s.replace( |
119 | 115 | "docs/conf.py", |
|
0 commit comments