Skip to content

Releasing

ArshaanNazir edited this page Aug 22, 2023 · 40 revisions

Release Steps ๐Ÿ“ฎ

Pre-release steps to follow

  1. Edit the version name in the setup.py file
  2. Test installing your package locally by running pip install -e . from the project's root directory
  3. If install is successful, run unit tests in release branch
  4. If all tests pass, upload the beta release or release candidate to PyPI (steps detailed below)
  5. Test & use your release with pip install nlptest==version-name --pre (don't forget the --pre flag)
  6. Iterate as many times as necessary. If satisfied with release tests, proceed to stable release.

Stable release steps to follow

  1. Edit the version name in the setup.py file and sphinx/conf.py file
  2. Test installing your package locally by running pip install -e . from the project's root directory
  3. If install is successful, run unit tests in release branch
  4. If all tests pass, upload the stable release to PyPI (steps detailed below) - โš ๏ธ overwriting a release is basically impossible, so at this point you should be certain your package is fully functioning before uploading it
  5. Test & use your release with pip install nlptest==version-name
  6. Edit fn, url and sha256 in meta.yml file & release on Anaconda
  7. Create a new release on GitHub repo with release notes (steps detailed below)
  8. Announce release on socials

Guidelines ๐Ÿ“

๐Ÿง‘โ€๐Ÿณ Preparing a release

Version naming

Semantic Versioning guidelines are as follows: MAJOR.MINOR.PATCH.IDENTIFIER.NUMBER

Examples:

  • Beta release: version="1.0.0.beta.1"
  • Release candidate: version="1.0.0.rc.1"
  • Stable release: version="1.0.0"

This naming convention applies to both the PyPI uploads and the GitHub release tag names.

Branches

Releases should be made from release/ branches. Once the stable release is up and running on PyPI, the release/ branch can be merged into main.

๐Ÿ“ฆ Releasing on PyPI

Step 1: Clear previous builds Make sure the dist/directory is empty.

Step 2: Package the nlptest Python package

In the project's root directory, run:

python setup.py sdist bdist_wheel

This command creates a dist directory containing source distribution (.tar.gz) and wheel distribution (.whl) files.

Step 2: Upload the nlptest package to PyPI

Use twine to upload your package to PyPI:

twine upload dist/*

You'll be prompted to enter your PyPI username and password.

๐Ÿ Releasing on Anaconda

Setup

For a first-time release, install anaconda-client and conda-build:

conda install anaconda-client conda-build

Make sure you are logged in as JohnSnowLabs

anaconda login

Make sure you have these channels added

conda config --env --add channels johnsnowlabs
conda config --env --add channels conda-forge

Build

Create the .tar.gz file. Run the following in the root of the nlptest project to create the .tar.gz file which is contained in the /dist folder. This is already created when creating the PyPI release.

python setup.py sdist bdist_wheel 

Purge the previous builds:

conda build purge

Turn off auto-upload:

conda config --set anaconda_upload no

Update the values in meta.yaml: The sha256 field need to be updated to the values of the tar.gz PyPI upload or file. You can find this on the package's PyPI page in the Download files tab.

Build nlptest from the latest PyPI tar (note: this takes ~30mns locally):

cd conda/
conda build .

Test

Create a new anaconda venv and test the package locally before uploading.
If this runs error free, the package an be uploaded to anaconda

conda create -n langtest_release_<version> 
conda activate langtest_release_<version> 
conda install --use-local langtest
python
from langtest import Harness
h = Harness(task='ner', model={"model":'dslim/bert-base-NER', "hub":'huggingface'})
h.generate().run().report()

Upload

Upload all python versions of the Conda package to Anaconda Cloud:

anaconda upload ~/opt/anaconda3/conda-bld/noarch/langtest-1.3.0-py_0.tar.bz2

Install

Install spark-nlp by using conda:

conda install -c johnsnowlabs nlptest

Release on conda-forge

To release on the conda-forge channel, head over to https://github.com/conda-forge/nlptest-feedstock

Fork the repo, create a release branch in your fork, and create a PR updating the recipe/meta.yaml file with the latest release details.

After creating the PR send the following comment in the PR thread after checks have passed: @conda-forge-admin, please rerender

๐Ÿ’ป Releasing on GitHub

Step 1: Create a new tag name This should be the version name. Example: 1.0.0

Step 2: Pick the target branch For a stable release, this should be main.

Step 3: Give it a title This should be in the following format: John Snow Labs NLP Test 1.0.0

Step 4: Write release notes This has to be done well before the release is created. Here is an example of good release notes.

Step 5: Tick off "Create a discussion for this release"

Step 6: Publish release

๐Ÿ•ธ๏ธ Website and Docs Updates

Step 1: Change version number and re-render sphinx docs Update the version number in the sphinx/conf.py file and follow the instructions in the README.md file in the sphinx/ folder which guide you on how to re-run all sphinx docs and automatically move the re-rendered html files to the docs/ folder.

Step 2: Make website updates If the release has affected content on the website, make sure to update the website to reflect it.

Step 3: Make demo updates If the release has affected content on the demo notebooks, make sure to update them to reflect the changes.