You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by ar...@apache.org on 2022/05/20 23:19:09 UTC

[tvm] 02/05: Add docker container for freezing python deps.

This is an automated email from the ASF dual-hosted git repository.

areusch pushed a commit to branch areusch/freeze-dependencies
in repository https://gitbox.apache.org/repos/asf/tvm.git

commit 888cf3918ae4d3a0ab5298e0374eccd54d5ba9d8
Author: Andrew Reusch <ar...@gmail.com>
AuthorDate: Thu May 19 15:02:29 2022 -0700

    Add docker container for freezing python deps.
---
 docker/Dockerfile.ci_py_deps                | 28 ++++++++++++++++++++
 docker/install/ubuntu1804_install_python.sh | 39 +++++++++++++++++++++------
 docker/python/bootstrap-requirements.txt    | 41 +++++++++++++++++++++++++++++
 3 files changed, 100 insertions(+), 8 deletions(-)

diff --git a/docker/Dockerfile.ci_py_deps b/docker/Dockerfile.ci_py_deps
new file mode 100644
index 0000000000..998d09b1eb
--- /dev/null
+++ b/docker/Dockerfile.ci_py_deps
@@ -0,0 +1,28 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you 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.
+
+# CI docker CPU env
+FROM ubuntu:18.04
+
+RUN apt update --fix-missing && apt install sudo
+
+COPY python/bootstrap-requirements.txt /install/python/bootstrap-requirements.txt
+COPY install/ubuntu1804_install_python.sh /install/ubuntu1804_install_python.sh
+RUN bash /install/ubuntu1804_install_python.sh
+
+# Globally disable pip cache
+RUN pip config set global.no-cache-dir false
diff --git a/docker/install/ubuntu1804_install_python.sh b/docker/install/ubuntu1804_install_python.sh
index 94d316199d..f5a40a03a5 100755
--- a/docker/install/ubuntu1804_install_python.sh
+++ b/docker/install/ubuntu1804_install_python.sh
@@ -19,6 +19,7 @@
 set -e
 set -u
 set -o pipefail
+set -x
 
 
 cleanup() {
@@ -35,12 +36,34 @@ apt-get install -y software-properties-common
 apt-get install -y python3.7 python3.7-dev python3-pip
 update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.7 1
 
-# Pin pip and setuptools versions
-# Hashes generated via:
-#   $ pip download <package>==<version>
-#   $ pip hash --algorithm sha512 <package>.whl
-cat <<EOF > base-requirements.txt
-pip==19.3.1 --hash=sha256:6917c65fc3769ecdc61405d3dfd97afdedd75808d200b2838d7d961cebc0c2c7
-setuptools==58.4.0 --hash=sha256:e8b1d3127a0441fb99a130bcc3c2bf256c2d3ead3aba8fd400e5cbbaf788e036
+function download_hash() {
+    cat >/tmp/hash-bootstrap-packages.py <<EOF
+import os
+import os.path
+import subprocess
+import pkginfo
+
+for f in sorted(os.scandir("."), key=lambda x: x.name):
+  if not f.is_file():
+    continue
+  p = pkginfo.get_metadata(f.name)
+  if not p:
+    continue
+  print(f"{p.name}=={p.version} {subprocess.check_output(['pip3', 'hash', '-a', 'sha256', p.filename], encoding='utf-8').split()[1]} # {f.name}")
 EOF
-pip3 install -r base-requirements.txt
+    mkdir packages && cd packages
+    pip3 install -U "$@"
+    pip3 download pip poetry setuptools
+    python3 /tmp/hash-bootstrap-packages.py
+    exit 2 # make docker build stop
+}
+
+# Install bootstrap packages. You can update these with the following procedure:
+# 1. Uncomment the line below, then attempt torebuild the base images (it will fail).
+# 2. New hashes should be printed in the terminal log from each docker build. Copy these hashes into the
+#    the arch-appropriate file in docker/python/bootstrap-requirements/
+# download_hash pip setuptools pkginfo
+
+pip3 install -U pip -c /install/python/bootstrap-requirements.txt  # Update pip to match version used to produce base-requirements.txt
+pip3 config set global.no-cache-dir false
+pip3 install -r /install/python/bootstrap-requirements.txt -c /install/python/bootstrap-requirements.txt
diff --git a/docker/python/bootstrap-requirements.txt b/docker/python/bootstrap-requirements.txt
new file mode 100644
index 0000000000..ddf1ea2571
--- /dev/null
+++ b/docker/python/bootstrap-requirements.txt
@@ -0,0 +1,41 @@
+CacheControl==0.12.11 --hash=sha256:2c75d6a8938cb1933c75c50184549ad42728a27e9f6b92fd677c3151aa72555b # CacheControl-0.12.11-py2.py3-none-any.whl
+SecretStorage==3.3.2 --hash=sha256:755dc845b6ad76dcbcbc07ea3da75ae54bb1ea529eb72d15f83d26499a5df319 # SecretStorage-3.3.2-py3-none-any.whl
+cachy==0.3.0 --hash=sha256:338ca09c8860e76b275aff52374330efedc4d5a5e45dc1c5b539c1ead0786fe7 # cachy-0.3.0-py2.py3-none-any.whl
+certifi==2021.10.8 --hash=sha256:d62a0163eb4c2344ac042ab2bdf75399a71a2d8c7d47eac2e2ee91b9d6339569 # certifi-2021.10.8-py2.py3-none-any.whl
+cffi==1.15.0 --hash=sha256:fd8a250edc26254fe5b33be00402e6d287f562b6a5b2152dec302fa15bb3e997 # cffi-1.15.0-cp37-cp37m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
+charset-normalizer==2.0.12 --hash=sha256:6881edbebdb17b39b4eaaa821b438bf6eddffb4468cf344f09f89def34a8b1df # charset_normalizer-2.0.12-py3-none-any.whl
+cleo==0.8.1 --hash=sha256:141cda6dc94a92343be626bb87a0b6c86ae291dfc732a57bf04310d4b4201753 # cleo-0.8.1-py2.py3-none-any.whl
+clikit==0.6.2 --hash=sha256:71268e074e68082306e23d7369a7b99f824a0ef926e55ba2665e911f7208489e # clikit-0.6.2-py2.py3-none-any.whl
+crashtest==0.3.1 --hash=sha256:300f4b0825f57688b47b6d70c6a31de33512eb2fa1ac614f780939aa0cf91680 # crashtest-0.3.1-py3-none-any.whl
+cryptography==36.0.2 --hash=sha256:c2c5250ff0d36fd58550252f54915776940e4e866f38f3a7866d92b32a654b86 # cryptography-36.0.2-cp36-abi3-manylinux_2_24_x86_64.whl
+distlib==0.3.4 --hash=sha256:6564fe0a8f51e734df6333d08b8b94d4ea8ee6b99b5ed50613f731fd4089f34b # distlib-0.3.4-py2.py3-none-any.whl
+filelock==3.6.0 --hash=sha256:f8314284bfffbdcfa0ff3d7992b023d4c628ced6feb957351d4c48d059f56bc0 # filelock-3.6.0-py3-none-any.whl
+html5lib==1.1 --hash=sha256:0d78f8fde1c230e99fe37986a60526d7049ed4bf8a9fadbad5f00e22e58e041d # html5lib-1.1-py2.py3-none-any.whl
+idna==3.3 --hash=sha256:84d9dd047ffa80596e0f246e2eab0b391788b0503584e8945f2368256d2735ff # idna-3.3-py3-none-any.whl
+importlib-metadata==1.7.0 --hash=sha256:dc15b2969b4ce36305c51eebe62d418ac7791e9a157911d58bfb1f9ccd8e2070 # importlib_metadata-1.7.0-py2.py3-none-any.whl
+jeepney==0.8.0 --hash=sha256:c0a454ad016ca575060802ee4d590dd912e35c122fa04e70306de3d076cce755 # jeepney-0.8.0-py3-none-any.whl
+keyring==22.3.0 --hash=sha256:2bc8363ebdd63886126a012057a85c8cb6e143877afa02619ac7dbc9f38a207b # keyring-22.3.0-py3-none-any.whl
+lockfile==0.12.2 --hash=sha256:6c3cb24f344923d30b2785d5ad75182c8ea7ac1b6171b08657258ec7429d50fa # lockfile-0.12.2-py2.py3-none-any.whl
+msgpack==1.0.3 --hash=sha256:9c0903bd93cbd34653dd63bbfcb99d7539c372795201f39d16fdfde4418de43a # msgpack-1.0.3-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
+packaging==20.9 --hash=sha256:67714da7f7bc052e064859c05c595155bd1ee9f69f76557e21f051443c20947a # packaging-20.9-py2.py3-none-any.whl
+pastel==0.2.1 --hash=sha256:4349225fcdf6c2bb34d483e523475de5bb04a5c10ef711263452cb37d7dd4364 # pastel-0.2.1-py2.py3-none-any.whl
+pexpect==4.8.0 --hash=sha256:0b48a55dcb3c05f3329815901ea4fc1537514d6ba867a152b581d69ae3710937 # pexpect-4.8.0-py2.py3-none-any.whl
+pip==22.0.4 --hash=sha256:c6aca0f2f081363f689f041d90dab2a07a9a07fb840284db2218117a52da800b # pip-22.0.4-py3-none-any.whl
+pkginfo==1.8.2 --hash=sha256:c24c487c6a7f72c66e816ab1796b96ac6c3d14d49338293d2141664330b55ffc # pkginfo-1.8.2-py2.py3-none-any.whl
+platformdirs==2.5.2 --hash=sha256:027d8e83a2d7de06bbac4e5ef7e023c02b863d7ea5d079477e722bb41ab25788 # platformdirs-2.5.2-py3-none-any.whl
+poetry==1.1.13 --hash=sha256:52deb0792a2e801967ba9c4cdb39b56fe68b0b5cd3f195b004bef603db9d51a7 # poetry-1.1.13-py2.py3-none-any.whl
+poetry-core==1.0.8 --hash=sha256:54b0fab6f7b313886e547a52f8bf52b8cf43e65b2633c65117f8755289061924 # poetry_core-1.0.8-py2.py3-none-any.whl
+ptyprocess==0.7.0 --hash=sha256:4b41f3967fce3af57cc7e94b888626c18bf37a083e3651ca8feeb66d492fef35 # ptyprocess-0.7.0-py2.py3-none-any.whl
+pycparser==2.21 --hash=sha256:8ee45429555515e1f6b185e78100aea234072576aa43ab53aefcae078162fca9 # pycparser-2.21-py2.py3-none-any.whl
+pylev==1.4.0 --hash=sha256:7b2e2aa7b00e05bb3f7650eb506fc89f474f70493271a35c242d9a92188ad3dd # pylev-1.4.0-py2.py3-none-any.whl
+pyparsing==3.0.8 --hash=sha256:ef7b523f6356f763771559412c0d7134753f037822dad1b16945b7b846f7ad06 # pyparsing-3.0.8-py3-none-any.whl
+requests==2.27.1 --hash=sha256:f22fa1e554c9ddfd16e6e41ac79759e17be9e492b3587efa038054674760e72d # requests-2.27.1-py2.py3-none-any.whl
+requests-toolbelt==0.9.1 --hash=sha256:380606e1d10dc85c3bd47bf5a6095f815ec007be7a8b69c878507068df059e6f # requests_toolbelt-0.9.1-py2.py3-none-any.whl
+setuptools==62.1.0 --hash=sha256:26ead7d1f93efc0f8c804d9fafafbe4a44b179580a7105754b245155f9af05a8 # setuptools-62.1.0-py3-none-any.whl
+shellingham==1.4.0 --hash=sha256:536b67a0697f2e4af32ab176c00a50ac2899c5a05e0d8e2dadac8e58888283f9 # shellingham-1.4.0-py2.py3-none-any.whl
+six==1.16.0 --hash=sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254 # six-1.16.0-py2.py3-none-any.whl
+tomlkit==0.10.1 --hash=sha256:3eba517439dcb2f84cf39f4f85fd2c3398309823a3c75ac3e73003638daf7915 # tomlkit-0.10.1-py3-none-any.whl
+urllib3==1.26.9 --hash=sha256:44ece4d53fb1706f667c9bd1c648f5469a2ec925fcf3a776667042d645472c14 # urllib3-1.26.9-py2.py3-none-any.whl
+virtualenv==20.14.1 --hash=sha256:e617f16e25b42eb4f6e74096b9c9e37713cf10bf30168fb4a739f3fa8f898a3a # virtualenv-20.14.1-py2.py3-none-any.whl
+webencodings==0.5.1 --hash=sha256:a0af1213f3c2226497a97e2b3aa01a7e4bee4f403f95be16fc9acd2947514a78 # webencodings-0.5.1-py2.py3-none-any.whl
+zipp==3.8.0 --hash=sha256:c4f6e5bbf48e74f7a38e7cc5b0480ff42b0ae5178957d564d18932525d5cf099 # zipp-3.8.0-py3-none-any.whl