Skip to content
This repository was archived by the owner on Mar 6, 2026. It is now read-only.

Commit 8e890e0

Browse files
Merge branch 'remove-unused-files' of https://github.com/googleapis/python-documentai-toolbox into remove-unused-files
2 parents fe7d6ea + e7af3fc commit 8e890e0

File tree

12 files changed

+917
-0
lines changed

12 files changed

+917
-0
lines changed

.kokoro/docker/docs/Dockerfile

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
# Copyright 2024 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
from ubuntu:24.04
16+
17+
ENV DEBIAN_FRONTEND noninteractive
18+
19+
# Ensure local Python is preferred over distribution Python.
20+
ENV PATH /usr/local/bin:$PATH
21+
22+
# Install dependencies.
23+
RUN apt-get update \
24+
&& apt-get install -y --no-install-recommends \
25+
apt-transport-https \
26+
build-essential \
27+
ca-certificates \
28+
curl \
29+
dirmngr \
30+
git \
31+
gpg-agent \
32+
graphviz \
33+
libbz2-dev \
34+
libdb5.3-dev \
35+
libexpat1-dev \
36+
libffi-dev \
37+
liblzma-dev \
38+
libreadline-dev \
39+
libsnappy-dev \
40+
libssl-dev \
41+
libsqlite3-dev \
42+
portaudio19-dev \
43+
redis-server \
44+
software-properties-common \
45+
ssh \
46+
sudo \
47+
tcl \
48+
tcl-dev \
49+
tk \
50+
tk-dev \
51+
uuid-dev \
52+
wget \
53+
zlib1g-dev \
54+
&& add-apt-repository universe \
55+
&& apt-get update \
56+
&& apt-get -y install jq \
57+
&& apt-get clean autoclean \
58+
&& apt-get autoremove -y \
59+
&& rm -rf /var/lib/apt/lists/* \
60+
&& rm -f /var/cache/apt/archives/*.deb
61+
62+
63+
###################### Install python 3.10.14 for docs/docfx session
64+
65+
# Download python 3.10.14
66+
RUN wget https://www.python.org/ftp/python/3.10.14/Python-3.10.14.tgz
67+
68+
# Extract files
69+
RUN tar -xvf Python-3.10.14.tgz
70+
71+
# Install python 3.10.14
72+
RUN ./Python-3.10.14/configure --enable-optimizations
73+
RUN make altinstall
74+
75+
RUN python3.10 -m venv /venv
76+
ENV PATH /venv/bin:$PATH
77+
78+
###################### Install pip
79+
RUN wget -O /tmp/get-pip.py 'https://bootstrap.pypa.io/get-pip.py' \
80+
&& python3 /tmp/get-pip.py \
81+
&& rm /tmp/get-pip.py
82+
83+
# Test pip
84+
RUN python3 -m pip
85+
86+
# Install build requirements
87+
COPY requirements.txt /requirements.txt
88+
RUN python3 -m pip install --require-hashes -r requirements.txt
89+
90+
CMD ["python3.10"]
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
nox
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#
2+
# This file is autogenerated by pip-compile with Python 3.9
3+
# by the following command:
4+
#
5+
# pip-compile --allow-unsafe --generate-hashes requirements.in
6+
#
7+
argcomplete==3.4.0 \
8+
--hash=sha256:69a79e083a716173e5532e0fa3bef45f793f4e61096cf52b5a42c0211c8b8aa5 \
9+
--hash=sha256:c2abcdfe1be8ace47ba777d4fce319eb13bf8ad9dace8d085dcad6eded88057f
10+
# via nox
11+
colorlog==6.8.2 \
12+
--hash=sha256:3e3e079a41feb5a1b64f978b5ea4f46040a94f11f0e8bbb8261e3dbbeca64d44 \
13+
--hash=sha256:4dcbb62368e2800cb3c5abd348da7e53f6c362dda502ec27c560b2e58a66bd33
14+
# via nox
15+
distlib==0.3.8 \
16+
--hash=sha256:034db59a0b96f8ca18035f36290806a9a6e6bd9d1ff91e45a7f172eb17e51784 \
17+
--hash=sha256:1530ea13e350031b6312d8580ddb6b27a104275a31106523b8f123787f494f64
18+
# via virtualenv
19+
filelock==3.15.4 \
20+
--hash=sha256:2207938cbc1844345cb01a5a95524dae30f0ce089eba5b00378295a17e3e90cb \
21+
--hash=sha256:6ca1fffae96225dab4c6eaf1c4f4f28cd2568d3ec2a44e15a08520504de468e7
22+
# via virtualenv
23+
nox==2024.4.15 \
24+
--hash=sha256:6492236efa15a460ecb98e7b67562a28b70da006ab0be164e8821177577c0565 \
25+
--hash=sha256:ecf6700199cdfa9e5ea0a41ff5e6ef4641d09508eda6edb89d9987864115817f
26+
# via -r requirements.in
27+
packaging==24.1 \
28+
--hash=sha256:026ed72c8ed3fcce5bf8950572258698927fd1dbda10a5e981cdf0ac37f4f002 \
29+
--hash=sha256:5b8f2217dbdbd2f7f384c41c628544e6d52f2d0f53c6d0c3ea61aa5d1d7ff124
30+
# via nox
31+
platformdirs==4.2.2 \
32+
--hash=sha256:2d7a1657e36a80ea911db832a8a6ece5ee53d8de21edd5cc5879af6530b1bfee \
33+
--hash=sha256:38b7b51f512eed9e84a22788b4bce1de17c0adb134d6becb09836e37d8654cd3
34+
# via virtualenv
35+
tomli==2.0.1 \
36+
--hash=sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc \
37+
--hash=sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f
38+
# via nox
39+
virtualenv==20.26.3 \
40+
--hash=sha256:4c43a2a236279d9ea36a0d76f98d84bd6ca94ac4e0f4a3b9d46d05e10fea542a \
41+
--hash=sha256:8cc4a31139e796e9a7de2cd5cf2489de1217193116a8fd42328f1bd65f434589
42+
# via nox

.kokoro/docs/common.cfg

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Format: //devtools/kokoro/config/proto/build.proto
2+
3+
# Build logs will be here
4+
action {
5+
define_artifacts {
6+
regex: "**/*sponge_log.xml"
7+
}
8+
}
9+
10+
# Download trampoline resources.
11+
gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline"
12+
13+
# Use the trampoline script to run in docker.
14+
build_file: "python-documentai-toolbox/.kokoro/trampoline_v2.sh"
15+
16+
# Configure the docker image for kokoro-trampoline.
17+
env_vars: {
18+
key: "TRAMPOLINE_IMAGE"
19+
value: "gcr.io/cloud-devrel-kokoro-resources/python-lib-docs"
20+
}
21+
env_vars: {
22+
key: "TRAMPOLINE_BUILD_FILE"
23+
value: "github/python-documentai-toolbox/.kokoro/publish-docs.sh"
24+
}
25+
26+
env_vars: {
27+
key: "STAGING_BUCKET"
28+
value: "docs-staging"
29+
}
30+
31+
env_vars: {
32+
key: "V2_STAGING_BUCKET"
33+
# Push google cloud library docs to the Cloud RAD bucket `docs-staging-v2`
34+
value: "docs-staging-v2"
35+
}
36+
37+
# It will upload the docker image after successful builds.
38+
env_vars: {
39+
key: "TRAMPOLINE_IMAGE_UPLOAD"
40+
value: "true"
41+
}
42+
43+
# It will always build the docker image.
44+
env_vars: {
45+
key: "TRAMPOLINE_DOCKERFILE"
46+
value: ".kokoro/docker/docs/Dockerfile"
47+
}
48+
49+
# Fetch the token needed for reporting release status to GitHub
50+
before_action {
51+
fetch_keystore {
52+
keystore_resource {
53+
keystore_config_id: 73713
54+
keyname: "yoshi-automation-github-key"
55+
}
56+
}
57+
}
58+
59+
before_action {
60+
fetch_keystore {
61+
keystore_resource {
62+
keystore_config_id: 73713
63+
keyname: "docuploader_service_account"
64+
}
65+
}
66+
}

.kokoro/docs/docs-presubmit.cfg

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Format: //devtools/kokoro/config/proto/build.proto
2+
3+
env_vars: {
4+
key: "STAGING_BUCKET"
5+
value: "gcloud-python-test"
6+
}
7+
8+
env_vars: {
9+
key: "V2_STAGING_BUCKET"
10+
value: "gcloud-python-test"
11+
}
12+
13+
# We only upload the image in the main `docs` build.
14+
env_vars: {
15+
key: "TRAMPOLINE_IMAGE_UPLOAD"
16+
value: "false"
17+
}
18+
19+
env_vars: {
20+
key: "TRAMPOLINE_BUILD_FILE"
21+
value: "github/python-documentai-toolbox/.kokoro/build.sh"
22+
}
23+
24+
# Only run this nox session.
25+
env_vars: {
26+
key: "NOX_SESSION"
27+
value: "docs docfx"
28+
}

.kokoro/docs/docs.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Format: //devtools/kokoro/config/proto/build.proto

.kokoro/publish-docs.sh

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
#!/bin/bash
2+
# Copyright 2024 Google LLC
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# https://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
set -eo pipefail
17+
18+
# Disable buffering, so that the logs stream through.
19+
export PYTHONUNBUFFERED=1
20+
21+
export PATH="${HOME}/.local/bin:${PATH}"
22+
23+
# Install nox
24+
python3 -m pip install --require-hashes -r .kokoro/requirements.txt
25+
python3 -m nox --version
26+
27+
# build docs
28+
nox -s docs
29+
30+
# create metadata
31+
python3 -m docuploader create-metadata \
32+
--name=$(jq --raw-output '.name // empty' .repo-metadata.json) \
33+
--version=$(python3 setup.py --version) \
34+
--language=$(jq --raw-output '.language // empty' .repo-metadata.json) \
35+
--distribution-name=$(python3 setup.py --name) \
36+
--product-page=$(jq --raw-output '.product_documentation // empty' .repo-metadata.json) \
37+
--github-repository=$(jq --raw-output '.repo // empty' .repo-metadata.json) \
38+
--issue-tracker=$(jq --raw-output '.issue_tracker // empty' .repo-metadata.json)
39+
40+
cat docs.metadata
41+
42+
# upload docs
43+
python3 -m docuploader upload docs/_build/html --metadata-file docs.metadata --staging-bucket "${STAGING_BUCKET}"
44+
45+
46+
# docfx yaml files
47+
nox -s docfx
48+
49+
# create metadata.
50+
python3 -m docuploader create-metadata \
51+
--name=$(jq --raw-output '.name // empty' .repo-metadata.json) \
52+
--version=$(python3 setup.py --version) \
53+
--language=$(jq --raw-output '.language // empty' .repo-metadata.json) \
54+
--distribution-name=$(python3 setup.py --name) \
55+
--product-page=$(jq --raw-output '.product_documentation // empty' .repo-metadata.json) \
56+
--github-repository=$(jq --raw-output '.repo // empty' .repo-metadata.json) \
57+
--issue-tracker=$(jq --raw-output '.issue_tracker // empty' .repo-metadata.json)
58+
59+
cat docs.metadata
60+
61+
# upload docs
62+
python3 -m docuploader upload docs/_build/html/docfx_yaml --metadata-file docs.metadata --destination-prefix docfx --staging-bucket "${V2_STAGING_BUCKET}"

.kokoro/release.sh

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/bin/bash
2+
# Copyright 2024 Google LLC
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# https://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
set -eo pipefail
17+
18+
# Start the releasetool reporter
19+
python3 -m pip install --require-hashes -r github/python-documentai-toolbox/.kokoro/requirements.txt
20+
python3 -m releasetool publish-reporter-script > /tmp/publisher-script; source /tmp/publisher-script
21+
22+
# Disable buffering, so that the logs stream through.
23+
export PYTHONUNBUFFERED=1
24+
25+
# Move into the package, build the distribution and upload.
26+
TWINE_PASSWORD=$(cat "${KOKORO_KEYSTORE_DIR}/73713_google-cloud-pypi-token-keystore-1")
27+
cd github/python-documentai-toolbox
28+
python3 setup.py sdist bdist_wheel
29+
twine upload --username __token__ --password "${TWINE_PASSWORD}" dist/*

.kokoro/release/common.cfg

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Format: //devtools/kokoro/config/proto/build.proto
2+
3+
# Build logs will be here
4+
action {
5+
define_artifacts {
6+
regex: "**/*sponge_log.xml"
7+
}
8+
}
9+
10+
# Download trampoline resources.
11+
gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline"
12+
13+
# Use the trampoline script to run in docker.
14+
build_file: "python-documentai-toolbox/.kokoro/trampoline.sh"
15+
16+
# Configure the docker image for kokoro-trampoline.
17+
env_vars: {
18+
key: "TRAMPOLINE_IMAGE"
19+
value: "gcr.io/cloud-devrel-kokoro-resources/python-multi"
20+
}
21+
env_vars: {
22+
key: "TRAMPOLINE_BUILD_FILE"
23+
value: "github/python-documentai-toolbox/.kokoro/release.sh"
24+
}
25+
26+
# Fetch PyPI password
27+
before_action {
28+
fetch_keystore {
29+
keystore_resource {
30+
keystore_config_id: 73713
31+
keyname: "google-cloud-pypi-token-keystore-1"
32+
}
33+
}
34+
}
35+
36+
# Tokens needed to report release status back to GitHub
37+
env_vars: {
38+
key: "SECRET_MANAGER_KEYS"
39+
value: "releasetool-publish-reporter-app,releasetool-publish-reporter-googleapis-installation,releasetool-publish-reporter-pem"
40+
}
41+
42+
# Store the packages we uploaded to PyPI. That way, we have a record of exactly
43+
# what we published, which we can use to generate SBOMs and attestations.
44+
action {
45+
define_artifacts {
46+
regex: "github/python-documentai-toolbox/**/*.tar.gz"
47+
strip_prefix: "github/python-documentai-toolbox"
48+
}
49+
}

.kokoro/release/release.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Format: //devtools/kokoro/config/proto/build.proto

0 commit comments

Comments
 (0)