Skip to content

Publishing

Follow these instructions for releasing a new version of Mesop publicly via PyPI (e.g. pip install mesop).

Check main branch

Before, cutting a release, you'll want to check two things:

  1. The main branch should be healthy (e.g. latest commit is green).
  2. Check the snyk dashboard to review security issues:

    • It only runs weekly so you need to click "Retest now". If there's any High security issues for a core Mesop file (e.g. anything in mesop/*), then you should address it before publishing a release.

Update version to RC

Update mesop/version.py by incrementing the version number. We follow semver.

You want to first create an RC (release candidate) to ensure that it works.

For example, if the current version is: 0.7.0, then you should increment the version to 0.8.0rc1 which will create an RC, which is treated as a pre-release by PyPI.

Merge the PR that bumps the version and then go to the next step to publish a GitHub release which will in turn publish to PyPI.

Publish GitHub release

After you've submitted the PR which bumps the version and then publish a GitHub release.

  1. Click "Choose a tag" and type in the version you just released. This will create a new Git tag.
  2. Click "Generate release notes".
  3. If this is a an RC: Click "Set as a pre-release", otherwise leave the "Set as the latest release" checked.
  4. If this is a regular (non-RC) release, click "Create a discussion for this release".
  5. Click "Publish release".

Testing locally

Pre-requisite: you will need to install uv before doing the following steps.

Dev CLI

Run the following command but replace 1.0.0 with the version that you just published:

cd scripts/smoketest_app/ && uvx mesop==1.0.0 main.py

This will start the Mesop dev server and you can test that hot reload works. Double-check that the version shown is the version that you just released.

Gunicorn integration

Run the following command but replace 1.0.0 with the version that you just published:

cd scripts/smoketest_app/ && uvx --with mesop==1.0.0 gunicorn@latest main:me

This will launch Mesop under the Gunicorn server so you can make sure it works as expected.

Test on Colab

Because Colab installs from PyPI, you will need to test the RC on Colab after uploading to PyPI.

Open our Mesop Colab notebook. You will need to explicitly pip install the RC version as pip will not automatically install a pre-release version, even if it's the newest version. So change the first cell to something like:

 !pip install mesop==0.X.Yrc1

Tip: sometimes it takes a minute for the PyPI registry to be updated after upload, so just try again.

Then, run all the cells and make sure it works. Usually if something breaks in Colab, it's pretty obvious because the output isn't displayed, etc.

Change the version from RC to regular release

If you find an issue, then redo the above steps and create another RC candidate: 0.8.0rc1 -> 0.8.0rc2.

If all the testing looks good, then you can update mesop/version.py and change the version from RC to a regular release, for example:

0.8.0rc1 -> 0.8.0

Re-do the steps above to publish and test the release.