|
| 1 | +# Making a new release of jupyterlab_myst |
| 2 | + |
| 3 | +The extension can be published to `PyPI` and `npm` manually or using the [Jupyter Releaser](https://github.com/jupyter-server/jupyter_releaser). |
| 4 | + |
| 5 | +## Manual release |
| 6 | + |
| 7 | +### Python package |
| 8 | + |
| 9 | +This extension can be distributed as Python packages. All of the Python |
| 10 | +packaging instructions are in the `pyproject.toml` file to wrap your extension in a |
| 11 | +Python package. Before generating a package, you first need to install some tools: |
| 12 | + |
| 13 | +```bash |
| 14 | +pip install build twine hatch |
| 15 | +``` |
| 16 | + |
| 17 | +Bump the version using `hatch`. By default this will create a tag. |
| 18 | +See the docs on [hatch-nodejs-version](https://github.com/agoose77/hatch-nodejs-version#semver) for details. |
| 19 | + |
| 20 | +```bash |
| 21 | +hatch version <new-version> |
| 22 | +``` |
| 23 | + |
| 24 | +To create a Python source package (`.tar.gz`) and the binary package (`.whl`) in the `dist/` directory, do: |
| 25 | + |
| 26 | +```bash |
| 27 | +python -m build |
| 28 | +``` |
| 29 | + |
| 30 | +> `python setup.py sdist bdist_wheel` is deprecated and will not work for this package. |
| 31 | +
|
| 32 | +Then to upload the package to PyPI, do: |
| 33 | + |
| 34 | +```bash |
| 35 | +twine upload dist/* |
| 36 | +``` |
| 37 | + |
| 38 | +### NPM package |
| 39 | + |
| 40 | +To publish the frontend part of the extension as a NPM package, do: |
| 41 | + |
| 42 | +```bash |
| 43 | +npm login |
| 44 | +npm publish --access public |
| 45 | +``` |
| 46 | + |
| 47 | +## Automated releases with the Jupyter Releaser |
| 48 | + |
| 49 | +The extension repository should already be compatible with the Jupyter Releaser. |
| 50 | + |
| 51 | +Check out the [workflow documentation](https://jupyter-releaser.readthedocs.io/en/latest/get_started/making_release_from_repo.html) for more information. |
| 52 | + |
| 53 | +Here is a summary of the steps to cut a new release: |
| 54 | + |
| 55 | +- Add `ADMIN_GITHUB_TOKEN`, `PYPI_TOKEN` and `NPM_TOKEN` to the [Github Secrets](https://docs.github.com/en/actions/security-guides/encrypted-secrets) in the repository |
| 56 | +- Go to the Actions panel |
| 57 | +- Run the "Step 1: Prep Release" workflow |
| 58 | +- Check the draft changelog |
| 59 | +- Run the "Step 2: Publish Release" workflow |
| 60 | + |
| 61 | +## Publishing to `conda-forge` |
| 62 | + |
| 63 | +If the package is not on conda forge yet, check the documentation to learn how to add it: https://conda-forge.org/docs/maintainer/adding_pkgs.html |
| 64 | + |
| 65 | +Otherwise a bot should pick up the new version publish to PyPI, and open a new PR on the feedstock repository automatically. |
0 commit comments