I want to opensource my code. Is it legal? Can I still publish? I am a PhD (stipend) student at a Max Planck Institute (for a biological science) here in Germany. I came here to write software, but ended up spending practically all my time doing wet-lab work. As a consequence, the programming I wanted to do had to be done in the evenings outside of the institute (although what constitutes 'PhD time' and 'programming time' is a bit of a blur, since I use my programs to solve PhD problems...)

Coming to the end of the PhD, I am now finally ready to "publish" the first of the three programs I have written during my time here in Germany, but there are three stakeholders all with competing interests in my software which make it difficult for me to know how to proceed...

The Max Planck - they will want to claim ownership of the software, because I wrote it while doing a PhD with them. Over the course of the PhD, no one from the Max Plank or the University have had any input whatsoever on the software, however, certainly between 10-20% of the code was developed 'on PhD time'.

The Journals - publishing is not a requirement, but it would be nice. It forms a stamp of approval (in some people's minds) and acts as free advertising at the very least. But for this to happen, I suppose I cannot "publish" my code already, meaning open source it and share it so people can bug-check it before publication?

The Users - Arguably the most important stakeholder for me, because I wrote this software for them. I want to make the code's licence as permissive as legally possible, probably under Creative Commons Zero to aid with this, but I feel this will make publishing impossible, and it may not even be allowed if I am not the owner of the copyright in the first place.

How should I proceed?
I'm the main developer of several open-source libraries, one published and one under review, so I can give you a pretty up-to-date overview on open-source in the machine learning community. This may differ for your field, but probably not much.

Whether or not your university will allow you to open-source and/or publish depends entirely on them. Based on my experience, open-sourcing can be sensitive depending on how old-fashioned your university/lab is. However, if they are fine with open-sourcing, they will certainly be OK with publishing too (after all, it's a free paper!). Only way to know is to ask your advisor.

The only move you have here is to ask your advisor. To my knowledge, at least some MPIs are very much in favor of open-source (e.g. Bernhard Schölkopf, head of MPI intelligent systems, is a co-author of an important open-source mission statement within machine learning).

Releasing software before publication


  I suppose I cannot "publish" my code already, meaning open source it and share it so people can bug-check it before publication?


Yes you can and in fact you should. Typically you need to show active user interest before you can publish your software formally (e.g. github stars, download, mentions on twitter, ...). See for instance JMLR MLOSS guidelines, which state "Evidence of an active user community should be demonstrated ...".

In any case, releasing software prior to submitting your paper is not a problem. Publications don't work like patents.

Publication venues

Lately, there is a lot of journal interest in software. To name a few:


JMLR MLOSS
Plos Computational Biology: Software
The R Journal
Journal of Statistical Software


A more complete list is available at http://www.software.ac.uk/resources/guides/which-journals-should-i-publish-my-software

Next to journals, you have a lot of conferences/workshops specifically about software. For many projects, you are actually better off publishing there with the added benefit of shorter review times and far less drama.

License


  I want to make the code's licence as  permissive as legally possible, probably under Creative Commons Zero to aid  with this ...


Creative Commons licenses aren't really suitable for software. Be aware that choosing an open-source license isn't entirely trivial, that is open-source licenses don't necessarily allow users to do whatever they want. Most commonly used permissive licenses include BSD, MIT, Apache and WTF licenses as opposed to the GPL. I do recommend informing yourself about the main differences of highly permissive licenses vis-a-vis GPL-style licenses. Some questions you should ask yourself include


Do you want your license to permit commercial use within closed-source projects for free? If not, slap a GPL on it and (optionally) dual license your software.
Do you want to permit non-GPL open-source software to build upon your work? If so, then make sure your license isn't GPL (this is because of the copyleft nature of the GPL).


In my opinion, the best license types for relatively small (but useful) research software projects are usually highly permissive (BSD, Apache, ...). Your university's technology transfer office may disagree, if you even have to go through them (if MPI claims IP ownership of the software you developed you have to pass through the TTO).