From 5725bc4c7722dc3e02b680a4e1ee294c53d4a865 Mon Sep 17 00:00:00 2001 From: Achille Roussel Date: Mon, 12 Feb 2024 20:02:43 -0800 Subject: [PATCH 01/24] configure the release to PyPI Signed-off-by: Achille Roussel --- .github/workflows/pypi.yml | 36 ++++++++++++++++++++++++++++++++++++ .gitignore | 1 + Makefile | 18 ++++++++++++++---- pyproject.toml | 31 ++++++++++++++++--------------- 4 files changed, 67 insertions(+), 19 deletions(-) create mode 100644 .github/workflows/pypi.yml diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml new file mode 100644 index 00000000..f3a1c99d --- /dev/null +++ b/.github/workflows/pypi.yml @@ -0,0 +1,36 @@ +name: PyPI + +on: + pull_request: + push: + branches: + - main + tags: + - 'v*' + +jobs: + test: + if: {{ github.ref_name != 'main' }} + runs-on: ubuntu-latest + environment: + name: pypi + url: https://pypi.org/p/dispatch-functions + permissions: + id-token: write + steps: + - uses: actions/checkout@v4 + - uses: pypa/gh-action-pypi-publish@release/v1 + with: + repository-url: https://test.pypi.org/legacy/ + + release: + if: {{ github.ref_name == 'main' }} + runs-on: ubuntu-latest + environment: + name: pypi + url: https://pypi.org/p/dispatch-functions + permissions: + id-token: write + steps: + - uses: actions/checkout@v4 + - uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/.gitignore b/.gitignore index e1dea320..1d529437 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ __pycache__ .proto .coverage .coverage-html +dist/ diff --git a/Makefile b/Makefile index 16bfebd6..3d3a2ad6 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.PHONY: install test typecheck unittest dev fmt fmt-check generate clean update-proto coverage +.PHONY: install test typecheck unittest dev fmt fmt-check generate clean update-proto coverage build check push push-test PYTHON := python @@ -50,8 +50,18 @@ generate: .proto/dispatch-sdk $(MAKE) fmt clean: - rm -rf .proto - rm -rf .coverage - rm -rf .coverage-html + $(RM) -rf dist .proto .coverage .coverage-html find . -type f -name '*.pyc' -exec rm {} \; find . -type d -name '__pycache__' -exec rm -r {} \; + +build: + $(PYTHON) -m build + +check: + twine check dist/* + +push: + twine upload dist/* + +push-test: + twine upload -r testpypi dist/* diff --git a/pyproject.toml b/pyproject.toml index e28c3fd4..c0b39905 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,28 +3,29 @@ requires = ["setuptools >= 61.0"] build-backend = "setuptools.build_meta" [project] -name = "dispatch-sdk" +name = "dispatch-functions" +description = "Python SDK for Dispatch Stateful Functions" +readme = "README.md" dynamic = ["version"] requires-python = ">= 3.11" -# TODO: relax dependency versions dependencies = [ - "grpcio==1.60.0", - "protobuf==4.24.0", - "types-protobuf==4.24.0.20240129", - "grpc-stubs", - "http_message_signatures==0.4.4" + "grpcio >= 1.60.0", + "protobuf >= 4.24.0", + "types-protobuf >= 4.24.0.20240129", + "grpc-stubs >= 1.53.0.5", + "http-message-signatures >= 0.4.4" ] [project.optional-dependencies] dev = [ - "black==24.1.0", - "isort==5.13.2", - "mypy==1.8.0", - "fastapi==0.109.0", - "httpx==0.26.0", - "coverage==7.4.1", - "requests==2.31.0", - "types-requests==2.31.0.20240125" + "black >= 24.1.0", + "isort >= 5.13.2", + "mypy >= 1.8.0", + "fastapi >= 0.109.0", + "httpx >= 0.26.0", + "coverage >= 7.4.1", + "requests >= 2.31.0", + "types-requests >= 2.31.0.20240125" ] [tool.setuptools.dynamic] From 07d8cd9ed9192f6d263f227fd09dd58af74e853c Mon Sep 17 00:00:00 2001 From: Achille Roussel Date: Mon, 12 Feb 2024 20:24:28 -0800 Subject: [PATCH 02/24] fix github workflow Signed-off-by: Achille Roussel --- .github/workflows/pypi.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml index f3a1c99d..99e9aae7 100644 --- a/.github/workflows/pypi.yml +++ b/.github/workflows/pypi.yml @@ -10,7 +10,7 @@ on: jobs: test: - if: {{ github.ref_name != 'main' }} + if: ${{ github.ref_name != 'main' }} runs-on: ubuntu-latest environment: name: pypi @@ -24,7 +24,7 @@ jobs: repository-url: https://test.pypi.org/legacy/ release: - if: {{ github.ref_name == 'main' }} + if: ${{ github.ref_name == 'main' }} runs-on: ubuntu-latest environment: name: pypi From bacb69e550fdb16db7bfb555c34ff3c1cd1bc901 Mon Sep 17 00:00:00 2001 From: Achille Roussel Date: Mon, 12 Feb 2024 20:25:58 -0800 Subject: [PATCH 03/24] fix github workflow permissions Signed-off-by: Achille Roussel --- .github/workflows/pypi.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml index 99e9aae7..4d6744d9 100644 --- a/.github/workflows/pypi.yml +++ b/.github/workflows/pypi.yml @@ -8,6 +8,9 @@ on: tags: - 'v*' +permissions: + contents: read + jobs: test: if: ${{ github.ref_name != 'main' }} From 41b21bc68b18783677782c1a806817b1934a5312 Mon Sep 17 00:00:00 2001 From: Achille Roussel Date: Mon, 12 Feb 2024 20:30:35 -0800 Subject: [PATCH 04/24] fix github workflow permissions (2) Signed-off-by: Achille Roussel --- .github/workflows/pypi.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml index 4d6744d9..1827d837 100644 --- a/.github/workflows/pypi.yml +++ b/.github/workflows/pypi.yml @@ -8,9 +8,6 @@ on: tags: - 'v*' -permissions: - contents: read - jobs: test: if: ${{ github.ref_name != 'main' }} @@ -19,6 +16,7 @@ jobs: name: pypi url: https://pypi.org/p/dispatch-functions permissions: + contents: read id-token: write steps: - uses: actions/checkout@v4 @@ -33,6 +31,7 @@ jobs: name: pypi url: https://pypi.org/p/dispatch-functions permissions: + contents: read id-token: write steps: - uses: actions/checkout@v4 From 00831429ada4a96e22d99eaa69046268ac847ce5 Mon Sep 17 00:00:00 2001 From: Achille Roussel Date: Mon, 12 Feb 2024 20:49:58 -0800 Subject: [PATCH 05/24] add build step to workflow Signed-off-by: Achille Roussel --- .github/workflows/pypi.yml | 37 +++++++++++++++++++++++++++++++------ .github/workflows/test.yml | 8 ++++---- 2 files changed, 35 insertions(+), 10 deletions(-) diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml index 1827d837..485e5698 100644 --- a/.github/workflows/pypi.yml +++ b/.github/workflows/pypi.yml @@ -6,11 +6,28 @@ on: branches: - main tags: - - 'v*' + - v* jobs: + build: + runs-on: ubuntu-latest + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.11' + cache: pip + - run: python -m pip install build --user + - run: python -m build + - uses: actions/upload-artifact@v4 + with: + name: dist + path: dist + test: - if: ${{ github.ref_name != 'main' }} + if: !startsWith(github.ref, 'refs/tags/') + needs: + - build runs-on: ubuntu-latest environment: name: pypi @@ -19,20 +36,28 @@ jobs: contents: read id-token: write steps: - - uses: actions/checkout@v4 + - uses: actions/download-artifact@v4 + with: + name: dist + path: dist - uses: pypa/gh-action-pypi-publish@release/v1 with: repository-url: https://test.pypi.org/legacy/ release: - if: ${{ github.ref_name == 'main' }} + if: startsWith(github.ref, 'refs/tags/') + needs: + - build runs-on: ubuntu-latest environment: - name: pypi + name: testpypi url: https://pypi.org/p/dispatch-functions permissions: contents: read id-token: write steps: - - uses: actions/checkout@v4 + - uses: actions/download-artifact@v4 + with: + name: dist + path: dist - uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 75c6b53f..9ebd5266 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,14 +10,14 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python: ["3.11", "3.12"] + python: ['3.11', '3.12'] steps: - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python }} uses: actions/setup-python@v4 with: python-version: ${{ matrix.python }} - cache: 'pip' + cache: pip - run: make dev - run: make test @@ -25,13 +25,13 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python: ["3.12"] + python: ['3.12'] steps: - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python }} uses: actions/setup-python@v4 with: python-version: ${{ matrix.python }} - cache: 'pip' + cache: pip - run: make dev - run: make fmt-check From e1c6a812a98a4b452f007ecf1331696c8de7fe2a Mon Sep 17 00:00:00 2001 From: Achille Roussel Date: Mon, 12 Feb 2024 20:52:02 -0800 Subject: [PATCH 06/24] fix syntax error in pypi.yml Signed-off-by: Achille Roussel --- .github/workflows/pypi.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml index 485e5698..1dba20b5 100644 --- a/.github/workflows/pypi.yml +++ b/.github/workflows/pypi.yml @@ -11,6 +11,9 @@ on: jobs: build: runs-on: ubuntu-latest + permissions: + contents: read + steps: - uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v4 @@ -33,7 +36,6 @@ jobs: name: pypi url: https://pypi.org/p/dispatch-functions permissions: - contents: read id-token: write steps: - uses: actions/download-artifact@v4 @@ -53,7 +55,6 @@ jobs: name: testpypi url: https://pypi.org/p/dispatch-functions permissions: - contents: read id-token: write steps: - uses: actions/download-artifact@v4 From 40d39cb3d4e51eec2bb5c459b59eb4ced0cd672e Mon Sep 17 00:00:00 2001 From: Achille Roussel Date: Mon, 12 Feb 2024 20:59:14 -0800 Subject: [PATCH 07/24] fix syntax error in pypi.yml (2) Signed-off-by: Achille Roussel --- .github/workflows/pypi.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml index 1dba20b5..508f15cd 100644 --- a/.github/workflows/pypi.yml +++ b/.github/workflows/pypi.yml @@ -28,7 +28,7 @@ jobs: path: dist test: - if: !startsWith(github.ref, 'refs/tags/') + if: ${{ !startsWith(github.ref, 'refs/tags/') }} needs: - build runs-on: ubuntu-latest @@ -47,7 +47,7 @@ jobs: repository-url: https://test.pypi.org/legacy/ release: - if: startsWith(github.ref, 'refs/tags/') + if: ${{ startsWith(github.ref, 'refs/tags/') }} needs: - build runs-on: ubuntu-latest From 52ff5ba0e0a43df683bfd0a1974f2a3910971327 Mon Sep 17 00:00:00 2001 From: Achille Roussel Date: Mon, 12 Feb 2024 21:21:44 -0800 Subject: [PATCH 08/24] use manylinux Signed-off-by: Achille Roussel --- .github/workflows/pypi.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml index 508f15cd..46c93375 100644 --- a/.github/workflows/pypi.yml +++ b/.github/workflows/pypi.yml @@ -20,8 +20,9 @@ jobs: with: python-version: '3.11' cache: pip - - run: python -m pip install build --user - - run: python -m build + - uses: RalfG/python-wheels-manylinux-build@v0.7.1 + with: + python-versions: 'cp311-cp311 cp312-cp312' - uses: actions/upload-artifact@v4 with: name: dist From 009b05bdf7e006abdd6aa95d079ce0f3fee2aea5 Mon Sep 17 00:00:00 2001 From: Achille Roussel Date: Mon, 12 Feb 2024 21:32:28 -0800 Subject: [PATCH 09/24] remove unsupported files Signed-off-by: Achille Roussel --- .github/workflows/pypi.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml index 46c93375..fa15f236 100644 --- a/.github/workflows/pypi.yml +++ b/.github/workflows/pypi.yml @@ -23,6 +23,7 @@ jobs: - uses: RalfG/python-wheels-manylinux-build@v0.7.1 with: python-versions: 'cp311-cp311 cp312-cp312' + - run: find dist -name '*linux_x86_64.whl' -delete - uses: actions/upload-artifact@v4 with: name: dist From 2a6105cbd410faec6d4d42e89ac48cb805840b1d Mon Sep 17 00:00:00 2001 From: Achille Roussel Date: Mon, 12 Feb 2024 21:35:58 -0800 Subject: [PATCH 10/24] sudo Signed-off-by: Achille Roussel --- .github/workflows/pypi.yml | 9 ++------- .github/workflows/test.yml | 3 ++- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml index fa15f236..203c23db 100644 --- a/.github/workflows/pypi.yml +++ b/.github/workflows/pypi.yml @@ -1,12 +1,7 @@ name: PyPI on: - pull_request: - push: - branches: - - main - tags: - - v* +- push jobs: build: @@ -23,7 +18,7 @@ jobs: - uses: RalfG/python-wheels-manylinux-build@v0.7.1 with: python-versions: 'cp311-cp311 cp312-cp312' - - run: find dist -name '*linux_x86_64.whl' -delete + - run: sudo find dist -name '*linux_x86_64.whl' -delete - uses: actions/upload-artifact@v4 with: name: dist diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9ebd5266..5cdf9196 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,6 +1,7 @@ name: Test -on: [push] +on: +- push permissions: contents: read From 1d01c6e5c42060dc8e426f691ec41a691b7ceb0d Mon Sep 17 00:00:00 2001 From: Achille Roussel Date: Mon, 12 Feb 2024 21:50:54 -0800 Subject: [PATCH 11/24] build wheels for amd64 and arm64 Signed-off-by: Achille Roussel --- .github/workflows/pypi.yml | 44 +++++++++++++++++++++++++++++++------- 1 file changed, 36 insertions(+), 8 deletions(-) diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml index 203c23db..7b1334b5 100644 --- a/.github/workflows/pypi.yml +++ b/.github/workflows/pypi.yml @@ -4,7 +4,7 @@ on: - push jobs: - build: + build-linux-amd64: runs-on: ubuntu-latest permissions: contents: read @@ -21,13 +21,34 @@ jobs: - run: sudo find dist -name '*linux_x86_64.whl' -delete - uses: actions/upload-artifact@v4 with: - name: dist + name: dist-linux-amd64 + path: dist + + build-linux-aarch64: + runs-on: ubuntu-latest + permissions: + contents: read + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.11' + cache: pip + - uses: RalfG/python-wheels-manylinux-build@v0.7.1-manylinux2014_aarch64 + with: + python-versions: 'cp311-cp311 cp312-cp312' + - run: sudo find dist -name '*linux_aarch64.whl' -delete + - uses: actions/upload-artifact@v4 + with: + name: dist-linux-aarch64 path: dist test: if: ${{ !startsWith(github.ref, 'refs/tags/') }} needs: - - build + - build-linux-amd64 + - build-linux-aarch64 runs-on: ubuntu-latest environment: name: pypi @@ -37,8 +58,11 @@ jobs: steps: - uses: actions/download-artifact@v4 with: - name: dist - path: dist + pattern: dist-* + - run: | + mkdir dist + mv dist-*/*.whl dist/ + mv dist-linux-amd64/*.tar.gz dist/ - uses: pypa/gh-action-pypi-publish@release/v1 with: repository-url: https://test.pypi.org/legacy/ @@ -46,7 +70,8 @@ jobs: release: if: ${{ startsWith(github.ref, 'refs/tags/') }} needs: - - build + - build-linux-amd64 + - build-linux-aarch64 runs-on: ubuntu-latest environment: name: testpypi @@ -56,6 +81,9 @@ jobs: steps: - uses: actions/download-artifact@v4 with: - name: dist - path: dist + pattern: dist-* + - run: | + mkdir dist + mv dist-*/*.whl dist/ + mv dist-linux-amd64/*.tar.gz dist/ - uses: pypa/gh-action-pypi-publish@release/v1 From 13e122ffca093c21783225d760bf9b5148a86b15 Mon Sep 17 00:00:00 2001 From: Achille Roussel Date: Mon, 12 Feb 2024 22:05:32 -0800 Subject: [PATCH 12/24] try a cibuildwheel Signed-off-by: Achille Roussel --- .github/workflows/pypi.yml | 65 ++++++++++---------------------------- 1 file changed, 17 insertions(+), 48 deletions(-) diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml index 7b1334b5..f2bd5654 100644 --- a/.github/workflows/pypi.yml +++ b/.github/workflows/pypi.yml @@ -4,51 +4,27 @@ on: - push jobs: - build-linux-amd64: - runs-on: ubuntu-latest - permissions: - contents: read - steps: - - uses: actions/checkout@v4 - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: '3.11' - cache: pip - - uses: RalfG/python-wheels-manylinux-build@v0.7.1 - with: - python-versions: 'cp311-cp311 cp312-cp312' - - run: sudo find dist -name '*linux_x86_64.whl' -delete - - uses: actions/upload-artifact@v4 - with: - name: dist-linux-amd64 - path: dist - - build-linux-aarch64: - runs-on: ubuntu-latest + build: + name: build wheels on ${{ matrix.os }} + runs-on: ${{ matrix.os }} permissions: contents: read + strategy: + matrix: + os: [ubuntu-latest, windows-latest, macos-13, macos-14] steps: - uses: actions/checkout@v4 - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: '3.11' - cache: pip - - uses: RalfG/python-wheels-manylinux-build@v0.7.1-manylinux2014_aarch64 + - uses: actions/setup-python@v3 + - run: python -m pip install cibuildwheel==2.16.5 + - run: python -m cibuildwheel --output-dir wheelhouse with: - python-versions: 'cp311-cp311 cp312-cp312' - - run: sudo find dist -name '*linux_aarch64.whl' -delete - - uses: actions/upload-artifact@v4 - with: - name: dist-linux-aarch64 - path: dist + name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }} + path: wheelhouse/*.whl test: if: ${{ !startsWith(github.ref, 'refs/tags/') }} needs: - - build-linux-amd64 - - build-linux-aarch64 + - build runs-on: ubuntu-latest environment: name: pypi @@ -58,11 +34,8 @@ jobs: steps: - uses: actions/download-artifact@v4 with: - pattern: dist-* - - run: | - mkdir dist - mv dist-*/*.whl dist/ - mv dist-linux-amd64/*.tar.gz dist/ + path: dist + pattern: *.whl - uses: pypa/gh-action-pypi-publish@release/v1 with: repository-url: https://test.pypi.org/legacy/ @@ -70,8 +43,7 @@ jobs: release: if: ${{ startsWith(github.ref, 'refs/tags/') }} needs: - - build-linux-amd64 - - build-linux-aarch64 + - build runs-on: ubuntu-latest environment: name: testpypi @@ -81,9 +53,6 @@ jobs: steps: - uses: actions/download-artifact@v4 with: - pattern: dist-* - - run: | - mkdir dist - mv dist-*/*.whl dist/ - mv dist-linux-amd64/*.tar.gz dist/ + path: dist + pattern: *.whl - uses: pypa/gh-action-pypi-publish@release/v1 From 5c4fc4e465de0fa44a721939c0036deca3b5cda3 Mon Sep 17 00:00:00 2001 From: Achille Roussel Date: Mon, 12 Feb 2024 22:06:31 -0800 Subject: [PATCH 13/24] fix syntax error in pypi.yml Signed-off-by: Achille Roussel --- .github/workflows/pypi.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml index f2bd5654..b7519694 100644 --- a/.github/workflows/pypi.yml +++ b/.github/workflows/pypi.yml @@ -35,7 +35,7 @@ jobs: - uses: actions/download-artifact@v4 with: path: dist - pattern: *.whl + pattern: '*.whl' - uses: pypa/gh-action-pypi-publish@release/v1 with: repository-url: https://test.pypi.org/legacy/ @@ -54,5 +54,5 @@ jobs: - uses: actions/download-artifact@v4 with: path: dist - pattern: *.whl + pattern: '*.whl' - uses: pypa/gh-action-pypi-publish@release/v1 From af2c2ad4496685e10f5c25727036a80841712c7b Mon Sep 17 00:00:00 2001 From: Achille Roussel Date: Mon, 12 Feb 2024 22:07:24 -0800 Subject: [PATCH 14/24] fix artifact upload Signed-off-by: Achille Roussel --- .github/workflows/pypi.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml index b7519694..594639d9 100644 --- a/.github/workflows/pypi.yml +++ b/.github/workflows/pypi.yml @@ -17,6 +17,7 @@ jobs: - uses: actions/setup-python@v3 - run: python -m pip install cibuildwheel==2.16.5 - run: python -m cibuildwheel --output-dir wheelhouse + - uses: actions/upload-artifact@v4 with: name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }} path: wheelhouse/*.whl From 6da15171dd073bd4a08def4f5e0c28d0fbe129f7 Mon Sep 17 00:00:00 2001 From: Achille Roussel Date: Mon, 12 Feb 2024 22:28:16 -0800 Subject: [PATCH 15/24] try to fix the build once more Signed-off-by: Achille Roussel --- .github/workflows/pypi.yml | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml index 594639d9..260f5b50 100644 --- a/.github/workflows/pypi.yml +++ b/.github/workflows/pypi.yml @@ -14,13 +14,20 @@ jobs: os: [ubuntu-latest, windows-latest, macos-13, macos-14] steps: - uses: actions/checkout@v4 - - uses: actions/setup-python@v3 - - run: python -m pip install cibuildwheel==2.16.5 + - uses: actions/setup-python@v4 + with: + cache: pip + - run: python -m pip install build cibuildwheel==2.16.5 - run: python -m cibuildwheel --output-dir wheelhouse + - run: python -m build - uses: actions/upload-artifact@v4 with: - name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }} + name: cibw-wheels-${{ matrix.os }} path: wheelhouse/*.whl + - uses: actions/upload-artifact@v4 + with: + name: archive + path: dist/*.tar.gz test: if: ${{ !startsWith(github.ref, 'refs/tags/') }} @@ -33,10 +40,17 @@ jobs: permissions: id-token: write steps: + - run: mkdir dist + - uses: actions/download-artifact@v4 + with: + path: dist + pattern: dist/*.tar.gz + merge-multiple: true - uses: actions/download-artifact@v4 with: path: dist - pattern: '*.whl' + pattern: cibw-wheels-* + merge-multiple: true - uses: pypa/gh-action-pypi-publish@release/v1 with: repository-url: https://test.pypi.org/legacy/ @@ -55,5 +69,5 @@ jobs: - uses: actions/download-artifact@v4 with: path: dist - pattern: '*.whl' + pattern: cibw-wheels-* - uses: pypa/gh-action-pypi-publish@release/v1 From 2f972774d4ca760380096180c39720673fa0481b Mon Sep 17 00:00:00 2001 From: Achille Roussel Date: Mon, 12 Feb 2024 22:33:22 -0800 Subject: [PATCH 16/24] make python version explicit Signed-off-by: Achille Roussel --- .github/workflows/pypi.yml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml index 260f5b50..ee74bfaa 100644 --- a/.github/workflows/pypi.yml +++ b/.github/workflows/pypi.yml @@ -5,18 +5,25 @@ on: jobs: build: - name: build wheels on ${{ matrix.os }} + name: build wheels for ${{ matrix.python }} on ${{ matrix.os }} runs-on: ${{ matrix.os }} permissions: contents: read strategy: matrix: - os: [ubuntu-latest, windows-latest, macos-13, macos-14] + os: + - ubuntu-latest + - windows-latest + - macos-13 + - macos-14 + python: + - '3.11' steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v4 with: cache: pip + python-version: ${{ matrix.python }} - run: python -m pip install build cibuildwheel==2.16.5 - run: python -m cibuildwheel --output-dir wheelhouse - run: python -m build From 0a01a5c3e7fde787fc348631a840f67effe755a8 Mon Sep 17 00:00:00 2001 From: Achille Roussel Date: Mon, 12 Feb 2024 22:37:01 -0800 Subject: [PATCH 17/24] fix artifact upload name Signed-off-by: Achille Roussel --- .github/workflows/pypi.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml index ee74bfaa..a240449e 100644 --- a/.github/workflows/pypi.yml +++ b/.github/workflows/pypi.yml @@ -29,7 +29,7 @@ jobs: - run: python -m build - uses: actions/upload-artifact@v4 with: - name: cibw-wheels-${{ matrix.os }} + name: cibw-wheels-${{ matrix.python }}-${{ matrix.os }}-${{ strategy.job-index }} path: wheelhouse/*.whl - uses: actions/upload-artifact@v4 with: From bc3789f683743033e3f6413b38122bcad1333ce8 Mon Sep 17 00:00:00 2001 From: Achille Roussel Date: Mon, 12 Feb 2024 22:42:26 -0800 Subject: [PATCH 18/24] fix creation of pypi archive Signed-off-by: Achille Roussel --- .github/workflows/pypi.yml | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml index a240449e..523c13b4 100644 --- a/.github/workflows/pypi.yml +++ b/.github/workflows/pypi.yml @@ -4,6 +4,23 @@ on: - push jobs: + archive: + name: build tar archive + runs-on: ubuntu-latest + permissions: + contents: read + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v4 + with: + cache: pip + - run: python -m pip install build + - run: python -m build + - uses: actions/upload-artifact@v4 + with: + name: archive + path: dist/*.tar.gz + build: name: build wheels for ${{ matrix.python }} on ${{ matrix.os }} runs-on: ${{ matrix.os }} @@ -26,19 +43,15 @@ jobs: python-version: ${{ matrix.python }} - run: python -m pip install build cibuildwheel==2.16.5 - run: python -m cibuildwheel --output-dir wheelhouse - - run: python -m build - uses: actions/upload-artifact@v4 with: name: cibw-wheels-${{ matrix.python }}-${{ matrix.os }}-${{ strategy.job-index }} path: wheelhouse/*.whl - - uses: actions/upload-artifact@v4 - with: - name: archive - path: dist/*.tar.gz test: if: ${{ !startsWith(github.ref, 'refs/tags/') }} needs: + - archive - build runs-on: ubuntu-latest environment: @@ -51,12 +64,7 @@ jobs: - uses: actions/download-artifact@v4 with: path: dist - pattern: dist/*.tar.gz - merge-multiple: true - - uses: actions/download-artifact@v4 - with: - path: dist - pattern: cibw-wheels-* + pattern: '*' merge-multiple: true - uses: pypa/gh-action-pypi-publish@release/v1 with: @@ -65,6 +73,7 @@ jobs: release: if: ${{ startsWith(github.ref, 'refs/tags/') }} needs: + - archive - build runs-on: ubuntu-latest environment: From ce77d263aa55e02cc9775b5935ab952d38b55215 Mon Sep 17 00:00:00 2001 From: Achille Roussel Date: Mon, 12 Feb 2024 22:43:54 -0800 Subject: [PATCH 19/24] specify python version to create archive Signed-off-by: Achille Roussel --- .github/workflows/pypi.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml index 523c13b4..fe2ddc8d 100644 --- a/.github/workflows/pypi.yml +++ b/.github/workflows/pypi.yml @@ -14,6 +14,7 @@ jobs: - uses: actions/setup-python@v4 with: cache: pip + python-version: '3.11' - run: python -m pip install build - run: python -m build - uses: actions/upload-artifact@v4 From fd517af963b7e501d113cc888c1f952bc5ba9e3d Mon Sep 17 00:00:00 2001 From: Achille Roussel Date: Mon, 12 Feb 2024 22:51:41 -0800 Subject: [PATCH 20/24] couple more fixes and cleanup Signed-off-by: Achille Roussel --- .github/workflows/pypi.yml | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml index fe2ddc8d..5c1e1fb5 100644 --- a/.github/workflows/pypi.yml +++ b/.github/workflows/pypi.yml @@ -5,7 +5,6 @@ on: jobs: archive: - name: build tar archive runs-on: ubuntu-latest permissions: contents: read @@ -23,7 +22,7 @@ jobs: path: dist/*.tar.gz build: - name: build wheels for ${{ matrix.python }} on ${{ matrix.os }} + name: build wheels on ${{ matrix.os }} runs-on: ${{ matrix.os }} permissions: contents: read @@ -34,19 +33,17 @@ jobs: - windows-latest - macos-13 - macos-14 - python: - - '3.11' steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v4 with: cache: pip - python-version: ${{ matrix.python }} + python-version: '3.11' - run: python -m pip install build cibuildwheel==2.16.5 - run: python -m cibuildwheel --output-dir wheelhouse - uses: actions/upload-artifact@v4 with: - name: cibw-wheels-${{ matrix.python }}-${{ matrix.os }}-${{ strategy.job-index }} + name: cibw-wheels-${{ matrix.python }}-${{ matrix.os }} path: wheelhouse/*.whl test: @@ -61,7 +58,6 @@ jobs: permissions: id-token: write steps: - - run: mkdir dist - uses: actions/download-artifact@v4 with: path: dist From 42f00091ef01f32d80a8a09dded00e68236bdcc7 Mon Sep 17 00:00:00 2001 From: Achille Roussel Date: Mon, 12 Feb 2024 23:02:06 -0800 Subject: [PATCH 21/24] enable git versioning Signed-off-by: Achille Roussel --- pyproject.toml | 4 ++-- src/dispatch/__init__.py | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index c0b39905..0767028f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -28,8 +28,8 @@ dev = [ "types-requests >= 2.31.0.20240125" ] -[tool.setuptools.dynamic] -version = {attr = "dispatch.__version__"} +[tool.setuptools-git-versioning] +enabled = true [tool.isort] profile = "black" diff --git a/src/dispatch/__init__.py b/src/dispatch/__init__.py index cc925e15..4f7fb181 100644 --- a/src/dispatch/__init__.py +++ b/src/dispatch/__init__.py @@ -21,5 +21,3 @@ "poll", "exit", ] - -__version__ = "0.0.1" From 044a8f92a63381394cd1b00eb438f1386c050adc Mon Sep 17 00:00:00 2001 From: Achille Roussel Date: Mon, 12 Feb 2024 23:03:41 -0800 Subject: [PATCH 22/24] upgrade setup-python to v5 Signed-off-by: Achille Roussel --- .github/workflows/pypi.yml | 4 ++-- .github/workflows/test.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml index 5c1e1fb5..d5760931 100644 --- a/.github/workflows/pypi.yml +++ b/.github/workflows/pypi.yml @@ -10,7 +10,7 @@ jobs: contents: read steps: - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 + - uses: actions/setup-python@v5 with: cache: pip python-version: '3.11' @@ -35,7 +35,7 @@ jobs: - macos-14 steps: - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 + - uses: actions/setup-python@v5 with: cache: pip python-version: '3.11' diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5cdf9196..0f2ea4fb 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -15,7 +15,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python }} cache: pip @@ -30,7 +30,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python }} cache: pip From b5b909b609867d5b08ed050ef9734ca0555bbd7a Mon Sep 17 00:00:00 2001 From: Achille Roussel Date: Mon, 12 Feb 2024 23:04:35 -0800 Subject: [PATCH 23/24] fix artifact names Signed-off-by: Achille Roussel --- .github/workflows/pypi.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml index d5760931..880184e1 100644 --- a/.github/workflows/pypi.yml +++ b/.github/workflows/pypi.yml @@ -43,7 +43,7 @@ jobs: - run: python -m cibuildwheel --output-dir wheelhouse - uses: actions/upload-artifact@v4 with: - name: cibw-wheels-${{ matrix.python }}-${{ matrix.os }} + name: cibw-wheels-${{ matrix.os }} path: wheelhouse/*.whl test: From 9bbba79e04a29d9f016f21bc5963d4b7458b17ee Mon Sep 17 00:00:00 2001 From: Achille Roussel Date: Mon, 12 Feb 2024 23:14:19 -0800 Subject: [PATCH 24/24] commit Signed-off-by: Achille Roussel --- .github/workflows/pypi.yml | 31 ++++++++----------------------- .github/workflows/test.yml | 4 ++++ 2 files changed, 12 insertions(+), 23 deletions(-) diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml index 880184e1..25df117d 100644 --- a/.github/workflows/pypi.yml +++ b/.github/workflows/pypi.yml @@ -1,7 +1,13 @@ name: PyPI on: -- push +- push: + tags: + - 'v*' + +concurrency: + group: ${{ github.workflow }}-${{ github.event.number || github.ref }} + cancel-in-progress: true jobs: archive: @@ -46,8 +52,7 @@ jobs: name: cibw-wheels-${{ matrix.os }} path: wheelhouse/*.whl - test: - if: ${{ !startsWith(github.ref, 'refs/tags/') }} + release: needs: - archive - build @@ -64,23 +69,3 @@ jobs: pattern: '*' merge-multiple: true - uses: pypa/gh-action-pypi-publish@release/v1 - with: - repository-url: https://test.pypi.org/legacy/ - - release: - if: ${{ startsWith(github.ref, 'refs/tags/') }} - needs: - - archive - - build - runs-on: ubuntu-latest - environment: - name: testpypi - url: https://pypi.org/p/dispatch-functions - permissions: - id-token: write - steps: - - uses: actions/download-artifact@v4 - with: - path: dist - pattern: cibw-wheels-* - - uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0f2ea4fb..ce8bf76d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -3,6 +3,10 @@ name: Test on: - push +concurrency: + group: ${{ github.workflow }}-${{ github.event.number || github.ref }} + cancel-in-progress: true + permissions: contents: read