|
| 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 | +"""This script is used to synthesize generated parts of this library.""" |
| 16 | + |
| 17 | +import pathlib |
| 18 | + |
| 19 | +from synthtool import gcp |
| 20 | +import synthtool as s |
| 21 | +from synthtool.languages import python |
| 22 | + |
| 23 | +REPO_ROOT = pathlib.Path(__file__).parent.absolute() |
| 24 | + |
| 25 | +common = gcp.CommonTemplates() |
| 26 | + |
| 27 | +# ---------------------------------------------------------------------------- |
| 28 | +# Add templated files |
| 29 | +# ---------------------------------------------------------------------------- |
| 30 | + |
| 31 | +templated_files = common.py_library( |
| 32 | + unit_test_python_versions=["3.9", "3.10", "3.11"], |
| 33 | + system_test_python_versions=["3.9", "3.11"], |
| 34 | + cov_level=40, |
| 35 | + intersphinx_dependencies={ |
| 36 | + "pandas": "https://pandas.pydata.org/pandas-docs/stable/", |
| 37 | + "pydata-google-auth": "https://pydata-google-auth.readthedocs.io/en/latest/", |
| 38 | + }, |
| 39 | +) |
| 40 | +s.move( |
| 41 | + templated_files, |
| 42 | + excludes=[ |
| 43 | + # Multi-processing note isn't relevant, as pandas_gbq is responsible for |
| 44 | + # creating clients, not the end user. |
| 45 | + "docs/multiprocessing.rst", |
| 46 | + "noxfile.py", |
| 47 | + "README.rst", |
| 48 | + ], |
| 49 | +) |
| 50 | + |
| 51 | +# ---------------------------------------------------------------------------- |
| 52 | +# Fixup files |
| 53 | +# ---------------------------------------------------------------------------- |
| 54 | + |
| 55 | + |
| 56 | +# ---------------------------------------------------------------------------- |
| 57 | +# Samples templates |
| 58 | +# ---------------------------------------------------------------------------- |
| 59 | + |
| 60 | +python.py_samples(skip_readmes=True) |
| 61 | + |
| 62 | +# ---------------------------------------------------------------------------- |
| 63 | +# Final cleanup |
| 64 | +# ---------------------------------------------------------------------------- |
| 65 | + |
| 66 | +s.shell.run(["nox", "-s", "blacken"], hide_output=False) |
| 67 | +for noxfile in REPO_ROOT.glob("samples/**/noxfile.py"): |
| 68 | + s.shell.run(["nox", "-s", "blacken"], cwd=noxfile.parent, hide_output=False) |
0 commit comments