From d296ad79baf10e54634d9fb0e5d331c038a9d05a Mon Sep 17 00:00:00 2001 From: Sebastien Binet Date: Tue, 25 Jan 2022 12:20:14 +0100 Subject: [PATCH 1/3] all: update Dockerfiles to alpine-3.15 Fixes #235. Signed-off-by: Sebastien Binet --- Dockerfile | 32 +++++++++++++++++--------------- Dockerfile.DS | 47 ++++++++++++++++++++++++----------------------- 2 files changed, 41 insertions(+), 38 deletions(-) diff --git a/Dockerfile b/Dockerfile index be568ac..b76fe01 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM alpine:3.5 +FROM alpine:3.15 MAINTAINER dwhitena # Add gophernotes @@ -9,30 +9,32 @@ RUN set -x \ # install python and dependencies && apk update \ && apk --no-cache \ - --repository http://dl-4.alpinelinux.org/alpine/v3.7/community \ - --repository http://dl-4.alpinelinux.org/alpine/v3.7/main \ + --repository http://dl-4.alpinelinux.org/alpine/v3.15/community \ + --repository http://dl-4.alpinelinux.org/alpine/v3.15/main \ --arch=x86_64 add \ ca-certificates \ - python3 \ - su-exec \ + g++ \ gcc \ git \ - py3-zmq \ + libffi-dev \ pkgconfig \ - zeromq-dev \ + python3 python3-dev \ + py3-pip \ + py3-pyzmq \ + mercurial \ + mesa-dev \ musl-dev \ - && pip3 install --upgrade pip==9.0.3 \ - && ln -s /usr/bin/python3.6 /usr/bin/python \ + su-exec \ + zeromq-dev \ + && pip3 install --upgrade pip==21.3.1 \ + && ln -s /usr/bin/python3.9 /usr/bin/python \ ## install Go - && apk --update-cache --allow-untrusted \ - --repository http://dl-4.alpinelinux.org/alpine/edge/community \ + && apk --update-cache \ --arch=x86_64 add \ go \ ## jupyter notebook && ln -s /usr/include/locale.h /usr/include/xlocale.h \ - ### fix pyzmq to v16.0.2 as that is what is distributed with py3-zmq - ### pin down the tornado and ipykernel to compatible versions - && pip3 install jupyter notebook pyzmq==16.0.2 tornado==4.5.3 ipykernel==4.8.1 \ + && pip3 install jupyter notebook pyzmq tornado ipykernel \ ## install gophernotes && cd /go/src/github.com/gopherdata/gophernotes \ && GOPATH=/go GO111MODULE=on go install . \ @@ -41,7 +43,7 @@ RUN set -x \ && cp -r ./kernel/* ~/.local/share/jupyter/kernels/gophernotes \ && cd - \ ## clean - && find /usr/lib/python3.6 -name __pycache__ | xargs rm -r \ + && find /usr/lib/python3.9 -name __pycache__ | xargs rm -r \ && rm -rf \ /root/.[acpw]* \ ipaexg00301* \ diff --git a/Dockerfile.DS b/Dockerfile.DS index f6c690d..f04651a 100644 --- a/Dockerfile.DS +++ b/Dockerfile.DS @@ -1,4 +1,4 @@ -FROM alpine:3.5 +FROM alpine:3.15 MAINTAINER dwhitena # Add gophernotes @@ -9,31 +9,32 @@ RUN set -x \ # install python and dependencies && apk update \ && apk --no-cache \ - --repository http://dl-4.alpinelinux.org/alpine/v3.7/community \ - --repository http://dl-4.alpinelinux.org/alpine/v3.7/main \ + --repository http://dl-4.alpinelinux.org/alpine/v3.15/community \ + --repository http://dl-4.alpinelinux.org/alpine/v3.15/main \ --arch=x86_64 add \ - python3 \ - su-exec \ - gcc \ + ca-certificates \ g++ \ + gcc \ git \ - py3-zmq \ + libffi-dev \ pkgconfig \ - zeromq-dev \ - musl-dev \ + python3 python3-dev \ + py3-pip \ + py3-pyzmq \ mercurial \ - && pip3 install --upgrade pip==9.0.3 \ - && cp /usr/bin/python3.6 /usr/bin/python \ + mesa-dev \ + musl-dev \ + su-exec \ + zeromq-dev \ + && pip3 install --upgrade pip==21.3.1 \ + && cp /usr/bin/python3.9 /usr/bin/python \ ## install Go - && apk --update-cache --allow-untrusted \ - --repository http://dl-4.alpinelinux.org/alpine/edge/community \ + && apk --update-cache \ --arch=x86_64 add \ go \ ## jupyter notebook && ln -s /usr/include/locale.h /usr/include/xlocale.h \ - ### fix pyzmq to v16.0.2 as that is what is distributed with py3-zmq - ### pin down the tornado and ipykernel to compatible versions - && pip3 install jupyter notebook pyzmq==16.0.2 tornado==4.5.3 ipykernel==4.8.1 \ + && pip3 install jupyter notebook pyzmq tornado ipykernel \ ## install gophernotes && cd /go/src/github.com/gopherdata/gophernotes \ && export GOPATH=/go \ @@ -44,14 +45,14 @@ RUN set -x \ && cp -r ./kernel/* ~/.local/share/jupyter/kernels/gophernotes \ && cd - \ ## get the relevant Go packages - && go get -insecure gonum.org/v1/plot/... \ - && go get -insecure gonum.org/v1/gonum/... \ - && go get github.com/kniren/gota/... \ + && go get gonum.org/v1/plot/... \ + && go get gonum.org/v1/gonum/... \ + && go get github.com/go-gota/gota/... \ && go get github.com/sajari/regression \ && go get github.com/sjwhitworth/golearn/... \ - && go get -insecure go-hep.org/x/hep/csvutil/... \ - && go get -insecure go-hep.org/x/hep/fit \ - && go get -insecure go-hep.org/x/hep/hbook \ + && go get go-hep.org/x/hep/csvutil/... \ + && go get go-hep.org/x/hep/fit \ + && go get go-hep.org/x/hep/hbook \ && go get github.com/montanaflynn/stats \ && go get github.com/boltdb/bolt \ && go get github.com/patrickmn/go-cache \ @@ -64,7 +65,7 @@ RUN set -x \ && go get github.com/pkg/errors \ && go get github.com/stretchr/testify/assert \ ## clean - && find /usr/lib/python3.6 -name __pycache__ | xargs rm -r \ + && find /usr/lib/python3.9 -name __pycache__ | xargs rm -r \ && rm -rf \ /root/.[acpw]* \ ipaexg00301* \ From 207d9c95354d5deeefffe2324980adf0f427cf26 Mon Sep 17 00:00:00 2001 From: Sebastien Binet Date: Tue, 25 Jan 2022 12:30:42 +0100 Subject: [PATCH 2/3] all: drop x/xerrors Signed-off-by: Sebastien Binet --- go.mod | 1 - kernel.go | 11 +++++------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/go.mod b/go.mod index 8d16974..b70ee67 100644 --- a/go.mod +++ b/go.mod @@ -6,5 +6,4 @@ require ( github.com/cosmos72/gomacro v0.0.0-20220109145729-f19a149b3738 github.com/go-zeromq/zmq4 v0.13.0 github.com/gofrs/uuid v4.2.0+incompatible - golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 ) diff --git a/kernel.go b/kernel.go index d360a74..7bf770d 100644 --- a/kernel.go +++ b/kernel.go @@ -18,7 +18,6 @@ import ( "time" "github.com/go-zeromq/zmq4" - "golang.org/x/xerrors" "github.com/cosmos72/gomacro/ast2" "github.com/cosmos72/gomacro/base" @@ -285,27 +284,27 @@ func prepareSockets(connInfo ConnectionInfo) (SocketGroup, error) { address := fmt.Sprintf("%v://%v:%%v", connInfo.Transport, connInfo.IP) err = sg.ShellSocket.Socket.Listen(fmt.Sprintf(address, connInfo.ShellPort)) if err != nil { - return sg, xerrors.Errorf("could not listen on shell-socket: %w", err) + return sg, fmt.Errorf("could not listen on shell-socket: %w", err) } err = sg.ControlSocket.Socket.Listen(fmt.Sprintf(address, connInfo.ControlPort)) if err != nil { - return sg, xerrors.Errorf("could not listen on control-socket: %w", err) + return sg, fmt.Errorf("could not listen on control-socket: %w", err) } err = sg.StdinSocket.Socket.Listen(fmt.Sprintf(address, connInfo.StdinPort)) if err != nil { - return sg, xerrors.Errorf("could not listen on stdin-socket: %w", err) + return sg, fmt.Errorf("could not listen on stdin-socket: %w", err) } err = sg.IOPubSocket.Socket.Listen(fmt.Sprintf(address, connInfo.IOPubPort)) if err != nil { - return sg, xerrors.Errorf("could not listen on iopub-socket: %w", err) + return sg, fmt.Errorf("could not listen on iopub-socket: %w", err) } err = sg.HBSocket.Socket.Listen(fmt.Sprintf(address, connInfo.HBPort)) if err != nil { - return sg, xerrors.Errorf("could not listen on hbeat-socket: %w", err) + return sg, fmt.Errorf("could not listen on hbeat-socket: %w", err) } // Set the message signing key. From 128e262cf95ac4dc86786941320f89370a57595e Mon Sep 17 00:00:00 2001 From: Sebastien Binet Date: Tue, 25 Jan 2022 12:32:50 +0100 Subject: [PATCH 3/3] kernel: tame go vet This CL replaces a fmt.Fprint call with a string containing a couple of %, with a direct call to io.Writer.Write to not confuse 'go vet' that thought we weren't calling fmt.Fprintf. Signed-off-by: Sebastien Binet --- kernel.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel.go b/kernel.go index 7bf770d..30b7df6 100644 --- a/kernel.go +++ b/kernel.go @@ -755,7 +755,7 @@ $ls -l panic(fmt.Errorf("special command %s: expecting a single argument 'on' or 'off', found: %q", cmd, arg)) } case "%help": - fmt.Fprint(outerr.out, help) + outerr.out.Write([]byte(help)) default: panic(fmt.Errorf("unknown special command: %q\n%s", line, help)) }