I am planning to open some my technical notes with example code snippets. Text will be in Markdown (.md) and reStructuredText (.rst) files. Output document (PDF or HTML) will be generated, let's say by Sphinx, and will be hosted on Read the Docs. Source code (md, rst and code snippets) will be hosted on Github. Flow is illustrated in the figure below.

I want to enable potential contributors contribute easily. On the other hand, I want to prohibit commercial usage. In that case how should I choose type [1], [2], [3]? How should I indicate licenses? Who are the copyright owners if someone contributes? I checked several online resources but couldn't find a clear solution.

Let's say that source code of text sections is licensed by [1], code snippets by [2] and final documents by [3]. I think that I can use CC BY-NC-SA 4.0 for type [3]. By doing so anyone can change the document but can't sell it. But what are proper choices for [1] and [2]? For [1], if source code of text is considered as code then I think CC BY-SA (with/with out NC) isn't suitable because usage of CC BY-SA is discouraged for code. If I choose CC BY-NC-SA for [1], can I use GPL for [2] and compile all sources to generate a output which is licensed as CC BY-NC-SA? Does this violates GPL?

Let's say that I decide which licens to use. How should I indicate licenses? I am planning to organize the source such that md and rst files are in Folder 1 and code snippets are in Folder 2. So should I create differente LICENSE file in each folder if [1] and [2] are different? Should I indicate a license (and probably copyright statement) in each file as a comment?

@Brandin Is there any alternative license model such that it allows collaboration but prohibits monetization? OK, I might have misused the word "open".
– AlperFeb 21 '19 at 18:45

How extensive are the code snippets? Are those snippets intended to be re-used by the readers of the document or are they merely an illustration of a point?
– Bart van Ingen SchenauFeb 21 '19 at 19:02

@BartvanIngenSchenau Snippets are only for illustration. They can be under the most permissive license. Actually I don't care snippets too much because they are simple example codes. But I am planning to keep them as separate files and include as text during compilation (by Sphinx). So I thought that I should say a license at least even if it is permissive.
– AlperFeb 21 '19 at 19:14

1 Answer
1

As the output document gets created by an automated process, there is not enough creative work in the creation of that document to make it copyrightable in its own right. The output document can only be licensed under the combination of licenses that cover the documentation source and the code snippets.
This means license [3] will be a combination of licenses [1] and [2].

For the code snippets, as you don't consider them that important for copyright protection, I would recommend to use the MIT license, which is a permissive license. But the GPL license is also a possibility.

For the document source, I would recommend CC BY-SA or a variation on it, because it comes closest to what you want to achieve.

Apart from adding LICENCE files to the various folders, you should also make sure that a clear indication ends up in the final document stating the license that applies to the text and the license that applies to the code snippets.

Thank you. I can't upvote due to my low reputation. For this model is there any possibility such that I can't mix two license types, [1] and [2], for particular license selection? If I use CC BY-SA for [1], can someone modify the text part and publish only output document, not the source code? Or does she/he have to also publish source code of the document? My concern comes from this statement: "...CC licenses do not contain specific terms about the distribution of source code...", creativecommons.org/faq/…
– AlperFeb 22 '19 at 19:25

I also want to keep integrity of the final document. If I choose MIT license for [2], somebody can modify it, make an intentional or unintentional error and publish the document. Since I am planning to add some copyright info in snippet code, it will look like my code is wrong. I think this is not a problem for CC BY-SA part because license page says that changes should be indicated. But this isn't the case most of software license like MIT, AFAIK. This is not a real problem for my small project, I am asking out of curiosity.
– AlperFeb 22 '19 at 20:20