Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add initial python templates #131

Merged
merged 4 commits into from
Nov 20, 2018
Merged
Show file tree
Hide file tree
Changes from 2 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
7 changes: 5 additions & 2 deletions synthtool/gcp/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
12 changes: 12 additions & 0 deletions synthtool/gcp/templates/python_library/.flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[flake8]
exclude =
# Exclude generated code.
**/proto/**
**/gapic/**
*_pb2.py

# Standard linting exemptions.
__pycache__,
.git,
*.pyc,
conf.py
5 changes: 5 additions & 0 deletions synthtool/gcp/templates/python_library/MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
include README.rst LICENSE
recursive-include google *.json *.proto
recursive-include tests *
global-exclude *.py[co]
global-exclude __pycache__
2 changes: 2 additions & 0 deletions synthtool/gcp/templates/python_library/setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[bdist_wheel]
universal = 1