Skip to content

Commit

Permalink
chore: exclude .nox/ from linting; update python versions in CONTRI…
Browse files Browse the repository at this point in the history
…BUTING; add pre-commit; update intersphinx links (#32)

This PR was generated using Autosynth. 🌈

Synth log will be available here:
https://source.cloud.google.com/results/invocations/0ea0e0e1-c693-4704-a662-fcd1812ef49e/targets

- [ ] To automatically regenerate this PR, check this box.

Source-Link: googleapis/synthtool@3738610
Source-Link: googleapis/synthtool@b670a77
Source-Link: googleapis/synthtool@aa255b1
Source-Link: googleapis/synthtool@f943185
Source-Link: googleapis/synthtool@69629b6
Source-Link: googleapis/synthtool@32af6da
Source-Link: googleapis/synthtool@a073c87
Source-Link: googleapis/synthtool@9a7d9fb
  • Loading branch information
yoshi-automation authored Dec 23, 2020
1 parent 73885e4 commit c02b1e2
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 20 deletions.
1 change: 1 addition & 0 deletions packages/google-cloud-os-config/.flake8
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ exclude =
*_pb2.py

# Standard linting exemptions.
**/.nox/**
__pycache__,
.git,
*.pyc,
Expand Down
17 changes: 17 additions & 0 deletions packages/google-cloud-os-config/.pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.4.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- repo: https://github.com/psf/black
rev: 19.10b0
hooks:
- id: black
- repo: https://gitlab.com/pycqa/flake8
rev: 3.8.4
hooks:
- id: flake8
21 changes: 15 additions & 6 deletions packages/google-cloud-os-config/CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ In order to add a feature:
- The feature must be documented in both the API and narrative
documentation.

- The feature must work fully on the following CPython versions: 2.7,
3.5, 3.6, 3.7 and 3.8 on both UNIX and Windows.
- The feature must work fully on the following CPython versions:
3.6, 3.7, 3.8 and 3.9 on both UNIX and Windows.

- The feature must not add unnecessary dependencies (where
"unnecessary" is of course subjective, but new dependencies should
Expand Down Expand Up @@ -111,6 +111,16 @@ Coding Style
should point to the official ``googleapis`` checkout and the
the branch should be the main branch on that remote (``master``).

- This repository contains configuration for the
`pre-commit <https://pre-commit.com/>`__ tool, which automates checking
our linters during a commit. If you have it installed on your ``$PATH``,
you can enable enforcing those checks via:

.. code-block:: bash
$ pre-commit install
pre-commit installed at .git/hooks/pre-commit
Exceptions to PEP8:

- Many unit tests use a helper method, ``_call_fut`` ("FUT" is short for
Expand Down Expand Up @@ -192,25 +202,24 @@ Supported Python Versions

We support:

- `Python 3.5`_
- `Python 3.6`_
- `Python 3.7`_
- `Python 3.8`_
- `Python 3.9`_

.. _Python 3.5: https://docs.python.org/3.5/
.. _Python 3.6: https://docs.python.org/3.6/
.. _Python 3.7: https://docs.python.org/3.7/
.. _Python 3.8: https://docs.python.org/3.8/
.. _Python 3.9: https://docs.python.org/3.9/


Supported versions can be found in our ``noxfile.py`` `config`_.

.. _config: https://github.com/googleapis/python-os-config/blob/master/noxfile.py

Python 2.7 support is deprecated. All code changes should maintain Python 2.7 compatibility until January 1, 2020.

We also explicitly decided to support Python 3 beginning with version
3.5. Reasons for this include:
3.6. Reasons for this include:

- Encouraging use of newest versions of Python 3
- Taking the lead of `prominent`_ open-source `projects`_
Expand Down
6 changes: 3 additions & 3 deletions packages/google-cloud-os-config/docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,10 +345,10 @@

# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {
"python": ("http://python.readthedocs.org/en/latest/", None),
"google-auth": ("https://google-auth.readthedocs.io/en/stable", None),
"python": ("https://python.readthedocs.org/en/latest/", None),
"google-auth": ("https://googleapis.dev/python/google-auth/latest/", None),
"google.api_core": ("https://googleapis.dev/python/google-api-core/latest/", None,),
"grpc": ("https://grpc.io/grpc/python/", None),
"grpc": ("https://grpc.github.io/grpc/python/", None),
"proto-plus": ("https://proto-plus-python.readthedocs.io/en/latest/", None),
}

Expand Down
7 changes: 3 additions & 4 deletions packages/google-cloud-os-config/noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,8 @@ def default(session):
session.run(
"py.test",
"--quiet",
"--cov=google.cloud.osconfig",
"--cov=google.cloud",
"--cov=tests.unit",
"--cov=google/cloud",
"--cov=tests/unit",
"--cov-append",
"--cov-config=.coveragerc",
"--cov-report=",
Expand Down Expand Up @@ -143,7 +142,7 @@ def cover(session):
test runs (not system test runs), and then erases coverage data.
"""
session.install("coverage", "pytest-cov")
session.run("coverage", "report", "--show-missing", "--fail-under=100")
session.run("coverage", "report", "--show-missing", "--fail-under=99")

session.run("coverage", "erase")

Expand Down
5 changes: 3 additions & 2 deletions packages/google-cloud-os-config/synth.metadata
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@
"git": {
"name": "synthtool",
"remote": "https://github.com/googleapis/synthtool.git",
"sha": "7fcc405a579d5d53a726ff3da1b7c8c08f0f2d58"
"sha": "373861061648b5fe5e0ac4f8a38b32d639ee93e4"
}
},
{
"git": {
"name": "synthtool",
"remote": "https://github.com/googleapis/synthtool.git",
"sha": "7fcc405a579d5d53a726ff3da1b7c8c08f0f2d58"
"sha": "373861061648b5fe5e0ac4f8a38b32d639ee93e4"
}
}
],
Expand Down Expand Up @@ -86,6 +86,7 @@
".kokoro/test-samples.sh",
".kokoro/trampoline.sh",
".kokoro/trampoline_v2.sh",
".pre-commit-config.yaml",
".trampolinerc",
"CODE_OF_CONDUCT.md",
"CONTRIBUTING.rst",
Expand Down
16 changes: 11 additions & 5 deletions packages/google-cloud-os-config/synth.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,22 @@
import synthtool.gcp as gcp
from synthtool.languages import python

gapic = gcp.GAPICMicrogenerator()
gapic = gcp.GAPICBazel()
common = gcp.CommonTemplates()

# ----------------------------------------------------------------------------
# Generate OS Config GAPIC layer
# ----------------------------------------------------------------------------
library = gapic.py_library(
"osconfig", "v1"
)
versions = ["v1"]

for version in versions:
library = gapic.py_library(
service="osconfig",
version=version,
bazel_target=f"//google/cloud/osconfig/{version}/:osconfig-{version}-py"
)

s.move(library, excludes=["nox.py", "setup.py", "README.rst", "docs/index.rst"])
s.move(library, excludes=["nox.py", "setup.py", "README.rst", "docs/index.rst"])

# rename to google-cloud-os-config
s.replace(["google/**/*.py", "tests/**/*.py"], "google-cloud-osconfig", "google-cloud-os-config")
Expand All @@ -46,6 +51,7 @@
templated_files = common.py_library(
samples=False,
microgenerator=True,
cov_level=99,
)
s.move(
templated_files, excludes=[".coveragerc"]
Expand Down

0 comments on commit c02b1e2

Please sign in to comment.