From 38c76b450294d35a276d102ed816b12dd810ee99 Mon Sep 17 00:00:00 2001 From: Bento007 Date: Wed, 31 Jul 2024 11:29:00 -0700 Subject: [PATCH 01/21] fix: add link to documentation to pypi --- client/python/cryoet_data_portal/pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/client/python/cryoet_data_portal/pyproject.toml b/client/python/cryoet_data_portal/pyproject.toml index 6e95d01b6..362706ceb 100644 --- a/client/python/cryoet_data_portal/pyproject.toml +++ b/client/python/cryoet_data_portal/pyproject.toml @@ -38,6 +38,7 @@ dependencies= [ [project.urls] homepage = "https://github.com/chanzuckerberg/cryoet-data-portal" repository = "https://github.com/chanzuckerberg/cryoet-data-portal" +documentation = "https://chanzuckerberg.github.io/cryoet-data-portal/python-api.html" [tool.setuptools.packages.find] where = ["src"] From d7e5446519aebfbc180eaef98a11ce65ec7d49dc Mon Sep 17 00:00:00 2001 From: Bento007 Date: Wed, 31 Jul 2024 11:50:32 -0700 Subject: [PATCH 02/21] chore: prepare client for release automation - add CHANGELOG.md for release-please - add make build recipe for building the pypi release - hardcode version in client - add client to release-please config and manifest - add update py-build.yml to use release please. --- .github/workflows/py-build.yml | 51 +++++++++---------- client/python/cryoet_data_portal/CHANGELOG.md | 0 .../python/cryoet_data_portal/pyproject.toml | 4 +- .../src/cryoet_data_portal/__init__.py | 12 +---- release-please.config.json | 12 +++-- release-please.manifest.json | 3 +- 6 files changed, 37 insertions(+), 45 deletions(-) create mode 100644 client/python/cryoet_data_portal/CHANGELOG.md diff --git a/.github/workflows/py-build.yml b/.github/workflows/py-build.yml index 647b6816c..1846a4223 100644 --- a/.github/workflows/py-build.yml +++ b/.github/workflows/py-build.yml @@ -1,37 +1,32 @@ -name: Python cryoet_data_portal build +name: Python cryoet_data_portal release on: - pull_request: - paths: - - "client/python/**" - - ".github/workflows/**" # Re-run if a workflow is modified - useful to test workflow changes in PRs push: - branches: [main] + branches: + - main + - tsmith/automate-release + + paths: + - 'client/python/cryoet_data_portal/**' + - '.github/workflows/py-build.yml' workflow_dispatch: +concurrency: + group: create-python-client-release + cancel-in-progress: false + +permissions: + contents: write + pull-requests: write + jobs: - build_python_wheels: - name: Build Python wheel and sdist + release-please: runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - uses: actions/setup-python@v4 - with: - python-version: "3.10" - - - name: Install deps - run: | - python -m pip install -U pip setuptools build - - - name: Build - run: python -m build - working-directory: client/python/cryoet_data_portal/ - - - name: Upload build artifact - uses: actions/upload-artifact@v3 + - name: release please + uses: googleapis/release-please-action@v4 + id: release with: - path: client/python/cryoet_data_portal/dist/* + manifest-file: "release-please.manifest.json" + config-file: "release-please.config.json" + target-branch: "tsmith/automate-release" # TODO change to main diff --git a/client/python/cryoet_data_portal/CHANGELOG.md b/client/python/cryoet_data_portal/CHANGELOG.md new file mode 100644 index 000000000..e69de29bb diff --git a/client/python/cryoet_data_portal/pyproject.toml b/client/python/cryoet_data_portal/pyproject.toml index 362706ceb..c9a1ded65 100644 --- a/client/python/cryoet_data_portal/pyproject.toml +++ b/client/python/cryoet_data_portal/pyproject.toml @@ -1,10 +1,10 @@ [build-system] -requires = ["setuptools>=45", "setuptools_scm[toml]>=6.2"] +requires = ["setuptools>=64"] build-backend = "setuptools.build_meta" [project] name = "cryoet_data_portal" -dynamic = ["version"] +version = "3.0.3" description = "API Client to facilitate the use of the CryoET Portal. For more information about the API and the project visit https://github.com/chanzuckerberg/cryoet-data-portal/" authors = [ { name = "Chan Zuckerberg Initiative", email = "cryoetdataportal@chanzuckerberg.com" } diff --git a/client/python/cryoet_data_portal/src/cryoet_data_portal/__init__.py b/client/python/cryoet_data_portal/src/cryoet_data_portal/__init__.py index e2ec4e9d9..9fea659b7 100644 --- a/client/python/cryoet_data_portal/src/cryoet_data_portal/__init__.py +++ b/client/python/cryoet_data_portal/src/cryoet_data_portal/__init__.py @@ -4,12 +4,6 @@ For more information on the API, visit the [cryoet-data-portal repo](https://github.com/chanzuckerberg/cryoet-data-portal/) """ -try: - from importlib import metadata -except ImportError: - # for python <=3.7 - import importlib_metadata as metadata # type: ignore[no-redef] - from ._client import Client from ._models import ( Annotation, @@ -25,11 +19,7 @@ TomogramVoxelSpacing, ) -try: - __version__ = metadata.version("cryoet_data_portal") -except metadata.PackageNotFoundError: - # package is not installed - __version__ = "0.0.0-unknown" +__version__ = "3.0.3" __all__ = [ "Client", diff --git a/release-please.config.json b/release-please.config.json index 9fd94f2cf..41e892b77 100644 --- a/release-please.config.json +++ b/release-please.config.json @@ -1,6 +1,4 @@ { - "bootstrap-sha": "79825da91dd20c3be2f47912285e2c977848af32", - "skip-github-release": true, "changelog-sections": [ { "type": "feat", "section": "โœจ Features" }, { "type": "fix", "section": "๐Ÿž Bug Fixes" }, @@ -16,7 +14,15 @@ ], "packages": { "frontend": { - "release-type": "node" + "release-type": "node", + "skip-github-release": true, + "separate-pull-requests": true + }, + "client/python/cryoet_data_portal": { + "package-name": "cryoet-data-portal-python-client", + "release-type": "python", + "separate-pull-requests": true, + "labels": ["client"] } } } diff --git a/release-please.manifest.json b/release-please.manifest.json index 2d6147e9c..14ad4ed15 100644 --- a/release-please.manifest.json +++ b/release-please.manifest.json @@ -1,3 +1,4 @@ { - "frontend": "1.16.0" + "frontend": "1.16.0", + "client/python/cryoet_data_portal": "3.0.3" } From 95d4f0e45b12b160f6a6ed37aaaaed9ad18bbb84 Mon Sep 17 00:00:00 2001 From: Bento007 Date: Wed, 31 Jul 2024 12:07:22 -0700 Subject: [PATCH 03/21] chore: prepare client for release automation - add CHANGELOG.md for release-please - add make build recipe for building the pypi release - hardcode version in client - add client to release-please config and manifest - add update py-build.yml to use release please. --- .github/workflows/py-build.yml | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/.github/workflows/py-build.yml b/.github/workflows/py-build.yml index 1846a4223..0c7c683ef 100644 --- a/.github/workflows/py-build.yml +++ b/.github/workflows/py-build.yml @@ -30,3 +30,37 @@ jobs: manifest-file: "release-please.manifest.json" config-file: "release-please.config.json" target-branch: "tsmith/automate-release" # TODO change to main + $packages[path].component: "client/python/cryoet_data_portal" + + outputs: + paths_released: ${{ steps.release.outputs.paths_released }} + + publish-pypi-package: + name: Build and publish Python package to PyPI + runs-on: ubuntu-latest + if: contains(needs.release-please.outputs.paths_released, 'client/python/cryoet_data_portal') + environment: + name: testpypi # TODO change to pypi + url: https://pypi.org/p/cellxgene-ontology-guide + permissions: + id-token: write # IMPORTANT: this permission is mandatory for trusted publishing + steps: + - name: Checkout ref branch + uses: actions/checkout@v4 + with: + ref: ${{ github.ref }} + fetch-depth: 0 + + - uses: actions/setup-python@v4 + with: + pyton-version: "3.10" + + - name: build + run: | + make build -C client/python/cryoet_data_portal + + - name: Publish distribution ๐Ÿ“ฆ to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + packages-dir: client/python/cryoet_data_portal/dist + repository-url: https://test.pypi.org/legacy/ # TODO change to pypi From 508516b956b14d6aa18c8f39b5c28938f0b49220 Mon Sep 17 00:00:00 2001 From: Bento007 Date: Wed, 31 Jul 2024 12:43:46 -0700 Subject: [PATCH 04/21] chore: automate pypi release --- .github/workflows/py-build.yml | 6 ++---- client/python/cryoet_data_portal/Makefile | 6 ++++++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/py-build.yml b/.github/workflows/py-build.yml index 0c7c683ef..415021efa 100644 --- a/.github/workflows/py-build.yml +++ b/.github/workflows/py-build.yml @@ -6,9 +6,8 @@ on: - main - tsmith/automate-release - paths: - - 'client/python/cryoet_data_portal/**' - - '.github/workflows/py-build.yml' +# paths: +# - 'client/python/cryoet_data_portal/**' workflow_dispatch: concurrency: @@ -30,7 +29,6 @@ jobs: manifest-file: "release-please.manifest.json" config-file: "release-please.config.json" target-branch: "tsmith/automate-release" # TODO change to main - $packages[path].component: "client/python/cryoet_data_portal" outputs: paths_released: ${{ steps.release.outputs.paths_released }} diff --git a/client/python/cryoet_data_portal/Makefile b/client/python/cryoet_data_portal/Makefile index d55a39414..67e74a946 100644 --- a/client/python/cryoet_data_portal/Makefile +++ b/client/python/cryoet_data_portal/Makefile @@ -20,3 +20,9 @@ test: export BOTO_ENDPOINT_URL=http://localhost:4000; \ export BOTO_SIGNATURE_VERSION=s3v4; \ pytest -vvv -s . $(TEST) + +.PHONY: build +build: + python -m pip install --upgrade pip + pip install build twine + python -m build From e3dbab0573d85e4f10d05222e3e14202dfd0597e Mon Sep 17 00:00:00 2001 From: Bento007 Date: Wed, 31 Jul 2024 12:50:03 -0700 Subject: [PATCH 05/21] add extra label --- release-please.config.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release-please.config.json b/release-please.config.json index 41e892b77..fa3ca9de0 100644 --- a/release-please.config.json +++ b/release-please.config.json @@ -22,7 +22,7 @@ "package-name": "cryoet-data-portal-python-client", "release-type": "python", "separate-pull-requests": true, - "labels": ["client"] + "extra-label": ["client"] } } } From 898ca30b1e3f87e40fb3390903014199f71ad024 Mon Sep 17 00:00:00 2001 From: Bento007 Date: Wed, 31 Jul 2024 12:59:00 -0700 Subject: [PATCH 06/21] remove extra label --- release-please.config.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/release-please.config.json b/release-please.config.json index fa3ca9de0..7d32d1431 100644 --- a/release-please.config.json +++ b/release-please.config.json @@ -21,8 +21,7 @@ "client/python/cryoet_data_portal": { "package-name": "cryoet-data-portal-python-client", "release-type": "python", - "separate-pull-requests": true, - "extra-label": ["client"] + "separate-pull-requests": true } } } From 85342ee4ea08838a6516224abb1f79e3747864b1 Mon Sep 17 00:00:00 2001 From: Bento007 Date: Wed, 31 Jul 2024 14:23:49 -0700 Subject: [PATCH 07/21] need release please --- .github/workflows/py-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/py-build.yml b/.github/workflows/py-build.yml index 415021efa..ccc082fd0 100644 --- a/.github/workflows/py-build.yml +++ b/.github/workflows/py-build.yml @@ -29,13 +29,13 @@ jobs: manifest-file: "release-please.manifest.json" config-file: "release-please.config.json" target-branch: "tsmith/automate-release" # TODO change to main - outputs: paths_released: ${{ steps.release.outputs.paths_released }} publish-pypi-package: name: Build and publish Python package to PyPI runs-on: ubuntu-latest + needs: release-please if: contains(needs.release-please.outputs.paths_released, 'client/python/cryoet_data_portal') environment: name: testpypi # TODO change to pypi From c858079a73681caf073548dbe3ce159d4e1b39c8 Mon Sep 17 00:00:00 2001 From: Bento007 Date: Wed, 31 Jul 2024 14:30:39 -0700 Subject: [PATCH 08/21] point at pypi --- .github/workflows/py-build.yml | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/.github/workflows/py-build.yml b/.github/workflows/py-build.yml index ccc082fd0..638f28781 100644 --- a/.github/workflows/py-build.yml +++ b/.github/workflows/py-build.yml @@ -4,10 +4,6 @@ on: push: branches: - main - - tsmith/automate-release - -# paths: -# - 'client/python/cryoet_data_portal/**' workflow_dispatch: concurrency: @@ -28,7 +24,7 @@ jobs: with: manifest-file: "release-please.manifest.json" config-file: "release-please.config.json" - target-branch: "tsmith/automate-release" # TODO change to main + target-branch: "main" # TODO change to main outputs: paths_released: ${{ steps.release.outputs.paths_released }} @@ -38,7 +34,7 @@ jobs: needs: release-please if: contains(needs.release-please.outputs.paths_released, 'client/python/cryoet_data_portal') environment: - name: testpypi # TODO change to pypi + name: pypi # TODO change to pypi url: https://pypi.org/p/cellxgene-ontology-guide permissions: id-token: write # IMPORTANT: this permission is mandatory for trusted publishing @@ -61,4 +57,3 @@ jobs: uses: pypa/gh-action-pypi-publish@release/v1 with: packages-dir: client/python/cryoet_data_portal/dist - repository-url: https://test.pypi.org/legacy/ # TODO change to pypi From b2debe9274276149af6caad93ce171c83b34824b Mon Sep 17 00:00:00 2001 From: Bento007 Date: Wed, 31 Jul 2024 14:31:13 -0700 Subject: [PATCH 09/21] remove todos --- .github/workflows/py-build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/py-build.yml b/.github/workflows/py-build.yml index 638f28781..fd66c29f0 100644 --- a/.github/workflows/py-build.yml +++ b/.github/workflows/py-build.yml @@ -24,7 +24,7 @@ jobs: with: manifest-file: "release-please.manifest.json" config-file: "release-please.config.json" - target-branch: "main" # TODO change to main + target-branch: "main" outputs: paths_released: ${{ steps.release.outputs.paths_released }} @@ -34,7 +34,7 @@ jobs: needs: release-please if: contains(needs.release-please.outputs.paths_released, 'client/python/cryoet_data_portal') environment: - name: pypi # TODO change to pypi + name: pypi url: https://pypi.org/p/cellxgene-ontology-guide permissions: id-token: write # IMPORTANT: this permission is mandatory for trusted publishing From 8fcc103fceebcfd18c5b94f3ee14baa8239f83d6 Mon Sep 17 00:00:00 2001 From: Bento007 Date: Wed, 31 Jul 2024 14:46:14 -0700 Subject: [PATCH 10/21] update release_process.md for release-please --- .../cryoet_data_portal/release_process.md | 109 ++---------------- 1 file changed, 7 insertions(+), 102 deletions(-) diff --git a/client/python/cryoet_data_portal/release_process.md b/client/python/cryoet_data_portal/release_process.md index 37b26ad06..ca88fe14b 100644 --- a/client/python/cryoet_data_portal/release_process.md +++ b/client/python/cryoet_data_portal/release_process.md @@ -1,105 +1,10 @@ # Python package release process +To release a new version of python client, merge a pull request to main with change to **./client/python/cryoet-data-portal**. Release-please will automatically create a PR with the a version bump if needed. The name of the PR will be **chore(main): release cryoet-data-portal-python-client vX.X.X**. Here is an [example](https://github.com/chanzuckerberg/cryoet-data-portal/pull/981) of a release PR. Merging the release-please PR will create a new release in github and a new version will be uploaded to pypi. If no changes were made that affect the python client, the python client will not be release. Closing the PR will skip the release of these changes and they will be included in the next release. -The following approach is used to manage releases of the Python package: +If the version number needs to be change see [release-plesae documentation](https://github.com/googleapis/release-please?tab=readme-ov-file#how-do-i-change-the-version-number) for how to change the version number. This same process can be used to manually release the package. -1. The package is automatically built (sdist and wheels) in a GitHub action, and build artifacts are uploaded to GitHub. -2. Release candidate testing is done by installing built assets from Github. -3. Build versions are managed via [`setuptools_scm`](https://github.com/pypa/setuptools_scm) and the version is automatically determined from git tags. -4. Releases are created and managed via GitHub Releases, leaving a tag in place from which future branches (eg, emergency fixes) can be created. -5. Built packages are published to PyPi _from_ the GitHub assets, i.e. are never hand-created, to reduce errors. - -## Prerequisites - -While not strictly required, this process assumes you have met the following prerequisites: - -- You have write access to the `chanzuckerberg/cryoet-data-portal` repo -- You have an account on pypi.org and test.pypi.org, both with access to the cryoet-data-portal project -- You have the Github CLI tool (`gh`) installed. See [documentation](https://cli.github.com/). -- You have the `pipx` CLI tool installed. See [documentation](https://pypa.github.io/pipx/). - -## Step 1: Building the package assets - -A build will occur automatically upon each commit to main, upon each commit to a PR, or when the build workflow is manually invoked. The build workflow is defined by the GH `py-build.yml` workflow. Build artifacts are the Python setuptools-created `sdist` and `wheel`, and are retained for a limited period of time (currently the GH default of 90 days). - -Unless you are revising and testing the build process itself, there is no need to manually perform a build. - -## Step 2: Release candidate testing - -Any pre-built asset on Github can be installed and tested from the Github URL. For example: - -1. Identify the GH workflow run ID that contains the asset you wish to test. A simple way to do this is: - ```shell - $ gh run list - ``` - Alternatively, you can use the "Actions" tag in the GitHub web UI. -2. Download the build artifact.zip from GitHub, using the GH Action run ID associated with the `build` action for your commit OR utilizing the web UI: - - ```shell - $ gh run download - ``` - - If you download using the browser, unzip into a temp directory, e.g., - - ```shell - $ unzip artifact.zip -d ./artifact/ - Archive: artifact.zip - inflating: ./artifact/cryoet-data-portal-0.0.1.dev0-py3-none-any.whl - inflating: ./artifact/cryoet-data-portal-0.0.1.dev0.tar.gz - ``` - -3. Install and test the downloaded build, e.g., - ```shell - $ pip uninstall cryoet-data-portal - $ pip install ./artifact/cryoet-data-portal-*-any.whl - ``` - -To test a release candidate: - -1. Identify the build you wish to test. Download and test the artifact built for that commit as described above. -2. Perform end-user testing, using the above installation method -3. If acceptable, proceed to Step 3 - create a release. - -If testing exposes problems, fix and commit a solution as you would any other change. - -## Step 3: Create a release - -Prior to this process, determine the correct semver version number for the new release. Please consider if this is a major, minor or patch release, and if it should have a tag (e.g., an alpha build, with a `a#` suffix or a pre-release candidate, with a `-rc` suffix). If you are not sure, please review [PEP 440](https://peps.python.org/pep-0440/) for more information. - -This process also assumes you are releasing from `main`. If you create a release PR, it should be merged to main before releasing. - -To create a release, perform the following: - -1. Identify both the (tested & validated) commit and semver for the release. -2. Tag the commit with the release version (_including_ a `v` prefix) and push the tag to origin. **Important**: use an annotated tag, e.g., `git tag -a v1.9.4 -m 'Release 1.9.4`. For example (please replace with your version, _including_ a `v`, e.g. `v1.9.4`: - ```shell - $ git tag -a -m 'Release ' - $ git push origin - ``` -3. Trigger a build for this tag by manually triggering the `py-build.yml` workflow. For example: - ```shell - $ gh workflow run py-build.yml --ref - ``` -4. When the workflow completes, make note of the run ID (e.g., using `gh run list`). -5. Optional, _but recommended_: download the asset from the build workflow and validate it. -6. Create and publish a GitHub Release, using the `` tag above (e.g., `v1.9.4`). It is recommended that you include a release summary and change log in the GH release. - -## Step 4: Publish assets to PyPi - -To publish built release assets to PyPi (_note_: this will require your pypi/testpypi login): - -1. Download the assets built for your release commit, using the same method as step 2 above, e.g., - ```shell - $ gh run download - ``` -2. Optional: upload to TestPyPi (this assumes the downloaded assets are in ./artifact/). - - ```shell - pipx run twine upload --repository testpypi ./artifact/* - ``` - - Following the upload, confirm correct presentation on the project page and ability to download install from TestPyPi. To test with TestPyPi, use `pipx run twine upload --repository testpypi ./artifact/*`. You can find more information [here](https://packaging.python.org/en/latest/guides/using-testpypi/). - -3. Use twine to upload to PyPi (this assumes the downloaded assets are in ./artifact/), e.g., - ```shell - pipx run twine upload ./artifact/* - ``` +## Build Locally +The python client can be build locally by running the following: +```bash +make build +``` From 1ff4275ce56f8d79c20541ffd24c8e006b161256 Mon Sep 17 00:00:00 2001 From: Bento007 Date: Thu, 1 Aug 2024 13:31:55 -0700 Subject: [PATCH 11/21] add pypi package url --- .github/workflows/py-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/py-build.yml b/.github/workflows/py-build.yml index fd66c29f0..f6eeb5a86 100644 --- a/.github/workflows/py-build.yml +++ b/.github/workflows/py-build.yml @@ -35,7 +35,7 @@ jobs: if: contains(needs.release-please.outputs.paths_released, 'client/python/cryoet_data_portal') environment: name: pypi - url: https://pypi.org/p/cellxgene-ontology-guide + url: https://pypi.org/p/cryoet-data-portal permissions: id-token: write # IMPORTANT: this permission is mandatory for trusted publishing steps: From 9813cec6cfdfa0001e106d35ce547ca8866efeeb Mon Sep 17 00:00:00 2001 From: Bento007 Date: Thu, 1 Aug 2024 13:55:17 -0700 Subject: [PATCH 12/21] Consolidate release please runs --- .../workflows/create-frontend-release-pr.yml | 32 ------------------- .../workflows/{py-build.yml => release.yml} | 14 ++++---- 2 files changed, 8 insertions(+), 38 deletions(-) delete mode 100644 .github/workflows/create-frontend-release-pr.yml rename .github/workflows/{py-build.yml => release.yml} (86%) diff --git a/.github/workflows/create-frontend-release-pr.yml b/.github/workflows/create-frontend-release-pr.yml deleted file mode 100644 index 7596edc73..000000000 --- a/.github/workflows/create-frontend-release-pr.yml +++ /dev/null @@ -1,32 +0,0 @@ -name: Create Frontend Release PR - -on: - workflow_dispatch: - push: - branches: - - main - paths: - - 'frontend/**' - -permissions: - contents: write - pull-requests: write - -jobs: - create-frontend-release: - concurrency: - group: create-frontend-release-${{ github.ref }} - cancel-in-progress: true - - name: generate frontend changelog - runs-on: ubuntu-latest - if: github.repository == 'chanzuckerberg/cryoet-data-portal' - steps: - - name: create changelog - uses: google-github-actions/release-please-action@v4 - id: release - with: - # TODO Configuring using manifest file as workaround until we move the frontend to its own repo - config-file: release-please.config.json - manifest-file: release-please.manifest.json - token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/py-build.yml b/.github/workflows/release.yml similarity index 86% rename from .github/workflows/py-build.yml rename to .github/workflows/release.yml index f6eeb5a86..0ba0ffc97 100644 --- a/.github/workflows/py-build.yml +++ b/.github/workflows/release.yml @@ -1,14 +1,10 @@ -name: Python cryoet_data_portal release +name: Create Release PRs on: + workflow_dispatch: push: branches: - main - workflow_dispatch: - -concurrency: - group: create-python-client-release - cancel-in-progress: false permissions: contents: write @@ -16,15 +12,21 @@ permissions: jobs: release-please: + concurrency: + group: release-prs-${{ github.ref }} + cancel-in-progress: true + runs-on: ubuntu-latest steps: - name: release please uses: googleapis/release-please-action@v4 id: release with: + # TODO Configuring using manifest file as workaround until we move the frontend to its own repo manifest-file: "release-please.manifest.json" config-file: "release-please.config.json" target-branch: "main" + outputs: paths_released: ${{ steps.release.outputs.paths_released }} From 4d1e19cd1c7880083408788af76eb5e48ec28243 Mon Sep 17 00:00:00 2001 From: Bento007 Date: Fri, 2 Aug 2024 12:42:39 -0700 Subject: [PATCH 13/21] test release-please PR runs tests --- .github/workflows/release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0ba0ffc97..800609623 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -5,6 +5,7 @@ on: push: branches: - main + - tsmith/add-release permissions: contents: write From 370f01d64560d30be7198980a633e203336fb7d4 Mon Sep 17 00:00:00 2001 From: Bento007 Date: Fri, 2 Aug 2024 12:43:11 -0700 Subject: [PATCH 14/21] test release-please PR runs tests --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 800609623..f1b39f731 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -26,7 +26,7 @@ jobs: # TODO Configuring using manifest file as workaround until we move the frontend to its own repo manifest-file: "release-please.manifest.json" config-file: "release-please.config.json" - target-branch: "main" + target-branch: "tsmith/add-release" outputs: paths_released: ${{ steps.release.outputs.paths_released }} From fb5f38ee9810a67e1a7a9c4289e4c216b118aecb Mon Sep 17 00:00:00 2001 From: Bento007 Date: Fri, 2 Aug 2024 12:44:31 -0700 Subject: [PATCH 15/21] test release-please PR runs tests --- .github/workflows/release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f1b39f731..90e18a976 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -5,7 +5,7 @@ on: push: branches: - main - - tsmith/add-release + - tsmith/automate-release permissions: contents: write @@ -26,7 +26,7 @@ jobs: # TODO Configuring using manifest file as workaround until we move the frontend to its own repo manifest-file: "release-please.manifest.json" config-file: "release-please.config.json" - target-branch: "tsmith/add-release" + target-branch: "tsmith/automate-release" outputs: paths_released: ${{ steps.release.outputs.paths_released }} From 59c82977c6d070410f4242778216b240582363a1 Mon Sep 17 00:00:00 2001 From: Bento007 Date: Fri, 2 Aug 2024 13:43:20 -0700 Subject: [PATCH 16/21] Add check that python test client passed --- .github/workflows/release-check.yml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 .github/workflows/release-check.yml diff --git a/.github/workflows/release-check.yml b/.github/workflows/release-check.yml new file mode 100644 index 000000000..faa90e3e7 --- /dev/null +++ b/.github/workflows/release-check.yml @@ -0,0 +1,26 @@ +# write a Github actions to verify the workflow "Python Client Tests" on the main branch ran successfully. +name: Client Release Check +on: + push: + branches: + - release-please--branches--tsmith/automate-release--components--cryoet-data-portal-python-client + +jobs: + release-check: + runs-on: ubuntu-latest + steps: + - name: check client tests on main + uses: actions/github-script@v7 + with: + retries: 10 + script: | + const { data } = await github.actions.listForRef({ + owner: context.repo.owner, + repo: context.repo.repo, + ref: 'main', + check_name: 'Python Client Tests', + filter: 'latest', + }); + if (data.workflow_runs[0].conclusion !== 'success') { + core.setFailed('Tests failed on main'); + } From 51d10407d3b935c8a1a70bf0f73baa6e938bfcd8 Mon Sep 17 00:00:00 2001 From: Bento007 Date: Fri, 2 Aug 2024 13:53:09 -0700 Subject: [PATCH 17/21] Add check that python test client passed --- .github/workflows/release-check.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/release-check.yml b/.github/workflows/release-check.yml index faa90e3e7..c235e9f8e 100644 --- a/.github/workflows/release-check.yml +++ b/.github/workflows/release-check.yml @@ -1,6 +1,9 @@ # write a Github actions to verify the workflow "Python Client Tests" on the main branch ran successfully. name: Client Release Check on: + pull_request: + branches: + - release-please--branches--tsmith/automate-release--components--cryoet-data-portal-python-client push: branches: - release-please--branches--tsmith/automate-release--components--cryoet-data-portal-python-client From 378a9b165b07061edde17364f4f3387fdf89e601 Mon Sep 17 00:00:00 2001 From: Bento007 Date: Fri, 2 Aug 2024 13:53:59 -0700 Subject: [PATCH 18/21] Add check that python test client passed --- .github/workflows/release-check.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/release-check.yml b/.github/workflows/release-check.yml index c235e9f8e..d47beca54 100644 --- a/.github/workflows/release-check.yml +++ b/.github/workflows/release-check.yml @@ -4,9 +4,11 @@ on: pull_request: branches: - release-please--branches--tsmith/automate-release--components--cryoet-data-portal-python-client + - tsmith/automate-release push: branches: - release-please--branches--tsmith/automate-release--components--cryoet-data-portal-python-client + - tsmith/automate-release jobs: release-check: From 39d57183725648c3cd654dacb6bfc505ff7b48e9 Mon Sep 17 00:00:00 2001 From: Bento007 Date: Fri, 2 Aug 2024 13:55:50 -0700 Subject: [PATCH 19/21] Add check that python test client passed --- .github/workflows/release-check.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-check.yml b/.github/workflows/release-check.yml index d47beca54..5f9d805fc 100644 --- a/.github/workflows/release-check.yml +++ b/.github/workflows/release-check.yml @@ -19,7 +19,7 @@ jobs: with: retries: 10 script: | - const { data } = await github.actions.listForRef({ + const { data } = await github.rest.checks.listForRef({ owner: context.repo.owner, repo: context.repo.repo, ref: 'main', From 6f73e27e106fbc1a202a4013b8a7eb30d5cc6b4c Mon Sep 17 00:00:00 2001 From: Bento007 Date: Fri, 2 Aug 2024 14:03:55 -0700 Subject: [PATCH 20/21] Add check that python test client passed --- .github/workflows/release-check.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release-check.yml b/.github/workflows/release-check.yml index 5f9d805fc..afd2b725d 100644 --- a/.github/workflows/release-check.yml +++ b/.github/workflows/release-check.yml @@ -26,6 +26,9 @@ jobs: check_name: 'Python Client Tests', filter: 'latest', }); - if (data.workflow_runs[0].conclusion !== 'success') { - core.setFailed('Tests failed on main'); + if (data.total_count === 0) { + core.setFailed('No checks found on main'); + } + if (data.check_runs[0].conclusion !== 'success') { + core.setFailed('Python Client Tests on main did not pass'); } From 2498634e7947a6f07a4260ef2f1aff6e73984412 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 20 Aug 2024 16:11:12 +0000 Subject: [PATCH 21/21] chore(tsmith/automate-release): release cryoet-data-portal-python-client 3.1.0 --- client/python/cryoet_data_portal/CHANGELOG.md | 22 +++++++++++++++++++ .../python/cryoet_data_portal/pyproject.toml | 2 +- .../src/cryoet_data_portal/__init__.py | 2 +- release-please.manifest.json | 2 +- 4 files changed, 25 insertions(+), 3 deletions(-) diff --git a/client/python/cryoet_data_portal/CHANGELOG.md b/client/python/cryoet_data_portal/CHANGELOG.md index e69de29bb..d569767d9 100644 --- a/client/python/cryoet_data_portal/CHANGELOG.md +++ b/client/python/cryoet_data_portal/CHANGELOG.md @@ -0,0 +1,22 @@ +# Changelog + +## [3.1.0](https://github.com/chanzuckerberg/cryoet-data-portal/compare/cryoet-data-portal-python-client-v3.0.3...cryoet-data-portal-python-client-v3.1.0) (2024-08-20) + + +### โœจ Features + +* add user agent to client requests ([#966](https://github.com/chanzuckerberg/cryoet-data-portal/issues/966)) ([8209cd4](https://github.com/chanzuckerberg/cryoet-data-portal/commit/8209cd46cb8ab21341c7ee94672db3bae78f9aa2)) + + +### ๐Ÿž Bug Fixes + +* add link to documentation to pypi ([38c76b4](https://github.com/chanzuckerberg/cryoet-data-portal/commit/38c76b450294d35a276d102ed816b12dd810ee99)) +* create recursive_from_prefix path if it does not exist ([#940](https://github.com/chanzuckerberg/cryoet-data-portal/issues/940)) ([0069f08](https://github.com/chanzuckerberg/cryoet-data-portal/commit/0069f080987ac05efef82d024cb17f4dc307a0f3)) +* Use match with substring for exception check in client tests ([#895](https://github.com/chanzuckerberg/cryoet-data-portal/issues/895)) ([07352ec](https://github.com/chanzuckerberg/cryoet-data-portal/commit/07352ecdb8c6f50ffe97ff7be9777c0cf6dd66cb)) + + +### ๐Ÿงน Miscellaneous Chores + +* Add additional test case to TestGetDestinationPath ([#955](https://github.com/chanzuckerberg/cryoet-data-portal/issues/955)) ([a9412a8](https://github.com/chanzuckerberg/cryoet-data-portal/commit/a9412a80f3b24ff94b0803fdd59d3583b4521706)) +* automate pypi release ([508516b](https://github.com/chanzuckerberg/cryoet-data-portal/commit/508516b956b14d6aa18c8f39b5c28938f0b49220)) +* prepare client for release automation ([d7e5446](https://github.com/chanzuckerberg/cryoet-data-portal/commit/d7e5446519aebfbc180eaef98a11ce65ec7d49dc)) diff --git a/client/python/cryoet_data_portal/pyproject.toml b/client/python/cryoet_data_portal/pyproject.toml index c9a1ded65..0d000ada7 100644 --- a/client/python/cryoet_data_portal/pyproject.toml +++ b/client/python/cryoet_data_portal/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "cryoet_data_portal" -version = "3.0.3" +version = "3.1.0" description = "API Client to facilitate the use of the CryoET Portal. For more information about the API and the project visit https://github.com/chanzuckerberg/cryoet-data-portal/" authors = [ { name = "Chan Zuckerberg Initiative", email = "cryoetdataportal@chanzuckerberg.com" } diff --git a/client/python/cryoet_data_portal/src/cryoet_data_portal/__init__.py b/client/python/cryoet_data_portal/src/cryoet_data_portal/__init__.py index 9fea659b7..8abd2bf4f 100644 --- a/client/python/cryoet_data_portal/src/cryoet_data_portal/__init__.py +++ b/client/python/cryoet_data_portal/src/cryoet_data_portal/__init__.py @@ -19,7 +19,7 @@ TomogramVoxelSpacing, ) -__version__ = "3.0.3" +__version__ = "3.1.0" __all__ = [ "Client", diff --git a/release-please.manifest.json b/release-please.manifest.json index 71f8ea008..826b45d1d 100644 --- a/release-please.manifest.json +++ b/release-please.manifest.json @@ -1,4 +1,4 @@ { "frontend": "1.22.0", - "client/python/cryoet_data_portal": "3.0.3" + "client/python/cryoet_data_portal": "3.1.0" }