You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by GitBox <gi...@apache.org> on 2020/05/27 17:09:19 UTC

[GitHub] [beam] tvalentyn commented on a change in pull request #11828: [BEAM-10106] Script the deployment of artifacts to pypi

tvalentyn commented on a change in pull request #11828:
URL: https://github.com/apache/beam/pull/11828#discussion_r431285733



##########
File path: release/src/main/scripts/deploy_pypi.sh
##########
@@ -0,0 +1,57 @@
+#!/bin/bash
+#
+#    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.
+#
+
+# This script uploads Python artifacts staged at dist.apache.org to PyPI.
+
+set -e
+
+function clean_up(){
+  echo "Do you want to clean local clone repo? [y|N]"

Review comment:
       How about also print the path that will be cleaned up?

##########
File path: release/src/main/scripts/deploy_pypi.sh
##########
@@ -0,0 +1,57 @@
+#!/bin/bash
+#
+#    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.
+#
+
+# This script uploads Python artifacts staged at dist.apache.org to PyPI.
+
+set -e
+
+function clean_up(){
+  echo "Do you want to clean local clone repo? [y|N]"
+  read confirmation
+  if [[ $confirmation = "y" ]]; then
+    cd ~
+    rm -rf ${LOCAL_CLONE_DIR}
+    echo "Clean up local repo."
+  fi
+}
+
+echo "Enter the release version, e.g. 2.21.0:"
+read RELEASE
+LOCAL_CLONE_DIR="beam_release_${RELEASE}"
+cd ~
+if [[ -d ${LOCAL_CLONE_DIR} ]]; then
+  rm -rf ${LOCAL_CLONE_DIR}

Review comment:
       Let's add a message here that the folder was found, and so it's being deleted.

##########
File path: release/src/main/scripts/deploy_pypi.sh
##########
@@ -0,0 +1,57 @@
+#!/bin/bash
+#
+#    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.
+#
+
+# This script uploads Python artifacts staged at dist.apache.org to PyPI.
+
+set -e
+
+function clean_up(){
+  echo "Do you want to clean local clone repo? [y|N]"
+  read confirmation
+  if [[ $confirmation = "y" ]]; then
+    cd ~
+    rm -rf ${LOCAL_CLONE_DIR}
+    echo "Clean up local repo."

Review comment:
       Nit: Cleaned up local repo.

##########
File path: release/src/main/scripts/deploy_pypi.sh
##########
@@ -0,0 +1,57 @@
+#!/bin/bash
+#
+#    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.
+#
+
+# This script uploads Python artifacts staged at dist.apache.org to PyPI.
+
+set -e
+
+function clean_up(){
+  echo "Do you want to clean local clone repo? [y|N]"
+  read confirmation
+  if [[ $confirmation = "y" ]]; then
+    cd ~
+    rm -rf ${LOCAL_CLONE_DIR}
+    echo "Clean up local repo."
+  fi
+}
+
+echo "Enter the release version, e.g. 2.21.0:"
+read RELEASE
+LOCAL_CLONE_DIR="beam_release_${RELEASE}"
+cd ~
+if [[ -d ${LOCAL_CLONE_DIR} ]]; then
+  rm -rf ${LOCAL_CLONE_DIR}
+fi
+mkdir ${LOCAL_CLONE_DIR}
+cd ${LOCAL_CLONE_DIR}
+
+wget -r --no-parent -A zip,whl "https://dist.apache.org/repos/dist/dev/beam/${RELEASE}/python"
+cd "dist.apache.org/repos/dist/dev/beam/${RELEASE}/python/"
+pip install twine

Review comment:
       Can we do this in a virtual environment? On my machine this would fail with:
   ```
   Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/requests_toolbelt'
   Consider using the `--user` option or check the permissions.
   ```
   

##########
File path: release/src/main/scripts/deploy_pypi.sh
##########
@@ -0,0 +1,57 @@
+#!/bin/bash
+#
+#    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.
+#
+
+# This script uploads Python artifacts staged at dist.apache.org to PyPI.
+
+set -e
+
+function clean_up(){
+  echo "Do you want to clean local clone repo? [y|N]"
+  read confirmation
+  if [[ $confirmation = "y" ]]; then
+    cd ~
+    rm -rf ${LOCAL_CLONE_DIR}
+    echo "Clean up local repo."
+  fi
+}
+
+echo "Enter the release version, e.g. 2.21.0:"
+read RELEASE
+LOCAL_CLONE_DIR="beam_release_${RELEASE}"
+cd ~
+if [[ -d ${LOCAL_CLONE_DIR} ]]; then
+  rm -rf ${LOCAL_CLONE_DIR}
+fi
+mkdir ${LOCAL_CLONE_DIR}
+cd ${LOCAL_CLONE_DIR}
+
+wget -r --no-parent -A zip,whl "https://dist.apache.org/repos/dist/dev/beam/${RELEASE}/python"
+cd "dist.apache.org/repos/dist/dev/beam/${RELEASE}/python/"
+pip install twine
+echo "Will upload the following files to PyPI:"
+ls
+echo "Are the files listed correct? [y|N]"
+read confirmation
+if [[ $confirmation != "y" ]]; then
+  echo "Exit without deploying artifacts to PyPI."
+  clean_up
+  exit
+fi
+twine upload *

Review comment:
       Assuming this a verbose command. If not please add some messages to guide the user what is happening.

##########
File path: release/src/main/scripts/deploy_pypi.sh
##########
@@ -0,0 +1,57 @@
+#!/bin/bash
+#
+#    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.
+#
+
+# This script uploads Python artifacts staged at dist.apache.org to PyPI.
+
+set -e
+
+function clean_up(){
+  echo "Do you want to clean local clone repo? [y|N]"
+  read confirmation
+  if [[ $confirmation = "y" ]]; then
+    cd ~
+    rm -rf ${LOCAL_CLONE_DIR}
+    echo "Clean up local repo."
+  fi
+}
+
+echo "Enter the release version, e.g. 2.21.0:"
+read RELEASE
+LOCAL_CLONE_DIR="beam_release_${RELEASE}"
+cd ~
+if [[ -d ${LOCAL_CLONE_DIR} ]]; then
+  rm -rf ${LOCAL_CLONE_DIR}
+fi
+mkdir ${LOCAL_CLONE_DIR}
+cd ${LOCAL_CLONE_DIR}
+
+wget -r --no-parent -A zip,whl "https://dist.apache.org/repos/dist/dev/beam/${RELEASE}/python"
+cd "dist.apache.org/repos/dist/dev/beam/${RELEASE}/python/"
+pip install twine
+echo "Will upload the following files to PyPI:"
+ls
+echo "Are the files listed correct? [y|N]"
+read confirmation
+if [[ $confirmation != "y" ]]; then
+  echo "Exit without deploying artifacts to PyPI."

Review comment:
       nit: s/Exit/Exiting




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org