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

Commit

Permalink
Browse files Browse the repository at this point in the history
docs: update intersphinx links (#78)
* changes without context

        autosynth cannot find the source of changes triggered by earlier changes in this
        repository, or by version upgrades to tools such as linters.

* docs(python): update intersphinx for grpc and auth

* docs(python): update intersphinx for grpc and auth

* use https for python intersphinx

Co-authored-by: Tim Swast <swast@google.com>

Source-Author: Bu Sun Kim <8822365+busunkim96@users.noreply.github.com>
Source-Date: Wed Nov 18 14:37:25 2020 -0700
Source-Repo: googleapis/synthtool
Source-Sha: 9a7d9fbb7045c34c9d3d22c1ff766eeae51f04c9
Source-Link: googleapis/synthtool@9a7d9fb

* docs(python): fix intersphinx link for google-auth

Source-Author: Bu Sun Kim <8822365+busunkim96@users.noreply.github.com>
Source-Date: Thu Nov 19 10:16:05 2020 -0700
Source-Repo: googleapis/synthtool
Source-Sha: a073c873f3928c561bdf87fdfbf1d081d1998984
Source-Link: googleapis/synthtool@a073c87

* chore: add config / docs for 'pre-commit' support

Source-Author: Tres Seaver <tseaver@palladion.com>
Source-Date: Tue Dec 1 16:01:20 2020 -0500
Source-Repo: googleapis/synthtool
Source-Sha: 32af6da519a6b042e3da62008e2a75e991efb6b4
Source-Link: googleapis/synthtool@32af6da

* chore(deps): update precommit hook pre-commit/pre-commit-hooks to v3.3.0

Source-Author: WhiteSource Renovate <bot@renovateapp.com>
Source-Date: Wed Dec 2 17:18:24 2020 +0100
Source-Repo: googleapis/synthtool
Source-Sha: 69629b64b83c6421d616be2b8e11795738ec8a6c
Source-Link: googleapis/synthtool@69629b6

* test(python): give filesystem paths to pytest-cov

https://pytest-cov.readthedocs.io/en/latest/config.html

The pytest-cov docs seem to suggest a filesystem path is expected.

Source-Author: Bu Sun Kim <8822365+busunkim96@users.noreply.github.com>
Source-Date: Wed Dec 2 09:28:04 2020 -0700
Source-Repo: googleapis/synthtool
Source-Sha: f94318521f63085b9ccb43d42af89f153fb39f15
Source-Link: googleapis/synthtool@f943185

* chore: update noxfile.py.j2

* Update noxfile.py.j2

add changes from @glasnt to the template template to ensure that enforcing type hinting doesn't fail for repos with the sample noxfile (aka all samples repos)
See https://github.com/GoogleCloudPlatform/python-docs-samples/pull/4869/files for context

* fix typo

Source-Author: Leah E. Cole <6719667+leahecole@users.noreply.github.com>
Source-Date: Thu Dec 3 13:44:30 2020 -0800
Source-Repo: googleapis/synthtool
Source-Sha: 18c5dbdb4ac8cf75d4d8174e7b4558f48e76f8a1
Source-Link: googleapis/synthtool@18c5dbd
  • Loading branch information
yoshi-automation committed Dec 9, 2020
1 parent 090a98f commit a78ba39
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 24 deletions.
17 changes: 17 additions & 0 deletions .pre-commit-config.yaml
@@ -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.3.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
10 changes: 10 additions & 0 deletions CONTRIBUTING.rst
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
6 changes: 3 additions & 3 deletions docs/conf.py
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
5 changes: 2 additions & 3 deletions noxfile.py
Expand Up @@ -81,9 +81,8 @@ def default(session):
session.run(
"py.test",
"--quiet",
"--cov=google.cloud.bigquerydatatransfer",
"--cov=google.cloud",
"--cov=tests.unit",
"--cov=google/cloud",
"--cov=tests/unit",
"--cov-append",
"--cov-config=.coveragerc",
"--cov-report=",
Expand Down
17 changes: 9 additions & 8 deletions samples/noxfile.py
Expand Up @@ -17,6 +17,7 @@
import os
from pathlib import Path
import sys
from typing import Callable, Dict, List, Optional

import nox

Expand Down Expand Up @@ -68,7 +69,7 @@
TEST_CONFIG.update(TEST_CONFIG_OVERRIDE)


def get_pytest_env_vars():
def get_pytest_env_vars() -> Dict[str, str]:
"""Returns a dict for pytest invocation."""
ret = {}

Expand Down Expand Up @@ -97,7 +98,7 @@ def get_pytest_env_vars():
#


def _determine_local_import_names(start_dir):
def _determine_local_import_names(start_dir: str) -> List[str]:
"""Determines all import names that should be considered "local".
This is used when running the linter to insure that import order is
Expand Down Expand Up @@ -135,7 +136,7 @@ def _determine_local_import_names(start_dir):


@nox.session
def lint(session):
def lint(session: nox.sessions.Session) -> None:
if not TEST_CONFIG['enforce_type_hints']:
session.install("flake8", "flake8-import-order")
else:
Expand All @@ -154,7 +155,7 @@ def lint(session):


@nox.session
def blacken(session):
def blacken(session: nox.sessions.Session) -> None:
session.install("black")
python_files = [path for path in os.listdir(".") if path.endswith(".py")]

Expand All @@ -168,7 +169,7 @@ def blacken(session):
PYTEST_COMMON_ARGS = ["--junitxml=sponge_log.xml"]


def _session_tests(session, post_install=None):
def _session_tests(session: nox.sessions.Session, post_install: Callable = None) -> None:
"""Runs py.test for a particular project."""
if os.path.exists("requirements.txt"):
session.install("-r", "requirements.txt")
Expand All @@ -194,7 +195,7 @@ def _session_tests(session, post_install=None):


@nox.session(python=ALL_VERSIONS)
def py(session):
def py(session: nox.sessions.Session) -> None:
"""Runs py.test for a sample using the specified version of Python."""
if session.python in TESTED_VERSIONS:
_session_tests(session)
Expand All @@ -209,7 +210,7 @@ def py(session):
#


def _get_repo_root():
def _get_repo_root() -> Optional[str]:
""" Returns the root folder of the project. """
# Get root of this repository. Assume we don't have directories nested deeper than 10 items.
p = Path(os.getcwd())
Expand All @@ -232,7 +233,7 @@ def _get_repo_root():

@nox.session
@nox.parametrize("path", GENERATED_READMES)
def readmegen(session, path):
def readmegen(session: nox.sessions.Session, path: str) -> None:
"""(Re-)generates the readme for a sample."""
session.install("jinja2", "pyyaml")
dir_ = os.path.dirname(path)
Expand Down
17 changes: 9 additions & 8 deletions samples/snippets/noxfile.py
Expand Up @@ -17,6 +17,7 @@
import os
from pathlib import Path
import sys
from typing import Callable, Dict, List, Optional

import nox

Expand Down Expand Up @@ -68,7 +69,7 @@
TEST_CONFIG.update(TEST_CONFIG_OVERRIDE)


def get_pytest_env_vars():
def get_pytest_env_vars() -> Dict[str, str]:
"""Returns a dict for pytest invocation."""
ret = {}

Expand Down Expand Up @@ -97,7 +98,7 @@ def get_pytest_env_vars():
#


def _determine_local_import_names(start_dir):
def _determine_local_import_names(start_dir: str) -> List[str]:
"""Determines all import names that should be considered "local".
This is used when running the linter to insure that import order is
Expand Down Expand Up @@ -135,7 +136,7 @@ def _determine_local_import_names(start_dir):


@nox.session
def lint(session):
def lint(session: nox.sessions.Session) -> None:
if not TEST_CONFIG['enforce_type_hints']:
session.install("flake8", "flake8-import-order")
else:
Expand All @@ -154,7 +155,7 @@ def lint(session):


@nox.session
def blacken(session):
def blacken(session: nox.sessions.Session) -> None:
session.install("black")
python_files = [path for path in os.listdir(".") if path.endswith(".py")]

Expand All @@ -168,7 +169,7 @@ def blacken(session):
PYTEST_COMMON_ARGS = ["--junitxml=sponge_log.xml"]


def _session_tests(session, post_install=None):
def _session_tests(session: nox.sessions.Session, post_install: Callable = None) -> None:
"""Runs py.test for a particular project."""
if os.path.exists("requirements.txt"):
session.install("-r", "requirements.txt")
Expand All @@ -194,7 +195,7 @@ def _session_tests(session, post_install=None):


@nox.session(python=ALL_VERSIONS)
def py(session):
def py(session: nox.sessions.Session) -> None:
"""Runs py.test for a sample using the specified version of Python."""
if session.python in TESTED_VERSIONS:
_session_tests(session)
Expand All @@ -209,7 +210,7 @@ def py(session):
#


def _get_repo_root():
def _get_repo_root() -> Optional[str]:
""" Returns the root folder of the project. """
# Get root of this repository. Assume we don't have directories nested deeper than 10 items.
p = Path(os.getcwd())
Expand All @@ -232,7 +233,7 @@ def _get_repo_root():

@nox.session
@nox.parametrize("path", GENERATED_READMES)
def readmegen(session, path):
def readmegen(session: nox.sessions.Session, path: str) -> None:
"""(Re-)generates the readme for a sample."""
session.install("jinja2", "pyyaml")
dir_ = os.path.dirname(path)
Expand Down
5 changes: 3 additions & 2 deletions synth.metadata
Expand Up @@ -19,14 +19,14 @@
"git": {
"name": "synthtool",
"remote": "https://github.com/googleapis/synthtool.git",
"sha": "e89175cf074dccc4babb4eca66ae913696e47a71"
"sha": "18c5dbdb4ac8cf75d4d8174e7b4558f48e76f8a1"
}
},
{
"git": {
"name": "synthtool",
"remote": "https://github.com/googleapis/synthtool.git",
"sha": "e89175cf074dccc4babb4eca66ae913696e47a71"
"sha": "18c5dbdb4ac8cf75d4d8174e7b4558f48e76f8a1"
}
}
],
Expand Down Expand Up @@ -85,6 +85,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

0 comments on commit a78ba39

Please sign in to comment.