<jupyter_start><jupyter_text>Software Licensing  ReuseThis course is distributed under the [Creative Commons By Attribution license](https://creativecommons.org/licenses/by/3.0/), which means you can modify and reuse the materials, so long as you credit the original authors: [UCL Research IT Services](http://www.ucl.ac.uk/research-it-services/homepage).  DisclaimerHere we attempt to give some basic advice on choosing a license for your software. But:* we are NOT lawyers* opinions differ (and flamewars are boring)* this training does NOT constitute legal advice. For an in-depth discussion of software licenses, read the [O'Reilly book](http://www.amazon.co.uk/Understanding-Open-Source-Software-Licensing-ebook/dp/B0026OR3J4/ref=tmm_kin_title_0).Your department, or UCL, may have policies about applying licenses to code you create while a UCL employee or student. This training doesn't address this issue, and does not represent UCL policy -- seek advice from your supervisor or manager if concerned.  Choose a licenseIt is important to choose a license and to create a *license file* to tell people what it is. The license lets people know whether they can reuse your code andunder what terms. [This course has one](https://github.com/UCL/rsd-engineeringcourse/blob/master/LICENSE.md), for example.Your license file should typically be called LICENSE.txt or similar. GitHub will offer to create a license file automatically when you create a new repository.  Open source doesn't stop you making moneyA common misconception about open source software is the thought thatopen source means you can't make any money. This is *wrong*. Plenty of people open source their software and profit from:* The software under a different license e.g. [Saxon](http://saxon.sourceforge.net/)* Consulting. For example: [Continuum](http://continuum.io/consulting) who help maintain NumPy* Manuals. For example: [VTK](http://www.vtk.org/)* Add-ons. For example: [Puppet](http://puppetlabs.com/puppet/enterprise-vs-open-source)* Server software, which open source client software interacts with. For example: [GitHub API clients](https://github.com/octokit/octokit.rb)  Plagiarism vs promotionMany researchers worry about people stealing their work if they open source their code. But often the biggest problem is not theft, but the fact no one is aware of your work.Open source is a way to increase the probability that someone else on the planet will care enough about your work to cite you.So when thinking about whether to open source your code, think about whether you're more worried aboutanonymity or theft.  Your code *is* good enoughNew coders worry that they'll be laughed at if they put their code online. Don't worry. Everyone, including people who've been coding for decades, writes shoddy code that is full of bugs.The only thing that will make your code better, is *other people reading it*. For small scripts that no one but you will ever use,my recommendation is to use an open repository anyway. Find a buddy, and get them to comment on it.  Worry about license compatibility and proliferationNot all open source code can be used in all projects. Some licenses are legally incompatible.This is a huge and annoying problem. As an author, you might not care, but you can't anticipate the exciting uses people might find bymixing your code with someone else's. Use a standard license from the small list that are well-used.Then people will understand. *Don't make up your own*.When you're about to use a license, see if there's a more common one which is recommended, e.g.:using the [opensource.org proliferation report](http://opensource.org/proliferation-report)  Academic license proliferationAcademics often write their own license terms for their software.For example:>XXXX NON-COMMERCIAL EDUCATIONAL LICENSE>Copyright (c) 2013 Prof. Foo.>All rights reserved.>>You may use and modify this software for any non-commercial purpose within your educational >institution. Teaching, academic research, and personal experimentation are examples of purpose >which can be non-commercial.>>You may redistribute the software and modifications to the software for non-commercial >purposes, but only to eligible users of the software (for example, to another university>student or faculty to support joint academic research).Please don't do this. Your desire to slightly tweak the terms is harmful to thefuture software ecosystem. Also, *Unless you are a lawyer, you cannot do this safely!*  Licenses for code, content, and data.Licenses designed for code should not be used to license data or prose.Don't use Creative Commons for software, or GPL for a book.  Licensing issues* Permissive vs share-alike* Non-commercial and academic Use Only* Patents* Use as a web service  Permissive vs share-alikeSome licenses require all derived software to be licensed under terms that are similarly free.Such licenses are called "Share Alike" or "Copyleft".* Licenses in this class include the GPL.Those that don't are called "Permissive"* These include Apache, BSD, and MIT licenses.If you want your code to be maximally reusable, use a permissive licenseIf you want to force other people using your code to make derivatives open source, use a copyleft license.If you want to use code that has a permissive license, it's safe to use it and keep your code secret.If you want to use code that has a copyleft license, you'll have to release your code under such a license.  Academic use onlySome researchers want to make their code free for 'academic use only'.None of the standard licenses state this, and this is a reason why academic bespoke licenses proliferate.However, there is no need for this, in our opinion.*Use of a standard Copyleft license precludes derived software from being sold without also publishing the source*So use of a Copyleft license precludes commercial use.This is a very common way of making a business from open source code: offer the code under GPL for freebut offer the code under more permissive terms, allowing for commercial use, for a fee.  PatentsIntellectual property law distinguishes copyright from patents. This is a complex field, which I am far from qualified to teach!People who think carefully about intellectual property law distinguish software licensesbased on how they address patents. Very roughly, if a you want to ensure that contributors to your projectcan't then go off and patent their contribution, some licenses, such as the Apache license, protect you from this.  Use as a web serviceIf I take copyleft code, and use it to host a web service, I have not sold the software.Therefore, under some licenses, I do not have to release any derivative software.This "loophole" in the GPL is closed by the AGPL ("Affero GPL")  Library linkingIf I use your code just as a library, without modifying it or including it directly in my own code, does the copyleft term of the GPL apply?*Yes*If you don't want it to, use the LGPL. ("Lesser GPL"). This has an exception for linking libraries.  Citing softwareAlmost all software licenses require people to credit you for what they used ("attribution").In an academic context, it is useful to offer a statement as to how best to do this,citing *which paper to cite in all papers which use the software*.This is best done with a [CITATION](http://www.software.ac.uk/blog/2013-09-02-encouraging-citation-software-introducing-citation-files) file in your repository. > To cite ggplot2 in publications, please use:>>  <NAME>. ggplot2: elegant graphics for data analysis. Springer New York, 2009.>> A BibTeX entry for LaTeX users is>> @Book{,   author = {<NAME>},   title = {ggplot2: elegant graphics for data analysis},   publisher = {Springer New York},   year = {2009},   isbn = {978-0-387-98140-6},   url = {http://had.co.nz/ggplot2/book}, }  Referencing the license in every fileSome licenses require that you include license information in every file.Others do not. Typically, every file should contain something like:<jupyter_code># (C) The Alan Turing Institute 2010-2020
# This software is licensed under the terms of the <foo license>
# See <somewhere> for the license details.<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.057659418519423404, 'fraction_numerical': 0.006596628389934034, 'mean_word_length': 4.839514978601997, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 27, 'https://': 3, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '184690', 'license': 'CC-BY-3.0', 'n_tokens_mistral': 2084, 'n_tokens_neox': 1936, 'n_words': 1169, 'path': 'module06_software_projects/06_07_software_licensing.ipynb', 'repo_name': 'dmassegur/rse-course', 'size': '8198'}