Adding a python package to bioconda

We love bioconda! Our preferred way to add a python package to bioconda is via PyPi as it is the lazy solution (of course, Perl programmers are notoriously lazy, but Python programmers can be too!) Once you have the bioconda recipe working bots will take care of the updates for you!

Step 1. Update your repo

If you have not forked the bioconda-recipes repo, do so now and clone that fork into your working location. Then we are going to update it:

cd bioconda-recipes
git remote add upstream https://github.com/bioconda/bioconda-recipes.git
git remote add upstream https://github.com/bioconda/bioconda-recipes.git
git pull upstream master
git push origin master

You can check that you are up-to-date: head back to your GitHub repo, and you should see This branch is even with bioconda:master on the website.

Step 2. Make a branch to work in

In this example, I’m adding a release of phanotate, so I call the branch phanotate and then check I am on that branch

git checkout -b phanotate
git branch

Step 3. Copy an appropriate meta.yaml file to a new directory

I usually use phispy as my template, but note that it requires building with make, and if you have a pure python package you may not need that. (We almost always do, though!) Feel free to look through the other recipes for example code that you can use!

Some of our code has interesting features

  • fastq_pair and prinseq-plus-plus are downloaded from GitHub and compiled
  • py_fasta_validator and PhiSpy are downloaded from PyPi and compiled
cd recipes
cp -r phipsy phanotate

Step 4. Edit the meta.yaml file and change things as needed

You can leave many of the things as-is, obviously adding and removing as necessary. Note, that PhiSpy needs an upcase and lowercase name, but usually this is not required.

Step 4b. Get the ssa hash

You need the ssa 256 hash for this to work correctly. Here is how to get that in bash:

NAME=phanotate
VER=1.5.0
URL="https://pypi.io/packages/source/${NAME:0:1}/$NAME/$NAME-$VER.tar.gz"
wget -O- $URL | shasum -a 256

NOTE: When you do this it is important that you look at the output. Make sure that you see;

HTTP request sent, awaiting response... 200 OK

just before the wget ===== progress line. If you get a ERROR 404: Not Found message, you will still get an ssa hash but it will be wrong!!

Step 5. Commit the change to git

Now we commit and push our changes to our own repo

git add phanotate/meta.yaml
git commit -m 'initial release of phanotate' phanotate/meta.yaml
git push --set-upstream origin phanotate

Step 6. Create a pull request

I usually head over to the GitHub website for this (its just easier!). Create a PR against the original repository, and then wait. And wait. And wait some more.

Eventually, the circleCI will fail, and you will get some error messages that you will need to debug.

Good luck!