diff --git a/synthtool/gcp/common.py b/synthtool/gcp/common.py index 6ad782253..0c5fec724 100644 --- a/synthtool/gcp/common.py +++ b/synthtool/gcp/common.py @@ -25,8 +25,11 @@ class CommonTemplates: def __init__(self): self._templates = templates.Templates(_TEMPLATES_DIR) - def py_library(self) -> Path: - raise NotImplementedError() + def py_library(self, **kwargs) -> Path: + t = templates.TemplateGroup(_TEMPLATES_DIR / "python_library") + result = t.render(**kwargs) + _tracked_paths.add(result) + return result def node_library(self, **kwargs) -> Path: kwargs["metadata"] = node.read_metadata() diff --git a/synthtool/gcp/templates/python_library/.flake8 b/synthtool/gcp/templates/python_library/.flake8 new file mode 100644 index 000000000..1f44a90f8 --- /dev/null +++ b/synthtool/gcp/templates/python_library/.flake8 @@ -0,0 +1,12 @@ +[flake8] +exclude = + # Exclude generated code. + **/proto/** + **/gapic/** + *_pb2.py + + # Standard linting exemptions. + __pycache__, + .git, + *.pyc, + conf.py diff --git a/synthtool/gcp/templates/python_library/MANIFEST.in b/synthtool/gcp/templates/python_library/MANIFEST.in new file mode 100644 index 000000000..9cbf175af --- /dev/null +++ b/synthtool/gcp/templates/python_library/MANIFEST.in @@ -0,0 +1,5 @@ +include README.rst LICENSE +recursive-include google *.json *.proto +recursive-include tests * +global-exclude *.py[co] +global-exclude __pycache__ diff --git a/synthtool/gcp/templates/python_library/setup.cfg b/synthtool/gcp/templates/python_library/setup.cfg new file mode 100644 index 000000000..2a9acf13d --- /dev/null +++ b/synthtool/gcp/templates/python_library/setup.cfg @@ -0,0 +1,2 @@ +[bdist_wheel] +universal = 1