Skip to content

Instantly share code, notes, and snippets.

@meren
Last active October 17, 2021 12:17
Show Gist options
  • Select an option

  • Save meren/f8debee8322f40c2ddde to your computer and use it in GitHub Desktop.

Select an option

Save meren/f8debee8322f40c2ddde to your computer and use it in GitHub Desktop.
Making an anvi'o release
#################################################################################
#
# PREPARING RELEASE NOTES FOR A MAJOR RELEASE
#
#################################################################################
# if this is a major release,
# prepare a new logo.
# prepare comprehensive release notes. see examples for release notes here:
# https://github.com/meren/anvio/releases
#
# learn the number lines of code change between `master` and the previous release:
for i in `find . \( -name "*.py" -o -name "anvi-*" -o -name "*.js" \) | \
grep -v .pyc | \
grep -v __pycache__ | \
grep -v 'data/static/content' | \
grep -v 'interactive/lib' | \
grep -v test-output | \
grep -v '.git'`; \
do echo $i; done | \
xargs wc -l | sort -n
# learn the num lines of code change between master and the previous major release
git log --oneline v6 master | wc -l
#################################################################################
#
# SETTING UP THE BASICS
#
#################################################################################
# Take a look at issues.
# Take a look at PRs.
# Run all component and unit tests.
# Download previous datasets and migrate them --make sure they're working.
# Commit all necessary final changes.
# Create a branch called `new-release` both in anvi'o and web repositories. Make all commits (bug fixes, release number updates, etc, in these branches).
# Follow instructions in Dockerfile to see if conda is working.
# Test everything in the Docker container as well.
# If all above checks out, update the VERSION number inside the setup.py,
# Dockerfile, and conda recipes in `master` directory
# Commit all changes, and finally commit the changes in setup.py with the commit message
# -m 'vX.X'.
# TAG THE NEW RELEASE on GitHub.
# After tagging, update all VERSION numbers in the setup.py, Dockerfile, and conda
# recipes in `master` to use the '-master' postfix so those who use the master repository
# can continue using it.
#################################################################################
#
# UPDATING THE DOCKER CONTAINER
#
#################################################################################
# Follow instructions in Docker file to build a new docker image for the current
# version. Note: remember the checkout the tagged version of anvi'o from GitHub,
docker build -t meren/anvio:$VERSION .
# does it look alright?
docker images
# does it run alright?
sudo docker run --rm -it meren/anvio:$VERSION
# good! tag it as latest, and push it to the hub:
docker tag $ID meren/anvio:latest
# `- you learn the $ID from the "docker images" output
docker push meren/anvio
# edit _posts/anvio/2015-08-22-docker-image-for-anvio.md @ merenlab/web
#################################################################################
#
# TAGGING THE RELEASE AND CREATING THE TAR.GZ
#
#################################################################################
# This is to get a tar.gz file to upload to the release notes on GitHub and update
# PyPI
# start a new virtualenv
mkdir -p ~/virtual-envs
rm -rf ~/virtual-envs/new-release
virtualenv ~/virtual-envs/new-release
source ~/virtual-envs/new-release/bin/activate
# create a tmp directory, and clone the final repository with submodules (--recursive):
mkdir tmp
cd tmp
git clone --recursive --depth=1 https://github.com/meren/anvio.git
cd anvio
# install requirements
pip install -r requirements.txt
# don't ask why, but this is essential to include the submodule directories
# into the archive properly:
find . | grep -e ".git[^keep]" | xargs rm -rf && find . -name 'test-output' | xargs rm -rf
# make sure it builds properly
python setup.py build
# make sure the archive file it creates looks and installs ok
python setup.py sdist
# install the dist
cd dist/
tar -zxvf anvio-*gz
cd anvio-*
python setup.py install
cd ..
anvi-interactive -v
anvi-self-test
# all good? UPLOAD THE tar.gz to GitHub assets section under the release.
# Now it is time to upload the sdist to pypi. But the size
# limit for files to be sent to PyPI is 60 MB. So you first
# run this to get rid of SCG taxonomy databases (the users can
# rebuild them using anvi-setup-scg-taxonomy --reset):
rm -rf anvio/data/misc/SCG_TAXONOMY/
# and then send it to PyPI (that directory will come back):
python setup.py sdist upload
#################################################################################
#
# TAGGING THE RELEASE AND CREATING THE TAR.GZ
#
#################################################################################
# change the version number in merenlab/web (it is critical that this file does not have a newline character):
echo -n $VERSION > _includes/_project-anvio-version-number.html
# this one should be 6 if the version is 6.1, otherwise the release notes will be all leading to shit.
echo -n $VERSION_MAJOR > _includes/_project-anvio-version-number-major.html
# run the vignette
anvi-script-gen-programs-vignette -o _includes/_anvio-vignette.html
# run the network
anvi-script-gen-programs-network -o software/anvio/network/network.json
# Update the NEWS.md in anvio master.
# Let people know on anvi'o Google groups, Slack, and Twitter.
# Celebrate for 5 minutes until someone finds a bug
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment