Skip to content
This repository has been archived by the owner on Feb 13, 2024. It is now read-only.

chore: move samples from python-docs-sample #45

Merged
merged 133 commits into from Sep 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
133 commits
Select commit Hold shift + click to select a range
8d0551a
Add new "quickstart" samples [(#547)](https://github.com/GoogleCloudP…
jmdobry Oct 5, 2016
5057f85
Quickstart tests [(#569)](https://github.com/GoogleCloudPlatform/pyth…
Oct 12, 2016
44faa07
Fix vision failure on Python 3
Oct 14, 2016
e2fe4ba
Generate most non-appengine readmes
Oct 25, 2016
a6c7784
Update samples to support latest Google Cloud Python [(#656)](https:/…
Nov 15, 2016
5a66f6b
Auto-update dependencies. [(#715)](https://github.com/GoogleCloudPlat…
dpebot Dec 13, 2016
d150d08
Vision cloud client snippets [(#751)](https://github.com/GoogleCloudP…
gguuss Jan 11, 2017
017a03d
fixes typo in detect_properties [(#761)](https://github.com/GoogleClo…
bshaffer Jan 18, 2017
eea38d7
Vision 1.1 [(#827)](https://github.com/GoogleCloudPlatform/python-doc…
gguuss Feb 27, 2017
ef0c4c9
Updates GCS snippet to match local file [(#836)](https://github.com/G…
gguuss Feb 28, 2017
40650d8
Improvess consistency in docs and fixes links in restructured text [(…
gguuss Mar 2, 2017
4eafd67
Auto-update dependencies. [(#825)](https://github.com/GoogleCloudPlat…
dpebot Mar 11, 2017
90a4692
Crop hints tutorial [(#861)](https://github.com/GoogleCloudPlatform/p…
gguuss Mar 20, 2017
38682ca
Auto-update dependencies. [(#866)](https://github.com/GoogleCloudPlat…
dpebot Mar 21, 2017
e78b973
Adds document text detection tutorial. [(#868)](https://github.com/Go…
gguuss Mar 22, 2017
2721789
Fixes a few style issues that came up in document text review. [(#871…
gguuss Mar 22, 2017
562d3fd
Auto-update dependencies. [(#872)](https://github.com/GoogleCloudPlat…
dpebot Mar 23, 2017
a43bd3d
An attempt at flattening the detect example [(#873)](https://github.c…
gguuss Mar 23, 2017
d4517f5
Adds web detection tutorial [(#874)](https://github.com/GoogleCloudPl…
gguuss Mar 23, 2017
f54c7bf
Vision face tutorial [(#880)](https://github.com/GoogleCloudPlatform/…
gguuss Mar 28, 2017
2a65925
Auto-update dependencies. [(#876)](https://github.com/GoogleCloudPlat…
dpebot Apr 4, 2017
a1897d4
Remove cloud config fixture [(#887)](https://github.com/GoogleCloudPl…
Apr 4, 2017
636d6c0
Auto-update dependencies. [(#888)](https://github.com/GoogleCloudPlat…
dpebot Apr 5, 2017
58db663
Remove resource [(#890)](https://github.com/GoogleCloudPlatform/pytho…
Apr 5, 2017
3dd3f95
Re-generate all readmes
Apr 27, 2017
bcbda8a
Auto-update dependencies. [(#922)](https://github.com/GoogleCloudPlat…
dpebot May 1, 2017
63d69a5
Adds checks for all features using https. [(#944)](https://github.com…
gguuss May 15, 2017
ae1627c
Fix README rst links [(#962)](https://github.com/GoogleCloudPlatform/…
waprin May 24, 2017
948d8c3
Auto-update dependencies. [(#1004)](https://github.com/GoogleCloudPla…
dpebot Jun 27, 2017
2a30f05
Auto-update dependencies. [(#1011)](https://github.com/GoogleCloudPla…
dpebot Jul 13, 2017
336b4e6
Auto-update dependencies. [(#1033)](https://github.com/GoogleCloudPla…
dpebot Jul 27, 2017
765487a
Vision GAPIC client library [(#1015)](https://github.com/GoogleCloudP…
dizcology Jul 27, 2017
867f110
Auto-update dependencies. [(#1055)](https://github.com/GoogleCloudPla…
dpebot Aug 7, 2017
e0d391e
Auto-update dependencies. [(#1093)](https://github.com/GoogleCloudPla…
dpebot Aug 29, 2017
27aee40
Update all generated readme auth instructions [(#1121)](https://githu…
Sep 18, 2017
6a2e5cf
Added Link to Python Setup Guide [(#1158)](https://github.com/GoogleC…
Oct 12, 2017
ff9b7ab
Auto-update dependencies. [(#1138)](https://github.com/GoogleCloudPla…
dpebot Oct 23, 2017
284210e
Auto-update dependencies. [(#1186)](https://github.com/GoogleCloudPla…
dpebot Nov 1, 2017
71a419c
Auto-update dependencies. [(#1245)](https://github.com/GoogleCloudPla…
dpebot Dec 4, 2017
09be04b
Vision beta [(#1211)](https://github.com/GoogleCloudPlatform/python-d…
dizcology Dec 5, 2017
334ff74
remove unicode [(#1246)](https://github.com/GoogleCloudPlatform/pytho…
dizcology Dec 5, 2017
f2adc97
Added "Open in Cloud Shell" buttons to README files [(#1254)](https:/…
Dec 7, 2017
bbad4c6
Auto-update dependencies. [(#1282)](https://github.com/GoogleCloudPla…
dpebot Jan 2, 2018
f79664b
Auto-update dependencies. [(#1320)](https://github.com/GoogleCloudPla…
dpebot Feb 2, 2018
fba66ee
Vision API features update [(#1339)](https://github.com/GoogleCloudPl…
dizcology Feb 6, 2018
f7770ce
Revert "Vision API features update [(#1339)](https://github.com/Googl…
beccasaurus Feb 7, 2018
7f9b441
Auto-update dependencies. [(#1377)](https://github.com/GoogleCloudPla…
dpebot Mar 5, 2018
efbc883
fix landmark sample [(#1424)](https://github.com/GoogleCloudPlatform/…
dizcology Mar 27, 2018
1eeeb8b
Vision GA [(#1427)](https://github.com/GoogleCloudPlatform/python-doc…
dizcology Mar 29, 2018
5040962
[DO NOT MERGE] Vision API OCR PDF/TIFF sample [(#1420)](https://githu…
dizcology Apr 4, 2018
a45d042
Regenerate the README files and fix the Open in Cloud Shell link for …
Apr 7, 2018
a45c72a
detect-pdf update [(#1460)](https://github.com/GoogleCloudPlatform/py…
dizcology Apr 24, 2018
5ca1b7f
Update READMEs to fix numbering and add git clone [(#1464)](https://g…
frankyn Apr 26, 2018
265ddc8
Move ocr pdf/tiff samples to GA [(#1522)](https://github.com/GoogleCl…
nnegrey Jun 15, 2018
be34b49
Fix the vision geo test. [(#1518)](https://github.com/GoogleCloudPlat…
SurferJeffAtGoogle Jun 22, 2018
6eb79f7
[DO_NOT_MERGE] Add samples for object localization and handwritten oc…
nnegrey Jul 19, 2018
23edee0
[DO NOT MERGE] Product search [(#1580)](https://github.com/GoogleClou…
dizcology Jul 23, 2018
73e6e7b
Update vision web_detect test image [(#1607)](https://github.com/Goog…
tswast Aug 1, 2018
0f325b3
Vision - remove unused region tags [(#1620)](https://github.com/Googl…
alixhami Aug 10, 2018
a623e90
Vision region tag update [(#1635)](https://github.com/GoogleCloudPlat…
alixhami Aug 16, 2018
1876256
Udpate Beta Vision samples to use beta tags [(#1640)](https://github.…
alixhami Aug 16, 2018
710b09a
Update samples to GA, cleanup tests, delete old samples [(#1704)](htt…
nnegrey Sep 21, 2018
ed82716
Add print output to crop hints tutorial [(#1797)](https://github.com/…
beccasaurus Oct 29, 2018
3193fb1
Remove unused code [(#1745)](https://github.com/GoogleCloudPlatform/p…
krissdap Nov 1, 2018
61b5c40
Display the score/confidence value [(#1429)](https://github.com/Googl…
peshmerge Nov 19, 2018
0ede568
Remove [(#1431)](https://github.com/GoogleCloudPlatform/python-docs-s…
navinger Nov 19, 2018
4d885a4
Auto-update dependencies. [(#1846)](https://github.com/GoogleCloudPla…
dpebot Nov 20, 2018
ee1897b
update samples for product search GA [(#1861)](https://github.com/Goo…
dizcology Nov 26, 2018
29c973b
Use default font [(#1865)](https://github.com/GoogleCloudPlatform/pyt…
engelke Nov 27, 2018
5828ef2
use shared sample data bucket [(#1874)](https://github.com/GoogleClou…
dizcology Nov 27, 2018
ead1282
Pass max_results through to API - issue #1173 [(#1917)](https://githu…
engelke Dec 7, 2018
da43200
Fix Vision Product Search sample comment typo [(#1897)](https://githu…
alixhami Dec 19, 2018
ef5a30a
vision: update samples to address changes in model annotations. [(#19…
shollyman Feb 1, 2019
4e1a1c9
Auto-update dependencies. [(#1980)](https://github.com/GoogleCloudPla…
dpebot Feb 6, 2019
8b3ee74
Vision API: further fixes. [(#2002)](https://github.com/GoogleCloudPl…
shollyman Feb 7, 2019
1bc0992
Added two samples for "OCR with PDF/TIFF as source files" [(#2034)](h…
happyhuman Mar 12, 2019
7c8999f
Added the sample for async image batch annotation [(#2045)](https://g…
happyhuman Mar 15, 2019
039339e
Need newer library version for latest beta [(#2052)](https://github.c…
engelke Mar 19, 2019
bee6538
Fixed string in test [(#2135)](https://github.com/GoogleCloudPlatform…
engelke May 3, 2019
6eaad9a
Update detect.py [(#2174)](https://github.com/GoogleCloudPlatform/pyt…
agnelvishal Jun 10, 2019
60fe11c
Revert "Update detect.py" [(#2274)](https://github.com/GoogleCloudPla…
nnegrey Jul 18, 2019
a2eeb2a
Move import inside region tags [(#2211)](https://github.com/GoogleClo…
nnegrey Jul 18, 2019
cef1a10
Fix comment. [(#2108)](https://github.com/GoogleCloudPlatform/python-…
gregakespret Jul 23, 2019
5c2af34
Fix a typo in output message / remove duplicate parser assignment. [(…
dawoonchung Jul 24, 2019
0e645b6
move import re [(#2303)](https://github.com/GoogleCloudPlatform/pytho…
dizcology Jul 29, 2019
56ea938
Makes quickstart more REPL friendly [(#2354)](https://github.com/Goog…
gguuss Aug 20, 2019
bb57d0c
vision geo test fix [(#2353)](https://github.com/GoogleCloudPlatform/…
sirtorry Aug 26, 2019
af3aad9
Purge products [(#2349)](https://github.com/GoogleCloudPlatform/pytho…
dizcology Sep 21, 2019
eaf52b4
Adds updates for samples profiler ... vision [(#2439)](https://github…
gguuss Oct 7, 2019
335fe6d
Update Pillow dependency per security alert CVE-2019-16865 [(#2492)](…
engelke Oct 23, 2019
55f5162
Add Set Endpoint Samples [(#2497)](https://github.com/GoogleCloudPlat…
nnegrey Nov 15, 2019
ea18ef3
Auto-update dependencies. [(#2005)](https://github.com/GoogleCloudPla…
dpebot Dec 21, 2019
34b84d6
fix: get bounds for blocks instead of pages [(#2705)](https://github.…
busunkim96 Jan 10, 2020
1dca994
Add vision ocr set endpoint samples [(#2569)](https://github.com/Goog…
nnegrey Jan 10, 2020
c23b240
vision: update samples to throw errors if one occurs [(#2725)](https:…
nnegrey Jan 21, 2020
86fe9b7
vision: move published samples into master [(#2743)](https://github.c…
texasmichelle Jan 28, 2020
64c017c
fix: vision product search tests to call setup and teardown and use u…
nnegrey Feb 12, 2020
9a4d13f
vision: fix flaky test [(#2988)](https://github.com/GoogleCloudPlatfo…
nnegrey Feb 25, 2020
56974a1
vision: fix flaky tests to be more generic in the results [(#2915)](h…
nnegrey Feb 26, 2020
041c786
chore(deps): update dependency google-cloud-storage to v1.26.0 [(#304…
renovate-bot Mar 9, 2020
9e3a70d
Clarifying comment for batch requests [(#3071)](https://github.com/Go…
czahedi Mar 11, 2020
85c252a
vision: remove redundant flaky web test [(#3090)](https://github.com/…
nnegrey Mar 12, 2020
4799e17
vision: fix flaky test [(#3091)](https://github.com/GoogleCloudPlatfo…
nnegrey Mar 12, 2020
b5b47f4
chore(deps): update dependency google-cloud-vision to v0.42.0 [(#3170…
renovate-bot Mar 27, 2020
425f376
chore(deps): update dependency pillow to v6.2.2 [(#3186)](https://git…
renovate-bot Apr 1, 2020
78c6b31
chore(deps): update dependency pillow to v7 [(#3218)](https://github.…
renovate-bot Apr 1, 2020
a33c5b2
Simplify noxfile setup. [(#2806)](https://github.com/GoogleCloudPlatf…
kurtisvg Apr 2, 2020
9700db3
Update dependency google-cloud-vision to v1 [(#3227)](https://github.…
renovate-bot Apr 2, 2020
a0a7076
Update dependency pillow to v7.1.1 [(#3263)](https://github.com/Googl…
renovate-bot Apr 2, 2020
ebf8ebf
vision: increase timeout for tests [(#3383)](https://github.com/Googl…
nnegrey Apr 14, 2020
6264ad6
[vision] fix: longer timeout [(#3447)](https://github.com/GoogleCloud…
Apr 21, 2020
7896461
testing: replace @flaky with @pytest.mark.flaky [(#3496)](https://git…
Apr 25, 2020
5d15715
chore(deps): update dependency pillow to v7.1.2 [(#3557)](https://git…
renovate-bot Apr 26, 2020
fbe33c4
chore(deps): update dependency google-cloud-storage to v1.28.0 [(#326…
renovate-bot Apr 29, 2020
974370a
[vision] fix: add timeout for LRO result and mark it as flaky [(#3684…
May 4, 2020
893b31b
[vision] fix: mark a test as flaky [(#3709)](https://github.com/Googl…
May 8, 2020
1c1ed33
chore: some lint fixes [(#3751)](https://github.com/GoogleCloudPlatfo…
May 13, 2020
4c8a4ca
[vision] testing: retry upon errors [(#3764)](https://github.com/Goog…
May 15, 2020
2811453
[vision] testing: re-enable test_async_detect_document [(#3761)](http…
May 15, 2020
0f70993
chore(deps): update dependency google-cloud-storage to v1.28.1 [(#378…
renovate-bot May 19, 2020
c32bf86
Replace GCLOUD_PROJECT with GOOGLE_CLOUD_PROJECT. [(#4022)](https://g…
kurtisvg Jun 9, 2020
aab5f17
chore(deps): update dependency google-cloud-storage to v1.29.0 [(#404…
renovate-bot Jun 19, 2020
8115ae7
chore(deps): update dependency pillow to v7.2.0 [(#4208)](https://git…
renovate-bot Jun 30, 2020
5f1468f
testing(vision): use different ids for test functions [(#4227)](https…
Jul 6, 2020
0bd8fcb
chore(deps): update dependency pytest to v5.4.3 [(#4279)](https://git…
renovate-bot Jul 12, 2020
22b2c43
Update dependency flaky to v3.7.0 [(#4300)](https://github.com/Google…
renovate-bot Jul 16, 2020
42ddaa8
Update dependency google-cloud-storage to v1.30.0
renovate-bot Jul 29, 2020
8f7af37
Update dependency pytest to v6 [(#4390)](https://github.com/GoogleClo…
renovate-bot Aug 1, 2020
8204e60
feat: fixed doc string comment mismatch in Product Search [(#4432)](h…
Aug 4, 2020
a530cbc
Resolved merge conflicts in requirements.txt files
engelke Aug 10, 2020
58119a6
chore(deps): update dependency google-cloud-storage to v1.31.0 [(#456…
renovate-bot Aug 27, 2020
7b56da8
Merge branch 'snippets-samples' into add-snippets-samples
arithmetic1728 Sep 10, 2020
292476b
chore: update templates
arithmetic1728 Sep 10, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
@@ -0,0 +1,8 @@
# Code owners file.
# This file controls who is tagged for review for any given pull request.
#
# For syntax help see:
# https://help.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners#codeowners-syntax


/samples/**/*.py @telpirion @sirtorry @googleapis/python-samples-owners
1 change: 0 additions & 1 deletion .github/snippet-bot.yml
@@ -1 +0,0 @@

3 changes: 2 additions & 1 deletion .gitignore
Expand Up @@ -46,6 +46,7 @@ pip-log.txt
# Built documentation
docs/_build
bigquery/docs/generated
docs.metadata

# Virtual environment
env/
Expand All @@ -57,4 +58,4 @@ system_tests/local_test_setup

# Make sure a generated file isn't accidentally committed.
pylintrc
pylintrc.test
pylintrc.test
8 changes: 7 additions & 1 deletion .kokoro/build.sh
Expand Up @@ -36,4 +36,10 @@ python3.6 -m pip uninstall --yes --quiet nox-automation
python3.6 -m pip install --upgrade --quiet nox
python3.6 -m nox --version

python3.6 -m nox
# If NOX_SESSION is set, it only runs the specified session,
# otherwise run all the sessions.
if [[ -n "${NOX_SESSION:-}" ]]; then
python3.6 -m nox -s "${NOX_SESSION:-}"
else
python3.6 -m nox
fi
98 changes: 98 additions & 0 deletions .kokoro/docker/docs/Dockerfile
@@ -0,0 +1,98 @@
# Copyright 2020 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.

from ubuntu:20.04

ENV DEBIAN_FRONTEND noninteractive

# Ensure local Python is preferred over distribution Python.
ENV PATH /usr/local/bin:$PATH

# Install dependencies.
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
apt-transport-https \
build-essential \
ca-certificates \
curl \
dirmngr \
git \
gpg-agent \
graphviz \
libbz2-dev \
libdb5.3-dev \
libexpat1-dev \
libffi-dev \
liblzma-dev \
libreadline-dev \
libsnappy-dev \
libssl-dev \
libsqlite3-dev \
portaudio19-dev \
redis-server \
software-properties-common \
ssh \
sudo \
tcl \
tcl-dev \
tk \
tk-dev \
uuid-dev \
wget \
zlib1g-dev \
&& add-apt-repository universe \
&& apt-get update \
&& apt-get -y install jq \
&& apt-get clean autoclean \
&& apt-get autoremove -y \
&& rm -rf /var/lib/apt/lists/* \
&& rm -f /var/cache/apt/archives/*.deb


COPY fetch_gpg_keys.sh /tmp
# Install the desired versions of Python.
RUN set -ex \
&& export GNUPGHOME="$(mktemp -d)" \
&& echo "disable-ipv6" >> "${GNUPGHOME}/dirmngr.conf" \
&& /tmp/fetch_gpg_keys.sh \
&& for PYTHON_VERSION in 3.7.8 3.8.5; do \
wget --no-check-certificate -O python-${PYTHON_VERSION}.tar.xz "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz" \
&& wget --no-check-certificate -O python-${PYTHON_VERSION}.tar.xz.asc "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc" \
&& gpg --batch --verify python-${PYTHON_VERSION}.tar.xz.asc python-${PYTHON_VERSION}.tar.xz \
&& rm -r python-${PYTHON_VERSION}.tar.xz.asc \
&& mkdir -p /usr/src/python-${PYTHON_VERSION} \
&& tar -xJC /usr/src/python-${PYTHON_VERSION} --strip-components=1 -f python-${PYTHON_VERSION}.tar.xz \
&& rm python-${PYTHON_VERSION}.tar.xz \
&& cd /usr/src/python-${PYTHON_VERSION} \
&& ./configure \
--enable-shared \
# This works only on Python 2.7 and throws a warning on every other
# version, but seems otherwise harmless.
--enable-unicode=ucs4 \
--with-system-ffi \
--without-ensurepip \
&& make -j$(nproc) \
&& make install \
&& ldconfig \
; done \
&& rm -rf "${GNUPGHOME}" \
&& rm -rf /usr/src/python* \
&& rm -rf ~/.cache/

RUN wget -O /tmp/get-pip.py 'https://bootstrap.pypa.io/get-pip.py' \
&& python3.7 /tmp/get-pip.py \
&& python3.8 /tmp/get-pip.py \
&& rm /tmp/get-pip.py

CMD ["python3.7"]
45 changes: 45 additions & 0 deletions .kokoro/docker/docs/fetch_gpg_keys.sh
@@ -0,0 +1,45 @@
#!/bin/bash
# Copyright 2020 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.

# A script to fetch gpg keys with retry.
# Avoid jinja parsing the file.
#

function retry {
if [[ "${#}" -le 1 ]]; then
echo "Usage: ${0} retry_count commands.."
exit 1
fi
local retries=${1}
local command="${@:2}"
until [[ "${retries}" -le 0 ]]; do
$command && return 0
if [[ $? -ne 0 ]]; then
echo "command failed, retrying"
((retries--))
fi
done
return 1
}

# 3.6.9, 3.7.5 (Ned Deily)
retry 3 gpg --keyserver ha.pool.sks-keyservers.net --recv-keys \
0D96DF4D4110E5C43FBFB17F2D347EA6AA65421D

# 3.8.0 (Łukasz Langa)
retry 3 gpg --keyserver ha.pool.sks-keyservers.net --recv-keys \
E3FF2839C048B25C084DEBE9B26995E310250568

#
21 changes: 19 additions & 2 deletions .kokoro/docs/common.cfg
Expand Up @@ -11,12 +11,12 @@ action {
gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline"

# Use the trampoline script to run in docker.
build_file: "python-vision/.kokoro/trampoline.sh"
build_file: "python-vision/.kokoro/trampoline_v2.sh"

# Configure the docker image for kokoro-trampoline.
env_vars: {
key: "TRAMPOLINE_IMAGE"
value: "gcr.io/cloud-devrel-kokoro-resources/python-multi"
value: "gcr.io/cloud-devrel-kokoro-resources/python-lib-docs"
}
env_vars: {
key: "TRAMPOLINE_BUILD_FILE"
Expand All @@ -28,6 +28,23 @@ env_vars: {
value: "docs-staging"
}

env_vars: {
key: "V2_STAGING_BUCKET"
value: "docs-staging-v2-staging"
}

# It will upload the docker image after successful builds.
env_vars: {
key: "TRAMPOLINE_IMAGE_UPLOAD"
value: "true"
}

# It will always build the docker image.
env_vars: {
key: "TRAMPOLINE_DOCKERFILE"
value: ".kokoro/docker/docs/Dockerfile"
}

# Fetch the token needed for reporting release status to GitHub
before_action {
fetch_keystore {
Expand Down
17 changes: 17 additions & 0 deletions .kokoro/docs/docs-presubmit.cfg
@@ -0,0 +1,17 @@
# Format: //devtools/kokoro/config/proto/build.proto

env_vars: {
key: "STAGING_BUCKET"
value: "gcloud-python-test"
}

env_vars: {
key: "V2_STAGING_BUCKET"
value: "gcloud-python-test"
}

# We only upload the image in the main `docs` build.
env_vars: {
key: "TRAMPOLINE_IMAGE_UPLOAD"
value: "false"
}
39 changes: 24 additions & 15 deletions .kokoro/publish-docs.sh
Expand Up @@ -18,26 +18,16 @@ set -eo pipefail
# Disable buffering, so that the logs stream through.
export PYTHONUNBUFFERED=1

cd github/python-vision

# Remove old nox
python3.6 -m pip uninstall --yes --quiet nox-automation
export PATH="${HOME}/.local/bin:${PATH}"

# Install nox
python3.6 -m pip install --upgrade --quiet nox
python3.6 -m nox --version
python3 -m pip install --user --upgrade --quiet nox
python3 -m nox --version

# build docs
nox -s docs

python3 -m pip install gcp-docuploader

# install a json parser
sudo apt-get update
sudo apt-get -y install software-properties-common
sudo add-apt-repository universe
sudo apt-get update
sudo apt-get -y install jq
python3 -m pip install --user gcp-docuploader

# create metadata
python3 -m docuploader create-metadata \
Expand All @@ -52,4 +42,23 @@ python3 -m docuploader create-metadata \
cat docs.metadata

# upload docs
python3 -m docuploader upload docs/_build/html --metadata-file docs.metadata --staging-bucket docs-staging
python3 -m docuploader upload docs/_build/html --metadata-file docs.metadata --staging-bucket "${STAGING_BUCKET}"


# docfx yaml files
nox -s docfx

# create metadata.
python3 -m docuploader create-metadata \
--name=$(jq --raw-output '.name // empty' .repo-metadata.json) \
--version=$(python3 setup.py --version) \
--language=$(jq --raw-output '.language // empty' .repo-metadata.json) \
--distribution-name=$(python3 setup.py --name) \
--product-page=$(jq --raw-output '.product_documentation // empty' .repo-metadata.json) \
--github-repository=$(jq --raw-output '.repo // empty' .repo-metadata.json) \
--issue-tracker=$(jq --raw-output '.issue_tracker // empty' .repo-metadata.json)

cat docs.metadata

# upload docs
python3 -m docuploader upload docs/_build/html/docfx_yaml --metadata-file docs.metadata --destination-prefix docfx --staging-bucket "${V2_STAGING_BUCKET}"