Skip to content

Commit b53390d

Browse files
authored
Python upgrade and cleanup (mongodb#1001)
* Bump Python to 3.10.4 * Bump mypy to 0.961 * Change the default Helm location * Adopt kind setup script to the latest version Refreshed with https://kind.sigs.k8s.io/docs/user/local-registry/ * Use Python3 headers * Remove Pipfiles
1 parent 2272a67 commit b53390d

18 files changed

+27
-578
lines changed

Diff for: .action_templates/steps/setup-and-install-python.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
- name: Setup Python
22
uses: actions/setup-python@v2
33
with:
4-
python-version: '3.8'
4+
python-version: '3.10.4'
55
- name: Cache Dependencies
66
uses: actions/cache@v2
77
with:

Diff for: .github/workflows/e2e-dispatch.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ jobs:
5555
- name: Setup Python
5656
uses: actions/setup-python@v2
5757
with:
58-
python-version: '3.8'
58+
python-version: '3.10.4'
5959
- name: Cache Dependencies
6060
uses: actions/cache@v2
6161
with:
@@ -91,7 +91,7 @@ jobs:
9191
- name: Setup Python
9292
uses: actions/setup-python@v2
9393
with:
94-
python-version: '3.8'
94+
python-version: '3.10.4'
9595
- name: Cache Dependencies
9696
uses: actions/cache@v2
9797
with:

Diff for: .github/workflows/e2e-fork.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ jobs:
5757
- name: Setup Python
5858
uses: actions/setup-python@v2
5959
with:
60-
python-version: '3.8'
60+
python-version: '3.10.4'
6161
- name: Cache Dependencies
6262
uses: actions/cache@v2
6363
with:
@@ -173,7 +173,7 @@ jobs:
173173
- name: Setup Python
174174
uses: actions/setup-python@v2
175175
with:
176-
python-version: '3.8'
176+
python-version: '3.10.4'
177177
- name: Cache Dependencies
178178
uses: actions/cache@v2
179179
with:

Diff for: .github/workflows/e2e.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ jobs:
6363
- name: Setup Python
6464
uses: actions/setup-python@v2
6565
with:
66-
python-version: '3.8'
66+
python-version: '3.10.4'
6767
- name: Cache Dependencies
6868
uses: actions/cache@v2
6969
with:
@@ -177,7 +177,7 @@ jobs:
177177
- name: Setup Python
178178
uses: actions/setup-python@v2
179179
with:
180-
python-version: '3.8'
180+
python-version: '3.10.4'
181181
- name: Cache Dependencies
182182
uses: actions/cache@v2
183183
with:

Diff for: .github/workflows/release-images.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
- name: Setup Python
2929
uses: actions/setup-python@v2
3030
with:
31-
python-version: '3.8'
31+
python-version: '3.10.4'
3232
architecture: 'x64'
3333

3434
- uses: actions/cache@v2

Diff for: .github/workflows/release-single-image.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
- name: Setup Python
1818
uses: actions/setup-python@v2
1919
with:
20-
python-version: '3.8'
20+
python-version: '3.10.4'
2121
architecture: 'x64'
2222

2323
- uses: actions/cache@v2

Diff for: .gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -96,3 +96,6 @@ Dockerfile.ubuntu-*
9696
diagnostics
9797

9898
!test/test-app/Dockerfile
99+
100+
Pipfile
101+
Pipfile.lock

Diff for: Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ controller-gen:
163163
ifeq (ok,$(shell test -f "$$(which helm)" && echo ok))
164164
HELM=$(shell which helm)
165165
else
166-
HELM=/usr/bin/local/helm
166+
HELM=/usr/local/bin/helm
167167
endif
168168

169169
# Download helm locally if necessary

Diff for: Pipfile

-23
This file was deleted.

Diff for: Pipfile.lock

-532
This file was deleted.

Diff for: docs/contributing.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ python -m pip install -r requirements.txt
115115

116116
* create a python environment and install dependencies.
117117
```bash
118-
pipenv install
118+
pipenv install -r requirements.txt
119119
```
120120

121121
* activate the python environment.

Diff for: mypy.ini

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Global options:
22

33
[mypy]
4-
python_version = 3.7
4+
python_version = 3.10
55
ignore_missing_imports = true
66
disallow_untyped_calls = true
77
disallow_untyped_defs = true

Diff for: requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ jinja2==2.11.3
66
MarkupSafe==2.0.1
77
PyYAML==5.4.1
88
black==22.3.0
9-
mypy==0.782
9+
mypy==0.961
1010
tqdm==v4.49.0
1111
boto3==1.16.21
1212
pymongo==3.11.4

Diff for: scripts/dev/e2e.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22

33
from kubernetes.client.rest import ApiException
44

Diff for: scripts/dev/generate_github_actions.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22
from typing import Dict
33

44
from ghat.template import template_github_action

Diff for: scripts/dev/get_e2e_env_vars.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22
import sys
33
from typing import Dict
44
import os.path

Diff for: scripts/dev/setup_kind_cluster.sh

+7-7
Original file line numberDiff line numberDiff line change
@@ -42,24 +42,24 @@ reg_name='kind-registry'
4242
reg_port='5000'
4343
running="$(docker inspect -f '{{.State.Running}}' "${reg_name}" 2>/dev/null || true)"
4444
if [ "${running}" != 'true' ]; then
45-
docker run \
46-
-d --restart=always -p "${reg_port}:${reg_port}" --name "${reg_name}" --network kind \
47-
registry:2
45+
docker run -d --restart=always -p "127.0.0.1:${reg_port}:5000" --name "${reg_name}" registry:2
4846
fi
4947

50-
# find registry IP inside the kind network
51-
ip="$(docker inspect kind-registry -f '{{.NetworkSettings.Networks.kind.IPAddress}}')"
52-
5348
# create a cluster with the local registry enabled in containerd
5449
cat <<EOF | kind create cluster --name "${cluster_name}" --kubeconfig "${kubeconfig_path}" --config=-
5550
kind: Cluster
5651
apiVersion: kind.x-k8s.io/v1alpha4
5752
containerdConfigPatches:
5853
- |-
5954
[plugins."io.containerd.grpc.v1.cri".registry.mirrors."localhost:${reg_port}"]
60-
endpoint = ["http://${ip}:${reg_port}"]
55+
endpoint = ["http://${reg_name}:${reg_port}"]
6156
EOF
6257

58+
# connect the registry to the cluster network if not already connected
59+
if [ "$(docker inspect -f='{{json .NetworkSettings.Networks.kind}}' "${reg_name}")" = 'null' ]; then
60+
docker network connect "kind" "${reg_name}"
61+
fi
62+
6363
# Document the local registry (from https://kind.sigs.k8s.io/docs/user/local-registry/)
6464
# https://github.com/kubernetes/enhancements/tree/master/keps/sig-cluster-lifecycle/generic/1755-communicating-a-local-registry
6565
cat <<EOF | kubectl apply --kubeconfig "${kubeconfig_path}" -f -

Diff for: tools.go

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//go:build tools
12
// +build tools
23

34
// Place any runtime dependencies as imports in this file.

0 commit comments

Comments
 (0)