Skip to content

Commit 5928fdd

Browse files
chore(python): use ubuntu 22.04 in docs image (#53)
Source-Link: googleapis/synthtool@f15cc72 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:bc5eed3804aec2f05fad42aacf973821d9500c174015341f721a984a0825b6fd
1 parent 762b1bf commit 5928fdd

File tree

3 files changed

+44
-7
lines changed

3 files changed

+44
-7
lines changed

packages/google-cloud-common/.github/.OwlBot.lock.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@
1313
# limitations under the License.
1414
docker:
1515
image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest
16-
digest: sha256:8a5d3f6a2e43ed8293f34e06a2f56931d1e88a2694c3bb11b15df4eb256ad163
17-
# created: 2022-04-06T10:30:21.687684602Z
16+
digest: sha256:bc5eed3804aec2f05fad42aacf973821d9500c174015341f721a984a0825b6fd
17+
# created: 2022-04-21T15:43:16.246106921Z

packages/google-cloud-common/.kokoro/docker/docs/Dockerfile

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
from ubuntu:20.04
15+
from ubuntu:22.04
1616

1717
ENV DEBIAN_FRONTEND noninteractive
1818

@@ -60,8 +60,24 @@ RUN apt-get update \
6060
&& rm -rf /var/lib/apt/lists/* \
6161
&& rm -f /var/cache/apt/archives/*.deb
6262

63+
###################### Install python 3.8.11
64+
65+
# Download python 3.8.11
66+
RUN wget https://www.python.org/ftp/python/3.8.11/Python-3.8.11.tgz
67+
68+
# Extract files
69+
RUN tar -xvf Python-3.8.11.tgz
70+
71+
# Install python 3.8.11
72+
RUN ./Python-3.8.11/configure --enable-optimizations
73+
RUN make altinstall
74+
75+
###################### Install pip
6376
RUN wget -O /tmp/get-pip.py 'https://bootstrap.pypa.io/get-pip.py' \
64-
&& python3.8 /tmp/get-pip.py \
77+
&& python3 /tmp/get-pip.py \
6578
&& rm /tmp/get-pip.py
6679

80+
# Test pip
81+
RUN python3 -m pip
82+
6783
CMD ["python3.8"]

packages/google-cloud-common/noxfile.py

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@
2525
import nox
2626

2727
BLACK_VERSION = "black==22.3.0"
28-
BLACK_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"]
28+
ISORT_VERSION = "isort==5.10.1"
29+
LINT_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"]
2930

3031
DEFAULT_PYTHON_VERSION = "3.8"
3132

@@ -83,7 +84,7 @@ def lint(session):
8384
session.run(
8485
"black",
8586
"--check",
86-
*BLACK_PATHS,
87+
*LINT_PATHS,
8788
)
8889
session.run("flake8", "google", "tests")
8990

@@ -94,7 +95,27 @@ def blacken(session):
9495
session.install(BLACK_VERSION)
9596
session.run(
9697
"black",
97-
*BLACK_PATHS,
98+
*LINT_PATHS,
99+
)
100+
101+
102+
@nox.session(python=DEFAULT_PYTHON_VERSION)
103+
def format(session):
104+
"""
105+
Run isort to sort imports. Then run black
106+
to format code to uniform standard.
107+
"""
108+
session.install(BLACK_VERSION, ISORT_VERSION)
109+
# Use the --fss option to sort imports using strict alphabetical order.
110+
# See https://pycqa.github.io/isort/docs/configuration/options.html#force-sort-within-sections
111+
session.run(
112+
"isort",
113+
"--fss",
114+
*LINT_PATHS,
115+
)
116+
session.run(
117+
"black",
118+
*LINT_PATHS,
98119
)
99120

100121

0 commit comments

Comments
 (0)