|
| 1 | +## Developing and publishing the Dyalog Jupyter kernel |
| 2 | + |
| 3 | +We release from the master branch, and use semantic versioning. Releases are defined by the tag name. Find the current tag by |
| 4 | + |
| 5 | +``` |
| 6 | +git describe --tags `git rev-list --tags --max-count=1` |
| 7 | +``` |
| 8 | + |
| 9 | +For patch releases, add 1 to the last component of the current tag. |
| 10 | + |
| 11 | +Update the `__version__` string in `dyalog_kernel/__main__.py` accordingly, and the `version` key in `setup.py`. |
| 12 | + |
| 13 | +The patch level should reset if we're changing major or minor version components, following semver. |
| 14 | + |
| 15 | +Build release assets with |
| 16 | + |
| 17 | +```sh |
| 18 | +python setup.py sdist bdist_wheel |
| 19 | +``` |
| 20 | + |
| 21 | +Built assets will end up in `dist/`, and you can instruct `pip` to install from file for testing: |
| 22 | + |
| 23 | +```sh |
| 24 | +pip install dist/dyalog-jupyter-kernel-x.y.z.tar.gz |
| 25 | +``` |
| 26 | + |
| 27 | +Now tag the master branch with the new version (prefixed by `v.`): |
| 28 | + |
| 29 | +``` |
| 30 | +git tag -a v2.0.1 -m "Release version 2.0.1" |
| 31 | +git push origin v2.0.1 |
| 32 | +``` |
| 33 | + |
| 34 | +Upload release assets using [twine](https://twine.readthedocs.io/en/stable/). Install `twine` with |
| 35 | + |
| 36 | +```sh |
| 37 | +pip install twine |
| 38 | +``` |
| 39 | + |
| 40 | +Pick up the API token, and set up your `$HOME/.pypirc` file like this: |
| 41 | + |
| 42 | +``` |
| 43 | +[distutils] |
| 44 | +index-servers = |
| 45 | + pypi |
| 46 | + testpypi |
| 47 | +
|
| 48 | +[pypi] |
| 49 | +username = __token__ |
| 50 | +password = pypi-A...Z # Replace with your actual PyPI API token |
| 51 | +
|
| 52 | +[testpypi] |
| 53 | +username = __token__ |
| 54 | +password = pypi-A...Z # Replace with your actual TestPyPI API token |
| 55 | +``` |
| 56 | + |
| 57 | +Use the API key(s) as password, including the `pypi-` prefix. |
| 58 | + |
| 59 | +Upload the release to the test index first, and test that: |
| 60 | + |
| 61 | +```sh |
| 62 | +twine upload --repository testpypi dist/* |
| 63 | +``` |
| 64 | + |
| 65 | +To install the module from the test index, use |
| 66 | + |
| 67 | +```sh |
| 68 | +pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple dyalog-jupyter-kernel[==2.0.1] |
| 69 | +python -m 'dyalog_kernel' install |
| 70 | +``` |
| 71 | +The `--extra-index-url` argument is there so that `pip` can pick up any dependencies from the main index. |
| 72 | + |
| 73 | +Upload the release to the main index, and test that: |
| 74 | + |
| 75 | +```sh |
| 76 | +twine upload --repository pypi dist/* |
| 77 | +``` |
0 commit comments