Publishing your source code for others to use? Specify a licence, please!

Screenshot of Github's licence selector tool

Warning: Copyright law is broadly harmonised around the world, but, when it comes to permitted uses and exceptions, and, in particular, to "fair use", it is not. So this is the usual reminder that I am talking solely about English law.

You've written some software, and you want to make the source code available online, so that others can make use of it.

This blogpost will, hopefully, convince you to identify the terms under which you are making it available.

Why do I need to bother with a licence?

The short answer

The short answer is because, if you don't, you are limiting the ability of others to make use of your code.

You're limiting it to those willing to take a risk in using it, putting up a hurdle which doesn't need to be there.

You can fix this so easily by specifying a licence. I've included some options below.

The longer answer

The longer answer is this:

Copyright attracts automatically to various types of work, including literary works. Source code is an example of a literary work.

The threshold for the automatic application of copyright is low - so low, that it is more likely than not that, if you've got more than the tiniest, most inconsequential of snippets of code, it is subject to copyright.

And, assuming that you wrote it outside the course of your employment, and you haven't assigned the copyright to someone else, you own that copyright.

As the owner of the copyright work, certain rights are reserved to you. Rights which are very useful to someone who wants to use your code. For example, the right to copy it, or to alter it, or to compile it.

You can grant those rights to others, in the form of a licence.

But if you don't do that - if you don't grant a licence - everyone other than you is limited in what they can do with your source code. They are limited to the handful of things that the law lets them do without a licence, and that's pretty narrow.

Some people might be willing to take a risk, and work on the basis that, if you have chosen to put the code online, you are happy for others to use it. But that's risky. And if you genuinely want others to use your code, you're putting in place a hurdle which you could so readily remove.

I really don't care how people use it. Can't I just say that I am putting it in the public domain?

Sure, you can say it, but - under English law, at least - it has no obvious legal effect.

The public domain is basically the copyright equivalent of the afterlife: it is the place copyright works go, when the term of their restrictions has expired.

Unfortunately, in the case of literary works, the restrictions of copyright last for seventy years from the end of the year of your death. An incomprehensibly long time for software.

Assuming you want to let people make use of it a little sooner than that, you might think about saying "it's in the public domain". A public domain declaration, if you will.

The trouble is, copyright is a property right and, under English law, all property must have an owner. So the effect of saying "this is in the public domain" is unclear.

It probably signals your intent to let someone use it without restriction. And so some - many? - people might accept that you are unlikely to sue, even if the legal effect of your statement is ambiguous. And it probably gives the user a reasonable argument in favour of a broad implied licence. But it is uncertain.

As with not stating a licence, saying "it's in the public domain" is likely to stop some people from using your code, if they need legal certainty about the licensing status of your code. If you don't care about people in that quandary, then this might not be a particular disincentive, but you're back to that unnecessary hurdle again.

But if that's what you want - if you really want people to use your stuff - why not pick a licence which puts it beyond all reasonable doubt?

You might be interested in:

Okay, I'm convinced! But what licence should I pick?

The licence you want for your code depends on what you want to achieve.

There is a whole spectrum of Free and open source licences from which to select. In fact, there are so many, that the choice can be quite overwhelming.

If you need your code to be capable of integration with other projects, your choice of licence may be constrained. That gets a bit more complicated, so I am assuming here that that is not the case, and that you have a free choice.

The ideal situation might be to sit down and work out what you want - perhaps specific requirements about termination for infringement, or whether you want an explicit patent licence, or if you want to require people to make changes they make available under the same terms (and, if so, when). When you know what you want, you can identify a licence or licences which best fit your needs.

If you need a hand, please do get in touch.

Here's a shortlist of some of the more common options, grouped around the concept of "freedoms" or protections.

Developer freedom

At one end of the spectrum, you have licences which give as much freedom to developers as possible.

These are licences with very few obligations, and broad permissions to use the software. They are less protective of users' rights, and have fewer compliance obligations or limitations for developers.

If this sounds attractive, you might be interested in:

User freedom

At the other end of the spectrum, you have licences which preserve as much freedom as possible for users. To do that, they impose more obligations on developers, and so have a higher compliance burden.

These are sometimes known as "copyleft" licences, meaning that, for anything other than the licensee's own use, the licensee needs to preserve the requirements of the licence - and thus the rights of users - in any code based on the licensed code.

If this is what you want, you might like:

  • GNU GPL 2.0 or GNU GPL 3.0: probably the most well known (and perhaps also most mischaracterised?) Free software licences
  • Affero GPL 3.0: much the same as the GNU GPL 3.0, but with an additional trigger for source code distribution, based on making the software available for interaction over a network

There are myriad others

This is not an exhaustive list of possible licences, but some slightly more middle-of-the-spectrum options are:

I know, I should make up my own licence!

In the vast majority of cases, that's a bad idea.

In the first place, if you are reading a primer like this, you're probably not well positioned to come up with a licence which is better, or more suitable for your needs, than any of the existing licences. Sure, finding the right licence amount the many that exist may be a pain, but I strongly suspect that it is less of a pain than trying to write your own.

Even of the very limited list above, doesn't one of them meet your needs well enough, that you don't need to spend time coming up with something of your own?

In the second place, there's a strong chance that whatever you come up with causes more problems than it solves. Unless you are very careful, you are likely to end up with something which is incompatible with the stronger copyleft licences. Is that a problem? Up to you! If you're not sure whether it is a problem or not, I'd be wary.

How do I specify a licence?

How you say the licence under which you are making your code available depends on what you are distributing.

At the least - perhaps other than the smallest, most inconsequential code - at the top of each file, put at least the copyright symbol - (C) - the year, and a unique reference to the licence, and ideally a link to the licence.

Some licences include suggested text, for you to add to your project, to make the licence choice clear.

If you have a few source code files, you might also want to put the full licence text in a file called LICENSE. (I had previously suggested "LICENCE", but useful feedback was that the US spelling is more common.)