Skip to content

Commit f8926f7

Browse files
chore: update testing - ignore files, add constraints (#107)
* chore: add constraints file check for python samples This is the sibling PR to GoogleCloudPlatform/python-docs-samples#5611 and this is the issue opened for it GoogleCloudPlatform/python-docs-samples#5549 If you look at the files in [this example repo](https://github.com/leahecole/testrepo-githubapp/pull/31/files), you'll see that renovate successfully opened a PR on three constraints files in `samples` directories and subdirectories, and properly ignored `constraints` files at the root level cc @tswast TODO: - [x] update renovate to check for samples/constraints.txt dependency updates - [x] run lint locally to double check that I'm not introducing lint error Source-Author: Leah E. Cole <[email protected]> Source-Date: Fri Apr 9 22:50:04 2021 -0700 Source-Repo: googleapis/synthtool Source-Sha: 0a071b3460344886297a304253bf924aa68ddb7e Source-Link: googleapis/synthtool@0a071b3 * docs(python): add empty lines between methods Source-Author: Bu Sun Kim <[email protected]> Source-Date: Wed Apr 14 14:41:09 2021 -0600 Source-Repo: googleapis/synthtool Source-Sha: 721339ab60a6eb63b889978b3d9b295dcb3be370 Source-Link: googleapis/synthtool@721339a * build: use PyPI API token in secret manager Migrate python libraries onto the PyPI API token stored in secret manager. A PyPI API token is limited in scope to uploading new releases. https://pypi.org/help/#apitoken Verified that this works with [build](https://fusion2.corp.google.com/invocations/14bae126-83fa-4328-8da9-d390ed99315c/targets/cloud-devrel%2Fclient-libraries%2Fpython%2Fgoogleapis%2Fpython-vision%2Frelease%2Frelease;config=default/log) on googleapis/python-vision#136 Source-Author: Bu Sun Kim <[email protected]> Source-Date: Wed Apr 14 17:46:06 2021 -0600 Source-Repo: googleapis/synthtool Source-Sha: 043cc620d6a6111816d9e09f2a97208565fde958 Source-Link: googleapis/synthtool@043cc62
1 parent 1f611f6 commit f8926f7

File tree

7 files changed

+32
-22
lines changed

7 files changed

+32
-22
lines changed

packages/google-cloud-secret-manager/.github/header-checker-lint.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{"allowedCopyrightHolders": ["Google LLC"],
22
"allowedLicenses": ["Apache-2.0", "MIT", "BSD-3"],
3-
"ignoreFiles": ["**/requirements.txt", "**/requirements-test.txt"],
3+
"ignoreFiles": ["**/requirements.txt", "**/requirements-test.txt", "**/__init__.py", "samples/**/constraints.txt", "samples/**/constraints-test.txt"],
44
"sourceFileExtensions": [
55
"ts",
66
"js",

packages/google-cloud-secret-manager/.kokoro/release.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ python3 -m pip install --upgrade twine wheel setuptools
2626
export PYTHONUNBUFFERED=1
2727

2828
# Move into the package, build the distribution and upload.
29-
TWINE_PASSWORD=$(cat "${KOKORO_KEYSTORE_DIR}/73713_google_cloud_pypi_password")
29+
TWINE_PASSWORD=$(cat "${KOKORO_GFILE_DIR}/secret_manager/google-cloud-pypi-token")
3030
cd github/python-secret-manager
3131
python3 setup.py sdist bdist_wheel
32-
twine upload --username gcloudpypi --password "${TWINE_PASSWORD}" dist/*
32+
twine upload --username __token__ --password "${TWINE_PASSWORD}" dist/*

packages/google-cloud-secret-manager/.kokoro/release/common.cfg

+2-12
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,8 @@ env_vars: {
2323
value: "github/python-secret-manager/.kokoro/release.sh"
2424
}
2525

26-
# Fetch PyPI password
27-
before_action {
28-
fetch_keystore {
29-
keystore_resource {
30-
keystore_config_id: 73713
31-
keyname: "google_cloud_pypi_password"
32-
}
33-
}
34-
}
35-
3626
# Tokens needed to report release status back to GitHub
3727
env_vars: {
3828
key: "SECRET_MANAGER_KEYS"
39-
value: "releasetool-publish-reporter-app,releasetool-publish-reporter-googleapis-installation,releasetool-publish-reporter-pem"
40-
}
29+
value: "releasetool-publish-reporter-app,releasetool-publish-reporter-googleapis-installation,releasetool-publish-reporter-pem,google-cloud-pypi-token"
30+
}
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,20 @@
11
div#python2-eol {
22
border-color: red;
33
border-width: medium;
4-
}
4+
}
55

66
/* Ensure minimum width for 'Parameters' / 'Returns' column */
77
dl.field-list > dt {
88
min-width: 100px
99
}
10+
11+
/* Insert space between methods for readability */
12+
dl.method {
13+
padding-top: 10px;
14+
padding-bottom: 10px
15+
}
16+
17+
/* Insert empty space between classes */
18+
dl.class {
19+
padding-bottom: 50px
20+
}

packages/google-cloud-secret-manager/renovate.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,8 @@
22
"extends": [
33
"config:base", ":preserveSemverRanges"
44
],
5-
"ignorePaths": [".pre-commit-config.yaml"]
5+
"ignorePaths": [".pre-commit-config.yaml"],
6+
"pip_requirements": {
7+
"fileMatch": ["requirements-test.txt", "samples/[\\S/]*constraints.txt", "samples/[\\S/]*constraints-test.txt"]
8+
}
69
}

packages/google-cloud-secret-manager/samples/snippets/noxfile.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -172,10 +172,16 @@ def blacken(session: nox.sessions.Session) -> None:
172172
def _session_tests(session: nox.sessions.Session, post_install: Callable = None) -> None:
173173
"""Runs py.test for a particular project."""
174174
if os.path.exists("requirements.txt"):
175-
session.install("-r", "requirements.txt")
175+
if os.path.exists("constraints.txt"):
176+
session.install("-r", "requirements.txt", "-c", "constraints.txt")
177+
else:
178+
session.install("-r", "requirements.txt")
176179

177180
if os.path.exists("requirements-test.txt"):
178-
session.install("-r", "requirements-test.txt")
181+
if os.path.exists("constraints-test.txt"):
182+
session.install("-r", "requirements-test.txt", "-c", "constraints-test.txt")
183+
else:
184+
session.install("-r", "requirements-test.txt")
179185

180186
if INSTALL_LIBRARY_FROM_SOURCE:
181187
session.install("-e", _get_repo_root())

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

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"git": {
55
"name": ".",
66
"remote": "https://github.com/googleapis/python-secret-manager.git",
7-
"sha": "ab052690e819d6864b8106a51b6eaf1d5f90475d"
7+
"sha": "5e9155b4733610d3df7c1e5597c9c069cd09eaec"
88
}
99
},
1010
{
@@ -19,14 +19,14 @@
1919
"git": {
2020
"name": "synthtool",
2121
"remote": "https://github.com/googleapis/synthtool.git",
22-
"sha": "5b5bf6d519b2d658d9f2e483d9f6f3d0ba8ee6bc"
22+
"sha": "043cc620d6a6111816d9e09f2a97208565fde958"
2323
}
2424
},
2525
{
2626
"git": {
2727
"name": "synthtool",
2828
"remote": "https://github.com/googleapis/synthtool.git",
29-
"sha": "5b5bf6d519b2d658d9f2e483d9f6f3d0ba8ee6bc"
29+
"sha": "043cc620d6a6111816d9e09f2a97208565fde958"
3030
}
3131
}
3232
],

0 commit comments

Comments
 (0)