From 71ce74a74f33bbe43faf857a129f70272445d0c9 Mon Sep 17 00:00:00 2001 From: Abubakar Abid Date: Mon, 3 Apr 2023 17:38:23 -0700 Subject: [PATCH 01/17] release action --- .github/workflows/deploy-client-pypi.yml | 38 ++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 .github/workflows/deploy-client-pypi.yml diff --git a/.github/workflows/deploy-client-pypi.yml b/.github/workflows/deploy-client-pypi.yml new file mode 100644 index 0000000000000..25159b0f5fc8e --- /dev/null +++ b/.github/workflows/deploy-client-pypi.yml @@ -0,0 +1,38 @@ +# This workflow will upload a Python Package using Twine when a release is created +# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries + +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. + +name: Upload Python Package + +on: + workflow_dispatch: + pull_request: + types: closed + branches: + - main + paths: + - 'client/python/gradio_client/version.txt' + +jobs: + deploy: + if: github.event.pull_request.merged == true || github.event.action == '' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Install Python + uses: actions/setup-python@v3 + with: + python-version: '3.x' + - name: Check new pypi version + run: python scripts/check_pypi.py + - name: Install build tool dependencies + run: python -m pip install build + - name: Publish package + uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29 + with: + user: __token__ + password: ${{ secrets.PYPI_GRADIO_CLIENT_PASSWORD }} From d7dc7675c02a765dfd5240d51b3d7a6ab53d0678 Mon Sep 17 00:00:00 2001 From: Abubakar Abid Date: Mon, 3 Apr 2023 17:48:58 -0700 Subject: [PATCH 02/17] fixes --- .github/workflows/deploy-client-pypi.yml | 2 +- client/python/scripts/check_pypi.py | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 client/python/scripts/check_pypi.py diff --git a/.github/workflows/deploy-client-pypi.yml b/.github/workflows/deploy-client-pypi.yml index 25159b0f5fc8e..29507baf0ee30 100644 --- a/.github/workflows/deploy-client-pypi.yml +++ b/.github/workflows/deploy-client-pypi.yml @@ -28,7 +28,7 @@ jobs: with: python-version: '3.x' - name: Check new pypi version - run: python scripts/check_pypi.py + run: python client/python/scripts/check_pypi.py - name: Install build tool dependencies run: python -m pip install build - name: Publish package diff --git a/client/python/scripts/check_pypi.py b/client/python/scripts/check_pypi.py new file mode 100644 index 0000000000000..3e5f8a3a8bcd1 --- /dev/null +++ b/client/python/scripts/check_pypi.py @@ -0,0 +1,16 @@ +import json +import sys +import urllib.request +from pathlib import Path + +version_file = Path(__file__).parent / "gradio_client" / "version.txt" +version = version_file.read_text(encoding='utf8').strip() + +with urllib.request.urlopen("https://pypi.org/pypi/gradio_client/json") as url: + releases = json.load(url)["releases"] + +if version in releases: + print(f"Version {version} already exists on PyPI") + sys.exit(1) +else: + print(f"Version {version} does not exist on PyPI") From ae5406e26e6e17ad3740ddb400d0c127a2f18859 Mon Sep 17 00:00:00 2001 From: Abubakar Abid Date: Mon, 3 Apr 2023 18:11:07 -0700 Subject: [PATCH 03/17] name --- .github/workflows/deploy-client-pypi.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy-client-pypi.yml b/.github/workflows/deploy-client-pypi.yml index 29507baf0ee30..e5627777f3229 100644 --- a/.github/workflows/deploy-client-pypi.yml +++ b/.github/workflows/deploy-client-pypi.yml @@ -6,7 +6,7 @@ # separate terms of service, privacy policy, and support # documentation. -name: Upload Python Package +name: Upload Gradio Client Python Package on: workflow_dispatch: From 88033afea236e5ffea48dee8b0016e9f3b2bb30a Mon Sep 17 00:00:00 2001 From: Abubakar Abid Date: Mon, 3 Apr 2023 18:15:35 -0700 Subject: [PATCH 04/17] Update version.txt --- client/python/gradio_client/version.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/python/gradio_client/version.txt b/client/python/gradio_client/version.txt index 99d85ecdbb7b6..8ce4d5b28143f 100644 --- a/client/python/gradio_client/version.txt +++ b/client/python/gradio_client/version.txt @@ -1 +1 @@ -0.0.6 \ No newline at end of file +0.0.6b1 From c4b46601989646b390a9f3b5dc4a6cd720dc9aa4 Mon Sep 17 00:00:00 2001 From: Abubakar Abid Date: Mon, 3 Apr 2023 18:15:51 -0700 Subject: [PATCH 05/17] Update version.txt --- client/python/gradio_client/version.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/python/gradio_client/version.txt b/client/python/gradio_client/version.txt index 8ce4d5b28143f..c249ba1e996c1 100644 --- a/client/python/gradio_client/version.txt +++ b/client/python/gradio_client/version.txt @@ -1 +1 @@ -0.0.6b1 +0.0.6b2 From 19e5ee951e92339cd596676e8fee3fd8ad8600d2 Mon Sep 17 00:00:00 2001 From: Abubakar Abid Date: Mon, 3 Apr 2023 18:22:12 -0700 Subject: [PATCH 06/17] update --- client/python/gradio_client/version.txt | 2 +- client/python/scripts/check_pypi.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/client/python/gradio_client/version.txt b/client/python/gradio_client/version.txt index 99d85ecdbb7b6..691a6cc45c565 100644 --- a/client/python/gradio_client/version.txt +++ b/client/python/gradio_client/version.txt @@ -1 +1 @@ -0.0.6 \ No newline at end of file +0.0.6b3 \ No newline at end of file diff --git a/client/python/scripts/check_pypi.py b/client/python/scripts/check_pypi.py index 3e5f8a3a8bcd1..208171c63e6a2 100644 --- a/client/python/scripts/check_pypi.py +++ b/client/python/scripts/check_pypi.py @@ -3,7 +3,7 @@ import urllib.request from pathlib import Path -version_file = Path(__file__).parent / "gradio_client" / "version.txt" +version_file = Path(__file__).parent.parent / "gradio_client" / "version.txt" version = version_file.read_text(encoding='utf8').strip() with urllib.request.urlopen("https://pypi.org/pypi/gradio_client/json") as url: From 37bc6a52e1b83b8afbdcd8896bd99c603784616e Mon Sep 17 00:00:00 2001 From: Abubakar Abid Date: Mon, 3 Apr 2023 18:26:35 -0700 Subject: [PATCH 07/17] fixes --- .github/workflows/deploy-client-pypi.yml | 5 +++-- client/python/gradio_client/version.txt | 2 +- client/python/scripts/upload_pypi.sh | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/deploy-client-pypi.yml b/.github/workflows/deploy-client-pypi.yml index e5627777f3229..7c6adcb5bcafc 100644 --- a/.github/workflows/deploy-client-pypi.yml +++ b/.github/workflows/deploy-client-pypi.yml @@ -29,8 +29,9 @@ jobs: python-version: '3.x' - name: Check new pypi version run: python client/python/scripts/check_pypi.py - - name: Install build tool dependencies - run: python -m pip install build + - name: Build pypi package + run: | + client/python/scripts/upload_pypi.sh - name: Publish package uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29 with: diff --git a/client/python/gradio_client/version.txt b/client/python/gradio_client/version.txt index 691a6cc45c565..1e68d3966bbe3 100644 --- a/client/python/gradio_client/version.txt +++ b/client/python/gradio_client/version.txt @@ -1 +1 @@ -0.0.6b3 \ No newline at end of file +0.0.6b4 \ No newline at end of file diff --git a/client/python/scripts/upload_pypi.sh b/client/python/scripts/upload_pypi.sh index 02b7ea57ca147..46b743de8e5b2 100644 --- a/client/python/scripts/upload_pypi.sh +++ b/client/python/scripts/upload_pypi.sh @@ -1,8 +1,8 @@ #!/bin/bash +set -e cd "$(dirname ${0})/.." python -m pip install build twine rm -rf dist/* -python -m build -twine upload dist/* \ No newline at end of file +python -m build \ No newline at end of file From 654c8ff6110212239cd4ff49bb35bed74a21a7e9 Mon Sep 17 00:00:00 2001 From: Abubakar Abid Date: Mon, 3 Apr 2023 18:27:15 -0700 Subject: [PATCH 08/17] version --- client/python/gradio_client/version.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/python/gradio_client/version.txt b/client/python/gradio_client/version.txt index 1e68d3966bbe3..68d73663de564 100644 --- a/client/python/gradio_client/version.txt +++ b/client/python/gradio_client/version.txt @@ -1 +1 @@ -0.0.6b4 \ No newline at end of file +0.0.6b5 \ No newline at end of file From f380dcadfd596ec0ee9898b062adad9335389aba Mon Sep 17 00:00:00 2001 From: Abubakar Abid Date: Mon, 3 Apr 2023 18:28:28 -0700 Subject: [PATCH 09/17] rename --- .github/workflows/deploy-client-pypi.yml | 2 +- client/python/scripts/{upload_pypi.sh => build_pypi.sh} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename client/python/scripts/{upload_pypi.sh => build_pypi.sh} (100%) diff --git a/.github/workflows/deploy-client-pypi.yml b/.github/workflows/deploy-client-pypi.yml index 7c6adcb5bcafc..6ca7b34538a2d 100644 --- a/.github/workflows/deploy-client-pypi.yml +++ b/.github/workflows/deploy-client-pypi.yml @@ -31,7 +31,7 @@ jobs: run: python client/python/scripts/check_pypi.py - name: Build pypi package run: | - client/python/scripts/upload_pypi.sh + client/python/scripts/build_pypi.sh - name: Publish package uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29 with: diff --git a/client/python/scripts/upload_pypi.sh b/client/python/scripts/build_pypi.sh similarity index 100% rename from client/python/scripts/upload_pypi.sh rename to client/python/scripts/build_pypi.sh From d5e92f799dc0b3f78c50bcd5a43cc55fb0a7a22d Mon Sep 17 00:00:00 2001 From: Abubakar Abid Date: Mon, 3 Apr 2023 18:32:01 -0700 Subject: [PATCH 10/17] action --- client/python/scripts/build_pypi.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 client/python/scripts/build_pypi.sh diff --git a/client/python/scripts/build_pypi.sh b/client/python/scripts/build_pypi.sh old mode 100644 new mode 100755 From e366ba9295322651efe20fb24f224fea50910d71 Mon Sep 17 00:00:00 2001 From: Abubakar Abid Date: Mon, 3 Apr 2023 18:34:56 -0700 Subject: [PATCH 11/17] fix token --- .github/workflows/deploy-client-pypi.yml | 2 +- client/python/gradio_client/version.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy-client-pypi.yml b/.github/workflows/deploy-client-pypi.yml index 6ca7b34538a2d..026f851aeced0 100644 --- a/.github/workflows/deploy-client-pypi.yml +++ b/.github/workflows/deploy-client-pypi.yml @@ -36,4 +36,4 @@ jobs: uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29 with: user: __token__ - password: ${{ secrets.PYPI_GRADIO_CLIENT_PASSWORD }} + password: ${{ secrets.PYPI_GRADIO_CLIENT_TOKEN }} diff --git a/client/python/gradio_client/version.txt b/client/python/gradio_client/version.txt index 68d73663de564..f1415af9e3f25 100644 --- a/client/python/gradio_client/version.txt +++ b/client/python/gradio_client/version.txt @@ -1 +1 @@ -0.0.6b5 \ No newline at end of file +0.0.6b6 \ No newline at end of file From 431273e4f6a1c6e240f8541035d560b8c2f30a0d Mon Sep 17 00:00:00 2001 From: Abubakar Abid Date: Mon, 3 Apr 2023 18:44:06 -0700 Subject: [PATCH 12/17] custom dir --- .github/workflows/deploy-client-pypi.yml | 1 + client/python/gradio_client/version.txt | 2 +- client/python/scripts/build_pypi.sh | 5 +++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/deploy-client-pypi.yml b/.github/workflows/deploy-client-pypi.yml index 026f851aeced0..a724500471295 100644 --- a/.github/workflows/deploy-client-pypi.yml +++ b/.github/workflows/deploy-client-pypi.yml @@ -37,3 +37,4 @@ jobs: with: user: __token__ password: ${{ secrets.PYPI_GRADIO_CLIENT_TOKEN }} + packages-dir: client/python/dist diff --git a/client/python/gradio_client/version.txt b/client/python/gradio_client/version.txt index f1415af9e3f25..8d80742b90d86 100644 --- a/client/python/gradio_client/version.txt +++ b/client/python/gradio_client/version.txt @@ -1 +1 @@ -0.0.6b6 \ No newline at end of file +0.0.6b7 \ No newline at end of file diff --git a/client/python/scripts/build_pypi.sh b/client/python/scripts/build_pypi.sh index 46b743de8e5b2..6eaf498843a45 100755 --- a/client/python/scripts/build_pypi.sh +++ b/client/python/scripts/build_pypi.sh @@ -3,6 +3,7 @@ set -e cd "$(dirname ${0})/.." -python -m pip install build twine +python3 -m pip install build twine rm -rf dist/* -python -m build \ No newline at end of file +rm -rf build/* +python3 -m build From f0c788998fe9ef358ddf928226c7b689df50b18f Mon Sep 17 00:00:00 2001 From: Abubakar Abid Date: Mon, 3 Apr 2023 18:49:49 -0700 Subject: [PATCH 13/17] fixes --- .github/workflows/deploy-client-pypi.yml | 2 +- client/python/gradio_client/version.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy-client-pypi.yml b/.github/workflows/deploy-client-pypi.yml index a724500471295..0bdfa6cb9c9b8 100644 --- a/.github/workflows/deploy-client-pypi.yml +++ b/.github/workflows/deploy-client-pypi.yml @@ -37,4 +37,4 @@ jobs: with: user: __token__ password: ${{ secrets.PYPI_GRADIO_CLIENT_TOKEN }} - packages-dir: client/python/dist + packages_dir: client/python/dist diff --git a/client/python/gradio_client/version.txt b/client/python/gradio_client/version.txt index 8d80742b90d86..b127b334ff954 100644 --- a/client/python/gradio_client/version.txt +++ b/client/python/gradio_client/version.txt @@ -1 +1 @@ -0.0.6b7 \ No newline at end of file +0.0.6b8 \ No newline at end of file From f751cb2729f88c5043df329900dc6afed7e871e3 Mon Sep 17 00:00:00 2001 From: Abubakar Abid Date: Tue, 4 Apr 2023 11:01:50 -0700 Subject: [PATCH 14/17] change password --- .github/workflows/deploy-client-pypi.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy-client-pypi.yml b/.github/workflows/deploy-client-pypi.yml index 0bdfa6cb9c9b8..c195ed588fdb2 100644 --- a/.github/workflows/deploy-client-pypi.yml +++ b/.github/workflows/deploy-client-pypi.yml @@ -35,6 +35,6 @@ jobs: - name: Publish package uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29 with: - user: __token__ - password: ${{ secrets.PYPI_GRADIO_CLIENT_TOKEN }} + user: aabid93 + password: ${{ secrets.PYPI_AABID93 }} packages_dir: client/python/dist From abbcbefed7b46cf380154a69ac3af67d585bca7d Mon Sep 17 00:00:00 2001 From: Abubakar Abid Date: Tue, 4 Apr 2023 11:11:36 -0700 Subject: [PATCH 15/17] revert back to token --- .github/workflows/deploy-client-pypi.yml | 2 +- client/python/gradio_client/version.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy-client-pypi.yml b/.github/workflows/deploy-client-pypi.yml index c195ed588fdb2..dd09b0e4584d7 100644 --- a/.github/workflows/deploy-client-pypi.yml +++ b/.github/workflows/deploy-client-pypi.yml @@ -36,5 +36,5 @@ jobs: uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29 with: user: aabid93 - password: ${{ secrets.PYPI_AABID93 }} + password: ${{ secrets.PYPI_GRADIO_CLIENT_TOKEN }} packages_dir: client/python/dist diff --git a/client/python/gradio_client/version.txt b/client/python/gradio_client/version.txt index ff2251c425a1b..2c75c89249c95 100644 --- a/client/python/gradio_client/version.txt +++ b/client/python/gradio_client/version.txt @@ -1 +1 @@ -0.0.6b9 +0.0.6b10 From 0ccf2c64303af600ce92ee8d9d0a28c2b54449f8 Mon Sep 17 00:00:00 2001 From: Abubakar Abid Date: Tue, 4 Apr 2023 11:17:45 -0700 Subject: [PATCH 16/17] scripts --- client/python/scripts/check_pypi.py | 2 +- client/python/scripts/format.sh | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/client/python/scripts/check_pypi.py b/client/python/scripts/check_pypi.py index 208171c63e6a2..e8f588743b026 100644 --- a/client/python/scripts/check_pypi.py +++ b/client/python/scripts/check_pypi.py @@ -4,7 +4,7 @@ from pathlib import Path version_file = Path(__file__).parent.parent / "gradio_client" / "version.txt" -version = version_file.read_text(encoding='utf8').strip() +version = version_file.read_text(encoding="utf8").strip() with urllib.request.urlopen("https://pypi.org/pypi/gradio_client/json") as url: releases = json.load(url)["releases"] diff --git a/client/python/scripts/format.sh b/client/python/scripts/format.sh index 35a7e0b27afc3..788ba9969b757 100644 --- a/client/python/scripts/format.sh +++ b/client/python/scripts/format.sh @@ -3,5 +3,5 @@ cd "$(dirname ${0})/.." echo "Formatting the client library.. Our style follows the Black code style." -ruff --fix test gradio_client -black test gradio_client +ruff --fix . +black . From ed682332f1583f0aed57ad628f65a56af15ed9f3 Mon Sep 17 00:00:00 2001 From: Abubakar Abid Date: Tue, 4 Apr 2023 13:28:49 -0700 Subject: [PATCH 17/17] remove twine --- .github/workflows/deploy-client-pypi.yml | 2 +- client/python/scripts/build_pypi.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy-client-pypi.yml b/.github/workflows/deploy-client-pypi.yml index dd09b0e4584d7..8dce76aa5a85d 100644 --- a/.github/workflows/deploy-client-pypi.yml +++ b/.github/workflows/deploy-client-pypi.yml @@ -1,4 +1,4 @@ -# This workflow will upload a Python Package using Twine when a release is created +# This workflow will upload a Python Package when a release is created # For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries # This workflow uses actions that are not certified by GitHub. diff --git a/client/python/scripts/build_pypi.sh b/client/python/scripts/build_pypi.sh index 6eaf498843a45..23e635237237d 100755 --- a/client/python/scripts/build_pypi.sh +++ b/client/python/scripts/build_pypi.sh @@ -3,7 +3,7 @@ set -e cd "$(dirname ${0})/.." -python3 -m pip install build twine +python3 -m pip install build rm -rf dist/* rm -rf build/* python3 -m build