Skip to content

Commit 8ae2b5a

Browse files
authored
chore: remove obsolete replacements in owlbot.py (googleapis#492)
This PR also switches the post processor image from `gcr.io/cloud-devrel-public-resources/owlbot-python:latest` to `gcr.io/repo-automation-bots/owlbot-python:latest` as there is a bug in owlbot where it only opens PRs when the post processor image is in the project `repo-automation-bots`. I've bumped the priority of the bug to p1 here: googleapis/repo-automation-bots#1790
1 parent a05a3f2 commit 8ae2b5a

9 files changed

Lines changed: 49 additions & 62 deletions

File tree

.github/.OwlBot.lock.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
docker:
2-
digest: sha256:808628fb9d5c649a28355b062ee184a4689e98e8607c241461dae26e5a6df0c2
3-
image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest
2+
digest: sha256:0ffe3bdd6c7159692df5f7744da74e5ef19966288a6bf76023e8e04e0c424d7d
3+
image: gcr.io/repo-automation-bots/owlbot-python:latest

.github/.OwlBot.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# limitations under the License.
1414

1515
docker:
16-
image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest
16+
image: gcr.io/repo-automation-bots/owlbot-python:latest
1717

1818
deep-remove-regex:
1919
- /owl-bot-staging

CONTRIBUTING.rst

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,9 @@ Coding Style
113113
export GOOGLE_CLOUD_TESTING_BRANCH="main"
114114

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

120120
- This repository contains configuration for the
121121
`pre-commit <https://pre-commit.com/>`__ tool, which automates checking
@@ -177,6 +177,30 @@ Build the docs via:
177177

178178
$ nox -s docs
179179

180+
*************************
181+
Samples and code snippets
182+
*************************
183+
184+
Code samples and snippets live in the `samples/` catalogue. Feel free to
185+
provide more examples, but make sure to write tests for those examples.
186+
Each folder containing example code requires its own `noxfile.py` script
187+
which automates testing. If you decide to create a new folder, you can
188+
base it on the `samples/snippets` folder (providing `noxfile.py` and
189+
the requirements files).
190+
191+
The tests will run against a real Google Cloud Project, so you should
192+
configure them just like the System Tests.
193+
194+
- To run sample tests, you can execute::
195+
196+
# Run all tests in a folder
197+
$ cd samples/snippets
198+
$ nox -s py-3.8
199+
200+
# Run a single sample test
201+
$ cd samples/snippets
202+
$ nox -s py-3.8 -- -k <name of test>
203+
180204
********************************************
181205
Note About ``README`` as it pertains to PyPI
182206
********************************************

docs/conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@
110110
# directories to ignore when looking for source files.
111111
exclude_patterns = [
112112
"_build",
113+
"**/.nox/**/*",
113114
"samples/AUTHORING_GUIDE.md",
114115
"samples/CONTRIBUTING.md",
115116
"samples/snippets/README.rst",

noxfile.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,15 @@ def default(session):
8484
constraints_path = str(
8585
CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt"
8686
)
87-
session.install("asyncmock", "pytest-asyncio", "-c", constraints_path)
88-
89-
session.install("mock", "pytest", "pytest-cov", "-c", constraints_path)
87+
session.install(
88+
"mock",
89+
"asyncmock",
90+
"pytest",
91+
"pytest-cov",
92+
"pytest-asyncio",
93+
"-c",
94+
constraints_path,
95+
)
9096

9197
session.install("-e", ".", "-c", constraints_path)
9298

owlbot.py

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -351,51 +351,4 @@
351351
# ----------------------------------------------------------------------------
352352
python.py_samples()
353353

354-
# Remove the replacements below once
355-
# https://github.com/googleapis/synthtool/pull/1188 is merged
356-
357-
# Update googleapis/repo-automation-bots repo to main in .kokoro/*.sh files
358-
s.replace(
359-
".kokoro/*.sh",
360-
"repo-automation-bots/tree/master",
361-
"repo-automation-bots/tree/main",
362-
)
363-
364-
# Customize CONTRIBUTING.rst to replace master with main
365-
s.replace(
366-
"CONTRIBUTING.rst",
367-
"fetch and merge changes from upstream into master",
368-
"fetch and merge changes from upstream into main",
369-
)
370-
371-
s.replace(
372-
"CONTRIBUTING.rst", "git merge upstream/master", "git merge upstream/main",
373-
)
374-
375-
s.replace(
376-
"CONTRIBUTING.rst",
377-
"""export GOOGLE_CLOUD_TESTING_BRANCH=\"master\"""",
378-
"""export GOOGLE_CLOUD_TESTING_BRANCH=\"main\"""",
379-
)
380-
381-
s.replace(
382-
"CONTRIBUTING.rst", "remote \(``master``\)", "remote (``main``)",
383-
)
384-
385-
s.replace(
386-
"CONTRIBUTING.rst", "blob/master/CONTRIBUTING.rst", "blob/main/CONTRIBUTING.rst",
387-
)
388-
389-
s.replace(
390-
"CONTRIBUTING.rst", "blob/master/noxfile.py", "blob/main/noxfile.py",
391-
)
392-
393-
s.replace(
394-
"docs/conf.py", "master_doc", "root_doc",
395-
)
396-
397-
s.replace(
398-
"docs/conf.py", "# The master toctree document.", "# The root toctree document.",
399-
)
400-
401354
s.shell.run(["nox", "-s", "blacken"], hide_output=False)

renovate.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
{
22
"extends": [
3-
"config:base", ":preserveSemverRanges"
3+
"config:base",
4+
"group:all",
5+
":preserveSemverRanges",
6+
":disableDependencyDashboard"
47
],
58
"ignorePaths": [".pre-commit-config.yaml"],
69
"pip_requirements": {

samples/snippets/noxfile.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939

4040
TEST_CONFIG = {
4141
# You can opt out from the test for specific Python versions.
42-
'ignored_versions': ["2.7"],
42+
'ignored_versions': [],
4343

4444
# Old samples are opted out of enforcing Python type hints
4545
# All new samples should feature them
@@ -88,15 +88,15 @@ def get_pytest_env_vars() -> Dict[str, str]:
8888

8989

9090
# DO NOT EDIT - automatically generated.
91-
# All versions used to tested samples.
92-
ALL_VERSIONS = ["2.7", "3.6", "3.7", "3.8", "3.9"]
91+
# All versions used to test samples.
92+
ALL_VERSIONS = ["3.6", "3.7", "3.8", "3.9"]
9393

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

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

99-
INSTALL_LIBRARY_FROM_SOURCE = bool(os.environ.get("INSTALL_LIBRARY_FROM_SOURCE", False))
99+
INSTALL_LIBRARY_FROM_SOURCE = os.environ.get("INSTALL_LIBRARY_FROM_SOURCE", False) in ("True", "true")
100100
#
101101
# Style Checks
102102
#

scripts/readme-gen/templates/install_deps.tmpl.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Install Dependencies
1212
.. _Python Development Environment Setup Guide:
1313
https://cloud.google.com/python/setup
1414

15-
#. Create a virtualenv. Samples are compatible with Python 2.7 and 3.4+.
15+
#. Create a virtualenv. Samples are compatible with Python 3.6+.
1616

1717
.. code-block:: bash
1818

0 commit comments

Comments
 (0)