Skip to content
This repository has been archived by the owner on Dec 31, 2023. It is now read-only.

Commit

Permalink
chore: update templates
Browse files Browse the repository at this point in the history
  • Loading branch information
busunkim96 committed Jun 4, 2020
1 parent f3c4bb7 commit fa794ff
Show file tree
Hide file tree
Showing 9 changed files with 49 additions and 31 deletions.
2 changes: 2 additions & 0 deletions .flake8
Expand Up @@ -21,6 +21,8 @@ exclude =
# Exclude generated code.
**/proto/**
**/gapic/**
**/services/**
**/types/**
*_pb2.py

# Standard linting exemptions.
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Expand Up @@ -10,6 +10,7 @@
dist
build
eggs
.eggs
parts
bin
var
Expand Down Expand Up @@ -49,6 +50,7 @@ bigquery/docs/generated
# Virtual environment
env/
coverage.xml
sponge_log.xml

# System test environment variables.
system_tests/local_test_setup
Expand Down
2 changes: 0 additions & 2 deletions .kokoro/publish-docs.sh
Expand Up @@ -13,8 +13,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

#!/bin/bash

set -eo pipefail

# Disable buffering, so that the logs stream through.
Expand Down
2 changes: 0 additions & 2 deletions .kokoro/release.sh
Expand Up @@ -13,8 +13,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

#!/bin/bash

set -eo pipefail

# Start the releasetool reporter
Expand Down
3 changes: 3 additions & 0 deletions MANIFEST.in
Expand Up @@ -20,3 +20,6 @@ recursive-include google *.json *.proto
recursive-include tests *
global-exclude *.py[co]
global-exclude __pycache__

# Exclude scripts for samples readmegen
prune scripts/readme-gen
17 changes: 9 additions & 8 deletions noxfile.py
Expand Up @@ -26,11 +26,12 @@
BLACK_VERSION = "black==19.3b0"
BLACK_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"]

if os.path.exists("samples"):
BLACK_PATHS.append("samples")
DEFAULT_PYTHON_VERSION = "3.7"
SYSTEM_TEST_PYTHON_VERSIONS = ["2.7", "3.7"]
UNIT_TEST_PYTHON_VERSIONS = ["2.7", "3.5", "3.6", "3.7", "3.8"]


@nox.session(python="3.7")
@nox.session(python=DEFAULT_PYTHON_VERSION)
def lint(session):
"""Run linters.
Expand All @@ -56,7 +57,7 @@ def blacken(session):
session.run("black", *BLACK_PATHS)


@nox.session(python="3.7")
@nox.session(python=DEFAULT_PYTHON_VERSION)
def lint_setup_py(session):
"""Verify that setup.py is valid (including RST check)."""
session.install("docutils", "pygments")
Expand Down Expand Up @@ -84,13 +85,13 @@ def default(session):
)


@nox.session(python=["2.7", "3.5", "3.6", "3.7", "3.8"])
@nox.session(python=UNIT_TEST_PYTHON_VERSIONS)
def unit(session):
"""Run the unit test suite."""
default(session)


@nox.session(python=["2.7", "3.7"])
@nox.session(python=SYSTEM_TEST_PYTHON_VERSIONS)
def system(session):
"""Run the system test suite."""
system_test_path = os.path.join("tests", "system.py")
Expand Down Expand Up @@ -120,7 +121,7 @@ def system(session):
session.run("py.test", "--quiet", system_test_folder_path, *session.posargs)


@nox.session(python="3.7")
@nox.session(python=DEFAULT_PYTHON_VERSION)
def cover(session):
"""Run the final coverage report.
Expand All @@ -133,7 +134,7 @@ def cover(session):
session.run("coverage", "erase")


@nox.session(python="3.7")
@nox.session(python=DEFAULT_PYTHON_VERSION)
def docs(session):
"""Build the docs for this library."""

Expand Down
20 changes: 18 additions & 2 deletions samples/snippets/README.rst
@@ -1,3 +1,4 @@

.. This file is automatically generated. Do not edit this file directly.
Google Cloud KMS API Python Samples
Expand All @@ -14,10 +15,12 @@ This directory contains samples for Google Cloud KMS API. The `Google Cloud KMS

.. _Google Cloud KMS API: https://cloud.google.com/kms/docs/


Setup
-------------------------------------------------------------------------------



Authentication
++++++++++++++

Expand All @@ -28,6 +31,9 @@ credentials for applications.
.. _Authentication Getting Started Guide:
https://cloud.google.com/docs/authentication/getting-started




Install Dependencies
++++++++++++++++++++

Expand All @@ -42,7 +48,7 @@ Install Dependencies
.. _Python Development Environment Setup Guide:
https://cloud.google.com/python/setup

#. Create a virtualenv. Samples are compatible with Python 2.7 and 3.4+.
#. Create a virtualenv. Samples are compatible with Python 3.6+.

.. code-block:: bash
Expand All @@ -58,9 +64,15 @@ Install Dependencies
.. _pip: https://pip.pypa.io/
.. _virtualenv: https://virtualenv.pypa.io/






Samples
-------------------------------------------------------------------------------


Quickstart
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Expand All @@ -79,4 +91,8 @@ To run this sample:
.. _Google Cloud SDK: https://cloud.google.com/sdk/
.. _Google Cloud SDK: https://cloud.google.com/sdk/
23 changes: 7 additions & 16 deletions synth.metadata
@@ -1,26 +1,18 @@
{
"updateTime": "2020-04-14T21:47:51.484475Z",
"sources": [
{
"generator": {
"name": "artman",
"version": "2.0.0",
"dockerImage": "googleapis/artman@sha256:b3b47805231a305d0f40c4bf069df20f6a2635574e6d4259fac651d3f9f6e098"
"git": {
"name": ".",
"remote": "git@github.com:googleapis/python-kms.git",
"sha": "309319a29b3e0f851d93c58de06b60f50cf0fbfb"
}
},
{
"git": {
"name": "googleapis",
"remote": "https://github.com/googleapis/googleapis.git",
"sha": "fea22b1d9f27f86ef355c1d0dba00e0791a08a19",
"internalRef": "306508794"
}
},
{
"git": {
"name": "synthtool",
"remote": "https://github.com/googleapis/synthtool.git",
"sha": "52638600f387deb98efb5f9c85fec39e82aa9052"
"sha": "eafa840ceec23b44a5c21670288107c661252711",
"internalRef": "313488995"
}
}
],
Expand All @@ -31,8 +23,7 @@
"apiName": "kms",
"apiVersion": "v1",
"language": "python",
"generator": "gapic",
"config": "google/cloud/kms/artman_cloudkms.yaml"
"generator": "bazel"
}
}
]
Expand Down
9 changes: 8 additions & 1 deletion synth.py
Expand Up @@ -16,6 +16,7 @@

import synthtool as s
import synthtool.gcp as gcp
from synthtool.languages import python
import logging

logging.basicConfig(level=logging.DEBUG)
Expand Down Expand Up @@ -71,7 +72,13 @@ def crypto_key_path_path(cls, project, location, key_ring, crypto_key_path):
# ----------------------------------------------------------------------------
# Add templated files
# ----------------------------------------------------------------------------
templated_files = common.py_library(cov_level=70)
templated_files = common.py_library(cov_level=70, samples=True)
s.move(templated_files)

# ----------------------------------------------------------------------------
# Samples templates
# ----------------------------------------------------------------------------

python.py_samples()

s.shell.run(["nox", "-s", "blacken"], hide_output=False)

0 comments on commit fa794ff

Please sign in to comment.