Publishing extension to TestPyPI


I’m building a theme extension for JupyterLab. I’m new to this with limited exposure, but I’m picking up.

After I’d felt I’d done a fair job with the theme, I was trying to package and upload it to PyPI.

Before doing it with my extension, I tried to figure out how it works by uploading the extension template to a github repo. I figured I would use jupyter-releaser for the job, to streamline the release process. The action workflows are already bundled with the repo.

Before uploading to PyPI, I signed up to TestPyPI and obtained an API token to use the legacy method. I followed relevant instructions from these links:

  1. Convert a Repo to Use Releaser from Repo — Jupyter Releaser 1.3.0.dev0 documentation (
  2. Packaging Python Projects — Python Packaging User Guide

I added TWINE_REPOSITORY_URL: to the “Finalize Release” step in publish-release.yml and added the TestPyPI API token as PYPI_TOKEN in the repo secrets. I also uncommented the environment variables required to use the legacy method. However, the “Finalize Release” step still fails with the following error:

File "/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/requests/", line 1021, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 422 Client Error: Unprocessable Entity for url:
File "/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jupyter_releaser/", line 159, in run
      raise subprocess.CalledProcessError(
  subprocess.CalledProcessError: Command 'jupyter-releaser publish-assets' returned non-zero exit status 1.
  Error: Process completed with exit code 1.

The release still appears in my Github repo “Releases” section; but nothing is uploaded to TestPyPI and the token is not accessed. What am I doing wrong?


You may have found (or not?) the fix for your problem already. But for future readers here is the fix:

Remove the id-token entry from your workflow file (see Remove id-token setup · jupytercad/jupytercad-salome@849bf76 · GitHub).

This will prevent jupyter-releaser from trying to use PyPi’s trusted publishers logic if that’s not the way you want to publish.