Skip to content
This repository was archived by the owner on Oct 31, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions .github/release-please.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
releaseType: python
handleGHRelease: true
manifest: true
# NOTE: this section is generated by synthtool.languages.python
# See https://github.com/googleapis/synthtool/blob/master/synthtool/languages/python.py
branches:
Expand Down
16 changes: 8 additions & 8 deletions .kokoro/noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@

import nox


# WARNING - WARNING - WARNING - WARNING - WARNING
# WARNING - WARNING - WARNING - WARNING - WARNING
# DO NOT EDIT THIS FILE EVER!
Expand Down Expand Up @@ -160,6 +159,7 @@ def blacken(session: nox.sessions.Session) -> None:
# format = isort + black
#


@nox.session
def format(session: nox.sessions.Session) -> None:
"""
Expand Down Expand Up @@ -187,7 +187,9 @@ def _session_tests(
session: nox.sessions.Session, post_install: Callable = None
) -> None:
# check for presence of tests
test_list = glob.glob("**/*_test.py", recursive=True) + glob.glob("**/test_*.py", recursive=True)
test_list = glob.glob("**/*_test.py", recursive=True) + glob.glob(
"**/test_*.py", recursive=True
)
test_list.extend(glob.glob("**/tests", recursive=True))

if len(test_list) == 0:
Expand All @@ -209,9 +211,7 @@ def _session_tests(

if os.path.exists("requirements-test.txt"):
if os.path.exists("constraints-test.txt"):
session.install(
"-r", "requirements-test.txt", "-c", "constraints-test.txt"
)
session.install("-r", "requirements-test.txt", "-c", "constraints-test.txt")
else:
session.install("-r", "requirements-test.txt")
with open("requirements-test.txt") as rtfile:
Expand All @@ -224,9 +224,9 @@ def _session_tests(
post_install(session)

if "pytest-parallel" in packages:
concurrent_args.extend(['--workers', 'auto', '--tests-per-worker', 'auto'])
concurrent_args.extend(["--workers", "auto", "--tests-per-worker", "auto"])
elif "pytest-xdist" in packages:
concurrent_args.extend(['-n', 'auto'])
concurrent_args.extend(["-n", "auto"])

session.run(
"pytest",
Expand Down Expand Up @@ -256,7 +256,7 @@ def py(session: nox.sessions.Session) -> None:


def _get_repo_root() -> Optional[str]:
""" Returns the root folder of the project. """
"""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())
for i in range(10):
Expand Down
3 changes: 3 additions & 0 deletions .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
".": "1.0.6"
}
1 change: 0 additions & 1 deletion docs/common/types.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,4 @@ Types for Google Cloud Common API

.. automodule:: google.cloud.common.types
:members:
:undoc-members:
:show-inheritance:
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
# All configuration values have a default; values that are commented out
# serve to show the default.

import sys
import os
import shlex
import sys

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
Expand Down
3 changes: 3 additions & 0 deletions google/cloud/common/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
from google.cloud.common import gapic_version as package_version

__version__ = package_version.__version__


from .types.operation_metadata import OperationMetadata
Expand Down
16 changes: 16 additions & 0 deletions google/cloud/common/gapic_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
__version__ = "1.0.6" # {x-release-please-version}
4 changes: 1 addition & 3 deletions google/cloud/common/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
from .operation_metadata import (
OperationMetadata,
)
from .operation_metadata import OperationMetadata

__all__ = ("OperationMetadata",)
18 changes: 9 additions & 9 deletions google/cloud/common/types/operation_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
import proto # type: ignore
from typing import MutableMapping, MutableSequence

from google.protobuf import timestamp_pb2 # type: ignore

import proto # type: ignore

__protobuf__ = proto.module(
package="google.cloud.common",
Expand Down Expand Up @@ -56,33 +56,33 @@ class OperationMetadata(proto.Message):
operation.
"""

create_time = proto.Field(
create_time: timestamp_pb2.Timestamp = proto.Field(
proto.MESSAGE,
number=1,
message=timestamp_pb2.Timestamp,
)
end_time = proto.Field(
end_time: timestamp_pb2.Timestamp = proto.Field(
proto.MESSAGE,
number=2,
message=timestamp_pb2.Timestamp,
)
target = proto.Field(
target: str = proto.Field(
proto.STRING,
number=3,
)
verb = proto.Field(
verb: str = proto.Field(
proto.STRING,
number=4,
)
status_detail = proto.Field(
status_detail: str = proto.Field(
proto.STRING,
number=5,
)
cancel_requested = proto.Field(
cancel_requested: bool = proto.Field(
proto.BOOL,
number=6,
)
api_version = proto.Field(
api_version: str = proto.Field(
proto.STRING,
number=7,
)
Expand Down
1 change: 1 addition & 0 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
# Generated by synthtool. DO NOT EDIT!

from __future__ import absolute_import

import os
import pathlib
import re
Expand Down
36 changes: 24 additions & 12 deletions owlbot.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2021 Google LLC
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -12,37 +12,49 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import json
from pathlib import Path
import shutil

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

from pathlib import Path

# ----------------------------------------------------------------------------
# Copy the generated client from the owl-bot staging directory
# ----------------------------------------------------------------------------
staging = Path("owl-bot-staging")

if staging.is_dir():
_tracked_paths.add(staging)
s.copy([staging], excludes=["setup.py", "README.rst", "docs/index.rst"])

# Remove once this repository migrates to google-cloud-python
s.replace(
staging / "setup.py",
"""url = \"https://github.com/googleapis/python-common\"""",
"""url = \"https://github.com/googleapis/python-cloud-common\"""",
)

s.copy([staging], excludes=["**/gapic_version.py", "README.rst", "docs/index.rst"])

s.remove_staging_dirs()


# ----------------------------------------------------------------------------
# Add templated files
# ----------------------------------------------------------------------------

templated_files = gcp.CommonTemplates().py_library(microgenerator=True)
s.move(templated_files, excludes=["README.rst", ".coveragerc"]) # the microgenerator has a good coveragerc file
templated_files = gcp.CommonTemplates().py_library(
cov_level=100,
microgenerator=True,
versions=gcp.common.detect_versions(path="./google", default_first=True),
)
s.move(templated_files, excludes=[".coveragerc", ".github/release-please.yml", "docs/index.rst", "README.rst"])

python.py_samples(skip_readmes=True)

python.configure_previous_major_version_branches()

# ----------------------------------------------------------------------------
# Run blacken session
# ----------------------------------------------------------------------------
# run format session for all directories which have a noxfile
for noxfile in Path(".").glob("**/noxfile.py"):
s.shell.run(["nox", "-s", "format"], cwd=noxfile.parent, hide_output=False)

s.shell.run(["nox", "-s", "blacken"], hide_output=False)
18 changes: 18 additions & 0 deletions release-please-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json",
"packages": {
".": {
"release-type": "python",
"extra-files": [
"google/cloud/common/gapic_version.py"
]
}
},
"release-type": "python",
"plugins": [
{
"type": "sentence-case"
}
],
"initial-version": "0.1.0"
}
35 changes: 21 additions & 14 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,38 +1,46 @@
# -*- coding: utf-8 -*-
#
# Copyright 2020 Google LLC
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

#
import io
import os

import setuptools
import setuptools # type: ignore

package_root = os.path.abspath(os.path.dirname(__file__))

name = "google-cloud-common"
description = "Google Cloud Common client library"
version = "1.0.6"
release_status = "Development Status :: 5 - Production/Stable"
url = "https://github.com/googleapis/python-cloud-common"


description = "Google Cloud Common API client library"

version = {}
with open(os.path.join(package_root, "google/cloud/common/gapic_version.py")) as fp:
exec(fp.read(), version)
version = version["__version__"]

if version[0] == "0":
release_status = "Development Status :: 4 - Beta"
else:
release_status = "Development Status :: 5 - Production/Stable"

dependencies = [
# NOTE: Maintainers, please do not require google-api-core>=2.x.x
# Until this issue is closed
# https://github.com/googleapis/google-cloud-python/issues/10566
"google-api-core[grpc] >= 1.31.5, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.0",
"google-api-core[grpc] >= 1.33.2, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*",
"proto-plus >= 1.22.0, <2.0.0dev",
"protobuf>=3.19.5,<5.0.0dev,!=3.20.0,!=3.20.1,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5",
]
url = "https://github.com/googleapis/python-cloud-common"

package_root = os.path.abspath(os.path.dirname(__file__))

Expand All @@ -50,7 +58,6 @@
if "google.cloud" in packages:
namespaces.append("google.cloud")


setuptools.setup(
name=name,
version=version,
Expand Down
6 changes: 6 additions & 0 deletions testing/constraints-3.10.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# -*- coding: utf-8 -*-
# This constraints file is required for unit tests.
# List all library dependencies and extras in this file.
google-api-core
proto-plus
protobuf
6 changes: 6 additions & 0 deletions testing/constraints-3.11.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# -*- coding: utf-8 -*-
# This constraints file is required for unit tests.
# List all library dependencies and extras in this file.
google-api-core
proto-plus
protobuf
2 changes: 1 addition & 1 deletion testing/constraints-3.7.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
# Pin the version to the lower bound.
# e.g., if setup.py has "google-cloud-foo >= 1.14.0, < 2.0.0dev",
# Then this file should have google-cloud-foo==1.14.0
google-api-core==1.31.5
google-api-core==1.33.2
proto-plus==1.22.0
protobuf==3.19.5
6 changes: 6 additions & 0 deletions testing/constraints-3.8.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# -*- coding: utf-8 -*-
# This constraints file is required for unit tests.
# List all library dependencies and extras in this file.
google-api-core
proto-plus
protobuf
6 changes: 6 additions & 0 deletions testing/constraints-3.9.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# -*- coding: utf-8 -*-
# This constraints file is required for unit tests.
# List all library dependencies and extras in this file.
google-api-core
proto-plus
protobuf