Skip to content

Commit

Permalink
chore: template updates (#403)
Browse files Browse the repository at this point in the history
This PR was generated using Autosynth. 🌈

Synth log will be available here:
https://source.cloud.google.com/results/invocations/1cb8ad84-81d7-41ae-80cc-f275d38cb08c/targets

- [ ] To automatically regenerate this PR, check this box. (May take up to 24 hours.)
  • Loading branch information
yoshi-automation committed Jul 18, 2021
1 parent f1ee346 commit 5c5fc9f
Show file tree
Hide file tree
Showing 20 changed files with 137 additions and 170 deletions.
35 changes: 2 additions & 33 deletions .kokoro/docker/docs/Dockerfile
Expand Up @@ -40,6 +40,7 @@ RUN apt-get update \
libssl-dev \
libsqlite3-dev \
portaudio19-dev \
python3-distutils \
redis-server \
software-properties-common \
ssh \
Expand All @@ -59,40 +60,8 @@ RUN apt-get update \
&& 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"]
CMD ["python3.8"]
45 changes: 0 additions & 45 deletions .kokoro/docker/docs/fetch_gpg_keys.sh

This file was deleted.

8 changes: 3 additions & 5 deletions .kokoro/presubmit/common.cfg
Expand Up @@ -21,9 +21,7 @@ env_vars: {
key: "TRAMPOLINE_IMAGE"
value: "gcr.io/cloud-devrel-kokoro-resources/python-multi"
}

# Obtain environment variables for running Pub/Sub Lite samples tests
env_vars: {
key: "SECRET_MANAGER_KEYS"
value: "python-docs-samples-test-env"
}
key: "TRAMPOLINE_BUILD_FILE"
value: "github/python-pubsub/.kokoro/build.sh"
}
7 changes: 1 addition & 6 deletions .kokoro/presubmit/presubmit.cfg
@@ -1,6 +1 @@
# Format: //devtools/kokoro/config/proto/build.proto

env_vars: {
key: "TRAMPOLINE_BUILD_FILE"
value: "github/python-pubsub/.kokoro/build.sh"
}
# Format: //devtools/kokoro/config/proto/build.proto
40 changes: 40 additions & 0 deletions .kokoro/samples/python3.9/common.cfg
@@ -0,0 +1,40 @@
# Format: //devtools/kokoro/config/proto/build.proto

# Build logs will be here
action {
define_artifacts {
regex: "**/*sponge_log.xml"
}
}

# Specify which tests to run
env_vars: {
key: "RUN_TESTS_SESSION"
value: "py-3.9"
}

# Declare build specific Cloud project.
env_vars: {
key: "BUILD_SPECIFIC_GCLOUD_PROJECT"
value: "python-docs-samples-tests-py39"
}

env_vars: {
key: "TRAMPOLINE_BUILD_FILE"
value: "github/python-pubsub/.kokoro/test-samples.sh"
}

# Configure the docker image for kokoro-trampoline.
env_vars: {
key: "TRAMPOLINE_IMAGE"
value: "gcr.io/cloud-devrel-kokoro-resources/python-samples-testing-docker"
}

# Download secrets for samples
gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/python-docs-samples"

# Download trampoline resources.
gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline"

# Use the trampoline script to run in docker.
build_file: "python-pubsub/.kokoro/trampoline.sh"
6 changes: 6 additions & 0 deletions .kokoro/samples/python3.9/continuous.cfg
@@ -0,0 +1,6 @@
# Format: //devtools/kokoro/config/proto/build.proto

env_vars: {
key: "INSTALL_LIBRARY_FROM_SOURCE"
value: "True"
}
11 changes: 11 additions & 0 deletions .kokoro/samples/python3.9/periodic-head.cfg
@@ -0,0 +1,11 @@
# Format: //devtools/kokoro/config/proto/build.proto

env_vars: {
key: "INSTALL_LIBRARY_FROM_SOURCE"
value: "True"
}

env_vars: {
key: "TRAMPOLINE_BUILD_FILE"
value: "github/python-pubsub/.kokoro/test-samples-against-head.sh"
}
6 changes: 6 additions & 0 deletions .kokoro/samples/python3.9/periodic.cfg
@@ -0,0 +1,6 @@
# Format: //devtools/kokoro/config/proto/build.proto

env_vars: {
key: "INSTALL_LIBRARY_FROM_SOURCE"
value: "False"
}
6 changes: 6 additions & 0 deletions .kokoro/samples/python3.9/presubmit.cfg
@@ -0,0 +1,6 @@
# Format: //devtools/kokoro/config/proto/build.proto

env_vars: {
key: "INSTALL_LIBRARY_FROM_SOURCE"
value: "True"
}
6 changes: 3 additions & 3 deletions .kokoro/test-samples-impl.sh
Expand Up @@ -20,9 +20,9 @@ set -eo pipefail
# Enables `**` to include files nested inside sub-folders
shopt -s globstar

# Exit early if samples directory doesn't exist
if [ ! -d "./samples" ]; then
echo "No tests run. `./samples` not found"
# Exit early if samples don't exist
if ! find samples -name 'requirements.txt' | grep -q .; then
echo "No tests run. './samples/**/requirements.txt' not found"
exit 0
fi

Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Expand Up @@ -16,7 +16,7 @@
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.4.0
rev: v4.0.1
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
Expand All @@ -26,6 +26,6 @@ repos:
hooks:
- id: black
- repo: https://gitlab.com/pycqa/flake8
rev: 3.9.0
rev: 3.9.2
hooks:
- id: flake8
37 changes: 9 additions & 28 deletions CONTRIBUTING.rst
Expand Up @@ -68,15 +68,12 @@ Using ``nox``
We use `nox <https://nox.readthedocs.io/en/latest/>`__ to instrument our tests.

- To test your changes, run unit tests with ``nox``::
$ nox -s unit

$ nox -s unit-2.7
$ nox -s unit-3.8
$ ...
- To run a single unit test::

- Args to pytest can be passed through the nox command separated by a `--`. For
example, to run a single test::
$ nox -s unit-3.9 -- -k <name of test>

$ nox -s unit-3.8 -- -k <name of test>

.. note::

Expand Down Expand Up @@ -143,38 +140,22 @@ Running System Tests
- To run system tests, you can execute::

# Run all system tests
$ nox -s system-3.8
$ nox -s system-2.7
$ nox -s system

# Run a single system test
$ nox -s system-3.8 -- -k <name of test>


.. note::

System tests are only configured to run under Python 2.7 and
Python 3.8. For expediency, we do not run them in older versions
of Python 3.
System tests are only configured to run under Python 3.8.
For expediency, we do not run them in older versions of Python 3.

This alone will not run the tests. You'll need to change some local
auth settings and change some configuration in your project to
run all the tests.

- System tests will be run against an actual project and
so you'll need to provide some environment variables to facilitate
authentication to your project:

- ``GOOGLE_APPLICATION_CREDENTIALS``: The path to a JSON key file;
Such a file can be downloaded directly from the developer's console by clicking
"Generate new JSON key". See private key
`docs <https://cloud.google.com/storage/docs/authentication#generating-a-private-key>`__
for more details.

- Once you have downloaded your json keys, set the environment variable
``GOOGLE_APPLICATION_CREDENTIALS`` to the absolute path of the json file::

$ export GOOGLE_APPLICATION_CREDENTIALS="/Users/<your_username>/path/to/app_credentials.json"

- System tests will be run against an actual project. You should use local credentials from gcloud when possible. See `Best practices for application authentication <https://cloud.google.com/docs/authentication/best-practices-applications#local_development_and_testing_with_the>`__. Some tests require a service account. For those tests see `Authenticating as a service account <https://cloud.google.com/docs/authentication/production>`__.

*************
Test Coverage
Expand Down Expand Up @@ -232,8 +213,8 @@ Supported versions can be found in our ``noxfile.py`` `config`_.
.. _config: https://github.com/googleapis/python-pubsub/blob/master/noxfile.py


We also explicitly decided to support Python 3 beginning with version
3.6. Reasons for this include:
We also explicitly decided to support Python 3 beginning with version 3.6.
Reasons for this include:

- Encouraging use of newest versions of Python 3
- Taking the lead of `prominent`_ open-source `projects`_
Expand Down
13 changes: 7 additions & 6 deletions docs/conf.py
Expand Up @@ -80,9 +80,9 @@
master_doc = "index"

# General information about the project.
project = u"google-cloud-pubsub"
copyright = u"2019, Google"
author = u"Google APIs"
project = "google-cloud-pubsub"
copyright = "2019, Google"
author = "Google APIs"

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
Expand Down Expand Up @@ -281,7 +281,7 @@
(
master_doc,
"google-cloud-pubsub.tex",
u"google-cloud-pubsub Documentation",
"google-cloud-pubsub Documentation",
author,
"manual",
)
Expand Down Expand Up @@ -316,7 +316,7 @@
(
master_doc,
"google-cloud-pubsub",
u"google-cloud-pubsub Documentation",
"google-cloud-pubsub Documentation",
[author],
1,
)
Expand All @@ -335,7 +335,7 @@
(
master_doc,
"google-cloud-pubsub",
u"google-cloud-pubsub Documentation",
"google-cloud-pubsub Documentation",
author,
"google-cloud-pubsub",
"google-cloud-pubsub Library",
Expand Down Expand Up @@ -363,6 +363,7 @@
"google.api_core": ("https://googleapis.dev/python/google-api-core/latest/", None,),
"grpc": ("https://grpc.github.io/grpc/python/", None),
"proto-plus": ("https://proto-plus-python.readthedocs.io/en/latest/", None),
"protobuf": ("https://googleapis.dev/python/protobuf/latest/", None),
}


Expand Down
4 changes: 2 additions & 2 deletions docs/multiprocessing.rst
@@ -1,7 +1,7 @@
.. note::

Because this client uses :mod:`grpcio` library, it is safe to
Because this client uses :mod:`grpc` library, it is safe to
share instances across threads. In multiprocessing scenarios, the best
practice is to create client instances *after* the invocation of
:func:`os.fork` by :class:`multiprocessing.Pool` or
:func:`os.fork` by :class:`multiprocessing.pool.Pool` or
:class:`multiprocessing.Process`.

0 comments on commit 5c5fc9f

Please sign in to comment.