Skip to content
This repository was archived by the owner on Jul 6, 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
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.2.8"
}
2 changes: 1 addition & 1 deletion .repo-metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"issue_tracker": "http://github.com/googleapis/python-source-context/issues",
"release_level": "stable",
"language": "python",
"library_type": "GAPIC_AUTO",
"library_type": "OTHER",
"repo": "googleapis/python-source-context",
"distribution_name": "google-cloud-source-context",
"api_id": "source.googleapis.com",
Expand Down
1 change: 0 additions & 1 deletion docs/source_context_v1/types.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,4 @@ Types for Google Cloud Source Context v1 API

.. automodule:: google.cloud.source_context_v1.types
:members:
:undoc-members:
:show-inheritance:
3 changes: 3 additions & 0 deletions google/cloud/source_context/__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.source_context import gapic_version as package_version

__version__ = package_version.__version__


from google.cloud.source_context_v1.types.source_context import (
Expand Down
16 changes: 16 additions & 0 deletions google/cloud/source_context/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.2.8" # {x-release-please-version}
3 changes: 3 additions & 0 deletions google/cloud/source_context_v1/__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.source_context import gapic_version as package_version

__version__ = package_version.__version__


from .types.source_context import (
Expand Down
58 changes: 30 additions & 28 deletions google/cloud/source_context_v1/types/source_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
from typing import MutableMapping, MutableSequence

import proto # type: ignore

__protobuf__ = proto.module(
Expand Down Expand Up @@ -67,25 +69,25 @@ class SourceContext(proto.Message):
This field is a member of `oneof`_ ``context``.
"""

cloud_repo = proto.Field(
cloud_repo: "CloudRepoSourceContext" = proto.Field(
proto.MESSAGE,
number=1,
oneof="context",
message="CloudRepoSourceContext",
)
cloud_workspace = proto.Field(
cloud_workspace: "CloudWorkspaceSourceContext" = proto.Field(
proto.MESSAGE,
number=2,
oneof="context",
message="CloudWorkspaceSourceContext",
)
gerrit = proto.Field(
gerrit: "GerritSourceContext" = proto.Field(
proto.MESSAGE,
number=3,
oneof="context",
message="GerritSourceContext",
)
git = proto.Field(
git: "GitSourceContext" = proto.Field(
proto.MESSAGE,
number=6,
oneof="context",
Expand All @@ -100,16 +102,16 @@ class ExtendedSourceContext(proto.Message):
Attributes:
context (google.cloud.source_context_v1.types.SourceContext):
Any source context.
labels (Mapping[str, str]):
labels (MutableMapping[str, str]):
Labels with user defined metadata.
"""

context = proto.Field(
context: "SourceContext" = proto.Field(
proto.MESSAGE,
number=1,
message="SourceContext",
)
labels = proto.MapField(
labels: MutableMapping[str, str] = proto.MapField(
proto.STRING,
proto.STRING,
number=2,
Expand All @@ -133,12 +135,12 @@ class Kind(proto.Enum):
MOVABLE = 2
OTHER = 4

kind = proto.Field(
kind: Kind = proto.Field(
proto.ENUM,
number=1,
enum=Kind,
)
name = proto.Field(
name: str = proto.Field(
proto.STRING,
number=2,
)
Expand Down Expand Up @@ -172,22 +174,22 @@ class CloudRepoSourceContext(proto.Message):
This field is a member of `oneof`_ ``revision``.
"""

repo_id = proto.Field(
repo_id: "RepoId" = proto.Field(
proto.MESSAGE,
number=1,
message="RepoId",
)
revision_id = proto.Field(
revision_id: str = proto.Field(
proto.STRING,
number=2,
oneof="revision",
)
alias_name = proto.Field(
alias_name: str = proto.Field(
proto.STRING,
number=3,
oneof="revision",
)
alias_context = proto.Field(
alias_context: "AliasContext" = proto.Field(
proto.MESSAGE,
number=4,
oneof="revision",
Expand All @@ -207,12 +209,12 @@ class CloudWorkspaceSourceContext(proto.Message):
most recent snapshot.
"""

workspace_id = proto.Field(
workspace_id: "CloudWorkspaceId" = proto.Field(
proto.MESSAGE,
number=1,
message="CloudWorkspaceId",
)
snapshot_id = proto.Field(
snapshot_id: str = proto.Field(
proto.STRING,
number=2,
)
Expand Down Expand Up @@ -250,25 +252,25 @@ class GerritSourceContext(proto.Message):
This field is a member of `oneof`_ ``revision``.
"""

host_uri = proto.Field(
host_uri: str = proto.Field(
proto.STRING,
number=1,
)
gerrit_project = proto.Field(
gerrit_project: str = proto.Field(
proto.STRING,
number=2,
)
revision_id = proto.Field(
revision_id: str = proto.Field(
proto.STRING,
number=3,
oneof="revision",
)
alias_name = proto.Field(
alias_name: str = proto.Field(
proto.STRING,
number=4,
oneof="revision",
)
alias_context = proto.Field(
alias_context: "AliasContext" = proto.Field(
proto.MESSAGE,
number=5,
oneof="revision",
Expand All @@ -288,11 +290,11 @@ class GitSourceContext(proto.Message):
required.
"""

url = proto.Field(
url: str = proto.Field(
proto.STRING,
number=1,
)
revision_id = proto.Field(
revision_id: str = proto.Field(
proto.STRING,
number=2,
)
Expand Down Expand Up @@ -321,13 +323,13 @@ class RepoId(proto.Message):
This field is a member of `oneof`_ ``id``.
"""

project_repo_id = proto.Field(
project_repo_id: "ProjectRepoId" = proto.Field(
proto.MESSAGE,
number=1,
oneof="id",
message="ProjectRepoId",
)
uid = proto.Field(
uid: str = proto.Field(
proto.STRING,
number=2,
oneof="id",
Expand All @@ -346,11 +348,11 @@ class ProjectRepoId(proto.Message):
default repo.
"""

project_id = proto.Field(
project_id: str = proto.Field(
proto.STRING,
number=1,
)
repo_name = proto.Field(
repo_name: str = proto.Field(
proto.STRING,
number=2,
)
Expand All @@ -370,12 +372,12 @@ class CloudWorkspaceId(proto.Message):
the Source API's CreateWorkspace method.
"""

repo_id = proto.Field(
repo_id: "RepoId" = proto.Field(
proto.MESSAGE,
number=1,
message="RepoId",
)
name = proto.Field(
name: str = proto.Field(
proto.STRING,
number=2,
)
Expand Down
56 changes: 56 additions & 0 deletions owlbot.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# 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.

import json
from pathlib import Path
import shutil

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

# ----------------------------------------------------------------------------
# Copy the generated client from the owl-bot staging directory
# ----------------------------------------------------------------------------

clean_up_generated_samples = True

# Load the default version defined in .repo-metadata.json.
default_version = json.load(open(".repo-metadata.json", "rt")).get(
"default_version"
)

for library in s.get_staging_dirs(default_version):
if clean_up_generated_samples:
shutil.rmtree("samples/generated_samples", ignore_errors=True)
clean_up_generated_samples = False
s.move([library], excludes=["**/gapic_version.py"])
s.remove_staging_dirs()

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

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"])

python.py_samples(skip_readmes=True)

# 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)
19 changes: 19 additions & 0 deletions release-please-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json",
"packages": {
".": {
"release-type": "python",
"extra-files": [
"google/cloud/source_context/gapic_version.py"
]
}
},
"release-type": "python",
"plugins": [
{
"type": "sentence-case"
}
],
"initial-version": "0.1.0"
}

Loading