Skip to content

Commit 77bc8ed

Browse files
chore: update templates (#41)
* chore(python): skip docfx in main presubmit * chore(python): skip docfx in main presubmit * chore: properly template the repo name Source-Author: Bu Sun Kim <[email protected]> Source-Date: Fri Jan 8 10:32:13 2021 -0700 Source-Repo: googleapis/synthtool Source-Sha: fb53b6fb373b7c3edf4e55f3e8036bc6d73fa483 Source-Link: googleapis/synthtool@fb53b6f * chore: add missing quotation mark Source-Author: Bu Sun Kim <[email protected]> Source-Date: Mon Jan 11 09:43:06 2021 -0700 Source-Repo: googleapis/synthtool Source-Sha: 16ec872dd898d7de6e1822badfac32484b5d9031 Source-Link: googleapis/synthtool@16ec872 * build(python): make `NOX_SESSION` optional I added this accidentally in #889. `NOX_SESSION` should be passed down if it is set but not marked required. Source-Author: Bu Sun Kim <[email protected]> Source-Date: Tue Jan 19 09:38:04 2021 -0700 Source-Repo: googleapis/synthtool Source-Sha: ba960d730416fe05c50547e975ce79fcee52c671 Source-Link: googleapis/synthtool@ba960d7 * chore: Add header checker config to python library synth Now that we have it working in [python-docs-samples](https://github.com/GoogleCloudPlatform/python-docs-samples/blob/master/.github/header-checker-lint.yml) we should consider adding it to the 🐍 libraries :) Source-Author: Leah E. Cole <[email protected]> Source-Date: Mon Jan 25 13:24:08 2021 -0800 Source-Repo: googleapis/synthtool Source-Sha: 573f7655311b553a937f9123bee17bf78497db95 Source-Link: googleapis/synthtool@573f765 * chore: add noxfile parameters for extra dependencies Also, add tests for some noxfile parameters for assurance that the template generates valid Python. Co-authored-by: Jeffrey Rennie <[email protected]> Source-Author: Tim Swast <[email protected]> Source-Date: Tue Jan 26 12:26:57 2021 -0600 Source-Repo: googleapis/synthtool Source-Sha: 778d8beae28d6d87eb01fdc839a4b4d966ed2ebe Source-Link: googleapis/synthtool@778d8be * build: migrate to flakybot Source-Author: Justin Beckwith <[email protected]> Source-Date: Thu Jan 28 22:22:38 2021 -0800 Source-Repo: googleapis/synthtool Source-Sha: d1bb9173100f62c0cfc8f3138b62241e7f47ca6a Source-Link: googleapis/synthtool@d1bb917 * chore(python): include py.typed files in release A py.typed file must be included in the released package for it to be considered typed by type checkers. https://www.python.org/dev/peps/pep-0561/#packaging-type-information. See googleapis/python-secret-manager#79 Source-Author: Bu Sun Kim <[email protected]> Source-Date: Fri Feb 5 17:32:06 2021 -0700 Source-Repo: googleapis/synthtool Source-Sha: 33366574ffb9e11737b3547eb6f020ecae0536e8 Source-Link: googleapis/synthtool@3336657 * docs: update python contributing guide Adds details about blacken, updates version for system tests, and shows how to pass through pytest arguments. Source-Author: Chris Cotter <[email protected]> Source-Date: Mon Feb 8 17:13:36 2021 -0500 Source-Repo: googleapis/synthtool Source-Sha: 4679e7e415221f03ff2a71e3ffad75b9ec41d87e Source-Link: googleapis/synthtool@4679e7e
1 parent 22f28cf commit 77bc8ed

File tree

10 files changed

+77
-19
lines changed

10 files changed

+77
-19
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{"allowedCopyrightHolders": ["Google LLC"],
2+
"allowedLicenses": ["Apache-2.0", "MIT", "BSD-3"],
3+
"ignoreFiles": ["**/requirements.txt", "**/requirements-test.txt"],
4+
"sourceFileExtensions": [
5+
"ts",
6+
"js",
7+
"java",
8+
"sh",
9+
"Dockerfile",
10+
"yaml",
11+
"py",
12+
"html",
13+
"txt"
14+
]
15+
}

packages/google-cloud-resource-manager/.kokoro/build.sh

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@
1515

1616
set -eo pipefail
1717

18-
cd github/python-resource-manager
18+
if [[ -z "${PROJECT_ROOT:-}" ]]; then
19+
PROJECT_ROOT="github/python-resource-manager"
20+
fi
21+
22+
cd "${PROJECT_ROOT}"
1923

2024
# Disable buffering, so that the logs stream through.
2125
export PYTHONUNBUFFERED=1
@@ -30,16 +34,16 @@ export GOOGLE_APPLICATION_CREDENTIALS=${KOKORO_GFILE_DIR}/service-account.json
3034
export PROJECT_ID=$(cat "${KOKORO_GFILE_DIR}/project-id.json")
3135

3236
# Remove old nox
33-
python3.6 -m pip uninstall --yes --quiet nox-automation
37+
python3 -m pip uninstall --yes --quiet nox-automation
3438

3539
# Install nox
36-
python3.6 -m pip install --upgrade --quiet nox
37-
python3.6 -m nox --version
40+
python3 -m pip install --upgrade --quiet nox
41+
python3 -m nox --version
3842

3943
# If NOX_SESSION is set, it only runs the specified session,
4044
# otherwise run all the sessions.
4145
if [[ -n "${NOX_SESSION:-}" ]]; then
42-
python3.6 -m nox -s "${NOX_SESSION:-}"
46+
python3 -m nox -s ${NOX_SESSION:-}
4347
else
44-
python3.6 -m nox
48+
python3 -m nox
4549
fi

packages/google-cloud-resource-manager/.kokoro/docs/docs-presubmit.cfg

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,14 @@ env_vars: {
1515
key: "TRAMPOLINE_IMAGE_UPLOAD"
1616
value: "false"
1717
}
18+
19+
env_vars: {
20+
key: "TRAMPOLINE_BUILD_FILE"
21+
value: "github/python-resource-manager/.kokoro/build.sh"
22+
}
23+
24+
# Only run this nox session.
25+
env_vars: {
26+
key: "NOX_SESSION"
27+
value: "docs docfx"
28+
}

packages/google-cloud-resource-manager/.kokoro/test-samples.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,11 @@ for file in samples/**/requirements.txt; do
8787
python3.6 -m nox -s "$RUN_TESTS_SESSION"
8888
EXIT=$?
8989

90-
# If this is a periodic build, send the test log to the Build Cop Bot.
91-
# See https://github.com/googleapis/repo-automation-bots/tree/master/packages/buildcop.
90+
# If this is a periodic build, send the test log to the FlakyBot.
91+
# See https://github.com/googleapis/repo-automation-bots/tree/master/packages/flakybot.
9292
if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"periodic"* ]]; then
93-
chmod +x $KOKORO_GFILE_DIR/linux_amd64/buildcop
94-
$KOKORO_GFILE_DIR/linux_amd64/buildcop
93+
chmod +x $KOKORO_GFILE_DIR/linux_amd64/flakybot
94+
$KOKORO_GFILE_DIR/linux_amd64/flakybot
9595
fi
9696

9797
if [[ $EXIT -ne 0 ]]; then

packages/google-cloud-resource-manager/.kokoro/trampoline_v2.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ if [[ -n "${KOKORO_BUILD_ID:-}" ]]; then
159159
"KOKORO_GITHUB_COMMIT"
160160
"KOKORO_GITHUB_PULL_REQUEST_NUMBER"
161161
"KOKORO_GITHUB_PULL_REQUEST_COMMIT"
162-
# For Build Cop Bot
162+
# For FlakyBot
163163
"KOKORO_GITHUB_COMMIT_URL"
164164
"KOKORO_GITHUB_PULL_REQUEST_URL"
165165
)

packages/google-cloud-resource-manager/.trampolinerc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ required_envvars+=(
2424
pass_down_envvars+=(
2525
"STAGING_BUCKET"
2626
"V2_STAGING_BUCKET"
27+
"NOX_SESSION"
2728
)
2829

2930
# Prevent unintentional override on the default image.

packages/google-cloud-resource-manager/CONTRIBUTING.rst

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,14 @@ We use `nox <https://nox.readthedocs.io/en/latest/>`__ to instrument our tests.
7070
- To test your changes, run unit tests with ``nox``::
7171

7272
$ nox -s unit-2.7
73-
$ nox -s unit-3.7
73+
$ nox -s unit-3.8
7474
$ ...
7575

76+
- Args to pytest can be passed through the nox command separated by a `--`. For
77+
example, to run a single test::
78+
79+
$ nox -s unit-3.8 -- -k <name of test>
80+
7681
.. note::
7782

7883
The unit tests and system tests are described in the
@@ -93,8 +98,12 @@ On Debian/Ubuntu::
9398
************
9499
Coding Style
95100
************
101+
- We use the automatic code formatter ``black``. You can run it using
102+
the nox session ``blacken``. This will eliminate many lint errors. Run via::
103+
104+
$ nox -s blacken
96105

97-
- PEP8 compliance, with exceptions defined in the linter configuration.
106+
- PEP8 compliance is required, with exceptions defined in the linter configuration.
98107
If you have ``nox`` installed, you can test that you have not introduced
99108
any non-compliant code via::
100109

@@ -133,13 +142,18 @@ Running System Tests
133142

134143
- To run system tests, you can execute::
135144

136-
$ nox -s system-3.7
145+
# Run all system tests
146+
$ nox -s system-3.8
137147
$ nox -s system-2.7
138148

149+
# Run a single system test
150+
$ nox -s system-3.8 -- -k <name of test>
151+
152+
139153
.. note::
140154

141155
System tests are only configured to run under Python 2.7 and
142-
Python 3.7. For expediency, we do not run them in older versions
156+
Python 3.8. For expediency, we do not run them in older versions
143157
of Python 3.
144158

145159
This alone will not run the tests. You'll need to change some local

packages/google-cloud-resource-manager/MANIFEST.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@
1616

1717
# Generated by synthtool. DO NOT EDIT!
1818
include README.rst LICENSE
19-
recursive-include google *.json *.proto
19+
recursive-include google *.json *.proto py.typed
2020
recursive-include tests *
2121
global-exclude *.py[co]
2222
global-exclude __pycache__
2323

2424
# Exclude scripts for samples readmegen
25-
prune scripts/readme-gen
25+
prune scripts/readme-gen

packages/google-cloud-resource-manager/noxfile.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,17 @@
3030
SYSTEM_TEST_PYTHON_VERSIONS = ["2.7", "3.8"]
3131
UNIT_TEST_PYTHON_VERSIONS = ["2.7", "3.6", "3.7", "3.8", "3.9"]
3232

33+
# 'docfx' is excluded since it only needs to run in 'docs-presubmit'
34+
nox.options.sessions = [
35+
"unit",
36+
"system",
37+
"cover",
38+
"lint",
39+
"lint_setup_py",
40+
"blacken",
41+
"docs",
42+
]
43+
3344

3445
@nox.session(python=DEFAULT_PYTHON_VERSION)
3546
def lint(session):
@@ -73,6 +84,7 @@ def default(session):
7384
session.install(
7485
"mock", "pytest", "pytest-cov",
7586
)
87+
7688
session.install("-e", ".")
7789

7890
# Run py.test against the unit tests.

packages/google-cloud-resource-manager/synth.metadata

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
"git": {
55
"name": ".",
66
"remote": "https://github.com/googleapis/python-resource-manager.git",
7-
"sha": "75ad9f8808d75b4e61b2183a7f97c8a9f7ee1ca6"
7+
"sha": "6339756cb46839cb6c91d5cf7afafd3aaeb27ad4"
88
}
99
},
1010
{
1111
"git": {
1212
"name": "synthtool",
1313
"remote": "https://github.com/googleapis/synthtool.git",
14-
"sha": "41a4e56982620d3edcf110d76f4fcdfdec471ac8"
14+
"sha": "4679e7e415221f03ff2a71e3ffad75b9ec41d87e"
1515
}
1616
}
1717
],
@@ -23,6 +23,7 @@
2323
".github/ISSUE_TEMPLATE/feature_request.md",
2424
".github/ISSUE_TEMPLATE/support_request.md",
2525
".github/PULL_REQUEST_TEMPLATE.md",
26+
".github/header-checker-lint.yml",
2627
".github/release-please.yml",
2728
".github/snippet-bot.yml",
2829
".gitignore",

0 commit comments

Comments
 (0)