Skip to content

Commit

Permalink
Merge branch 'googleapis:main' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
georgiyekkert authored Oct 6, 2021
2 parents ec2f9a7 + 7a9e832 commit 87dffa6
Show file tree
Hide file tree
Showing 13 changed files with 362 additions and 51 deletions.
2 changes: 1 addition & 1 deletion .kokoro/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ python3 -m pip install --upgrade --quiet nox
python3 -m nox --version

# If this is a continuous build, send the test log to the FlakyBot.
# See https://github.com/googleapis/repo-automation-bots/tree/master/packages/flakybot.
# See https://github.com/googleapis/repo-automation-bots/tree/main/packages/flakybot.
if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"continuous"* ]]; then
cleanup() {
chmod +x $KOKORO_GFILE_DIR/linux_amd64/flakybot
Expand Down
2 changes: 1 addition & 1 deletion .kokoro/test-samples-impl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ for file in samples/**/requirements.txt; do
EXIT=$?

# If this is a periodic build, send the test log to the FlakyBot.
# See https://github.com/googleapis/repo-automation-bots/tree/master/packages/flakybot.
# See https://github.com/googleapis/repo-automation-bots/tree/main/packages/flakybot.
if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"periodic"* ]]; then
chmod +x $KOKORO_GFILE_DIR/linux_amd64/flakybot
$KOKORO_GFILE_DIR/linux_amd64/flakybot
Expand Down
24 changes: 13 additions & 11 deletions .repo-metadata.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
{
"name": "compute",
"name_pretty": "Compute Engine",
"product_documentation": "https://cloud.google.com/compute/",
"client_documentation": "https://googleapis.dev/python/compute/latest",
"issue_tracker": "https://issuetracker.google.com/issues/new?component=187134&template=0",
"release_level": "alpha",
"language": "python",
"library_type": "GAPIC_AUTO",
"repo": "googleapis/python-compute",
"distribution_name": "google-cloud-compute",
"api_id": "compute.googleapis.com"
"name": "compute",
"name_pretty": "Compute Engine",
"product_documentation": "https://cloud.google.com/compute/",
"client_documentation": "https://googleapis.dev/python/compute/latest",
"issue_tracker": "https://issuetracker.google.com/issues/new?component=187134&template=0",
"release_level": "alpha",
"language": "python",
"library_type": "GAPIC_AUTO",
"repo": "googleapis/python-compute",
"distribution_name": "google-cloud-compute",
"api_id": "compute.googleapis.com",
"codeowner_team": "@googleapis/actools",
"default_version": "v1"
}
16 changes: 8 additions & 8 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ You'll have to create a development environment using a Git checkout:
# Configure remotes such that you can pull changes from the googleapis/python-compute
# repository into your local repository.
$ git remote add upstream git@github.com:googleapis/python-compute.git
# fetch and merge changes from upstream into master
# fetch and merge changes from upstream into main
$ git fetch upstream
$ git merge upstream/master
$ git merge upstream/main

Now your local repo is set up such that you will push changes to your GitHub
repo, from which you can submit a pull request.
Expand Down Expand Up @@ -110,12 +110,12 @@ Coding Style
variables::

export GOOGLE_CLOUD_TESTING_REMOTE="upstream"
export GOOGLE_CLOUD_TESTING_BRANCH="master"
export GOOGLE_CLOUD_TESTING_BRANCH="main"

By doing this, you are specifying the location of the most up-to-date
version of ``python-compute``. The the suggested remote name ``upstream``
should point to the official ``googleapis`` checkout and the
the branch should be the main branch on that remote (``master``).
version of ``python-compute``. The
remote name ``upstream`` should point to the official ``googleapis``
checkout and the branch should be the default branch on that remote (``main``).

- This repository contains configuration for the
`pre-commit <https://pre-commit.com/>`__ tool, which automates checking
Expand Down Expand Up @@ -209,7 +209,7 @@ The `description on PyPI`_ for the project comes directly from the
``README``. Due to the reStructuredText (``rst``) parser used by
PyPI, relative links which will work on GitHub (e.g. ``CONTRIBUTING.rst``
instead of
``https://github.com/googleapis/python-compute/blob/master/CONTRIBUTING.rst``)
``https://github.com/googleapis/python-compute/blob/main/CONTRIBUTING.rst``)
may cause problems creating links or rendering the description.

.. _description on PyPI: https://pypi.org/project/google-cloud-compute
Expand All @@ -234,7 +234,7 @@ We support:

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

.. _config: https://github.com/googleapis/python-compute/blob/master/noxfile.py
.. _config: https://github.com/googleapis/python-compute/blob/main/noxfile.py


We also explicitly decided to support Python 3 beginning with version 3.6.
Expand Down
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Python Client for Compute Engine
- `Product Documentation`_

.. |alpha| image:: https://img.shields.io/badge/support-alpha-orange.svg
:target: https://github.com/googleapis/google-cloud-python/blob/master/README.rst#alpha-support
:target: https://github.com/googleapis/google-cloud-python/blob/main/README.rst#alpha-support
.. |pypi| image:: https://img.shields.io/pypi/v/google-cloud-compute.svg
:target: https://pypi.org/project/google-cloud-compute/
.. |versions| image:: https://img.shields.io/pypi/pyversions/google-cloud-compute.svg
Expand Down Expand Up @@ -79,4 +79,4 @@ Next Steps
APIs that we cover.

.. _Compute Engine API Product documentation: https://cloud.google.com/compute/
.. _README: https://github.com/googleapis/google-cloud-python/blob/master/README.rst
.. _README: https://github.com/googleapis/google-cloud-python/blob/main/README.rst
10 changes: 5 additions & 5 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@
# The encoding of source files.
# source_encoding = 'utf-8-sig'

# The master toctree document.
master_doc = "index"
# The root toctree document.
root_doc = "index"

# General information about the project.
project = "google-cloud-compute"
Expand Down Expand Up @@ -280,7 +280,7 @@
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(
master_doc,
root_doc,
"google-cloud-compute.tex",
"google-cloud-compute Documentation",
author,
Expand Down Expand Up @@ -315,7 +315,7 @@
# (source start file, name, description, authors, manual section).
man_pages = [
(
master_doc,
root_doc,
"google-cloud-compute",
"google-cloud-compute Documentation",
[author],
Expand All @@ -334,7 +334,7 @@
# dir menu entry, description, category)
texinfo_documents = [
(
master_doc,
root_doc,
"google-cloud-compute",
"google-cloud-compute Documentation",
author,
Expand Down
5 changes: 4 additions & 1 deletion renovate.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
{
"extends": [
"config:base", ":preserveSemverRanges"
"config:base",
"group:all",
":preserveSemverRanges",
":disableDependencyDashboard"
],
"ignorePaths": [".pre-commit-config.yaml"],
"pip_requirements": {
Expand Down
44 changes: 25 additions & 19 deletions samples/snippets/noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,31 +39,29 @@

TEST_CONFIG = {
# You can opt out from the test for specific Python versions.
'ignored_versions': [],

"ignored_versions": [],
# Old samples are opted out of enforcing Python type hints
# All new samples should feature them
'enforce_type_hints': False,

"enforce_type_hints": False,
# An envvar key for determining the project id to use. Change it
# to 'BUILD_SPECIFIC_GCLOUD_PROJECT' if you want to opt in using a
# build specific Cloud project. You can also use your own string
# to use your own Cloud project.
'gcloud_project_env': 'GOOGLE_CLOUD_PROJECT',
"gcloud_project_env": "GOOGLE_CLOUD_PROJECT",
# 'gcloud_project_env': 'BUILD_SPECIFIC_GCLOUD_PROJECT',
# If you need to use a specific version of pip,
# change pip_version_override to the string representation
# of the version number, for example, "20.2.4"
"pip_version_override": None,
# A dictionary you want to inject into your test. Don't put any
# secrets here. These values will override predefined values.
'envs': {},
"envs": {},
}


try:
# Ensure we can import noxfile_config in the project's directory.
sys.path.append('.')
sys.path.append(".")
from noxfile_config import TEST_CONFIG_OVERRIDE
except ImportError as e:
print("No user noxfile_config found: detail: {}".format(e))
Expand All @@ -78,12 +76,12 @@ def get_pytest_env_vars() -> Dict[str, str]:
ret = {}

# Override the GCLOUD_PROJECT and the alias.
env_key = TEST_CONFIG['gcloud_project_env']
env_key = TEST_CONFIG["gcloud_project_env"]
# This should error out if not set.
ret['GOOGLE_CLOUD_PROJECT'] = os.environ[env_key]
ret["GOOGLE_CLOUD_PROJECT"] = os.environ[env_key]

# Apply user supplied envs.
ret.update(TEST_CONFIG['envs'])
ret.update(TEST_CONFIG["envs"])
return ret


Expand All @@ -92,11 +90,14 @@ def get_pytest_env_vars() -> Dict[str, str]:
ALL_VERSIONS = ["3.6", "3.7", "3.8", "3.9"]

# Any default versions that should be ignored.
IGNORED_VERSIONS = TEST_CONFIG['ignored_versions']
IGNORED_VERSIONS = TEST_CONFIG["ignored_versions"]

TESTED_VERSIONS = sorted([v for v in ALL_VERSIONS if v not in IGNORED_VERSIONS])

INSTALL_LIBRARY_FROM_SOURCE = os.environ.get("INSTALL_LIBRARY_FROM_SOURCE", False) in ("True", "true")
INSTALL_LIBRARY_FROM_SOURCE = os.environ.get("INSTALL_LIBRARY_FROM_SOURCE", False) in (
"True",
"true",
)
#
# Style Checks
#
Expand Down Expand Up @@ -141,7 +142,7 @@ def _determine_local_import_names(start_dir: str) -> List[str]:

@nox.session
def lint(session: nox.sessions.Session) -> None:
if not TEST_CONFIG['enforce_type_hints']:
if not TEST_CONFIG["enforce_type_hints"]:
session.install("flake8", "flake8-import-order")
else:
session.install("flake8", "flake8-import-order", "flake8-annotations")
Expand All @@ -150,9 +151,11 @@ def lint(session: nox.sessions.Session) -> None:
args = FLAKE8_COMMON_ARGS + [
"--application-import-names",
",".join(local_names),
"."
".",
]
session.run("flake8", *args)


#
# Black
#
Expand All @@ -165,6 +168,7 @@ def blacken(session: nox.sessions.Session) -> None:

session.run("black", *python_files)


#
# Sample Tests
#
Expand All @@ -173,7 +177,9 @@ def blacken(session: nox.sessions.Session) -> None:
PYTEST_COMMON_ARGS = ["--junitxml=sponge_log.xml"]


def _session_tests(session: nox.sessions.Session, post_install: Callable = None) -> None:
def _session_tests(
session: nox.sessions.Session, post_install: Callable = None
) -> None:
if TEST_CONFIG["pip_version_override"]:
pip_version = TEST_CONFIG["pip_version_override"]
session.install(f"pip=={pip_version}")
Expand Down Expand Up @@ -203,7 +209,7 @@ def _session_tests(session: nox.sessions.Session, post_install: Callable = None)
# on travis where slow and flaky tests are excluded.
# See http://doc.pytest.org/en/latest/_modules/_pytest/main.html
success_codes=[0, 5],
env=get_pytest_env_vars()
env=get_pytest_env_vars(),
)


Expand All @@ -213,9 +219,9 @@ def py(session: nox.sessions.Session) -> None:
if session.python in TESTED_VERSIONS:
_session_tests(session)
else:
session.skip("SKIPPED: {} tests are disabled for this sample.".format(
session.python
))
session.skip(
"SKIPPED: {} tests are disabled for this sample.".format(session.python)
)


#
Expand Down
4 changes: 2 additions & 2 deletions samples/snippets/requirements-test.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
pytest==6.2.4
google-cloud-storage==1.42.0
pytest==6.2.5
google-cloud-storage==1.42.3
Loading

0 comments on commit 87dffa6

Please sign in to comment.