Skip to content

Commit e7f9453

Browse files
committed
EHN: Add interpretation of Apache-2.0 and set expectations
This PR addresses the discussion in nipreps/fmriprep#2325.
1 parent ec97a71 commit e7f9453

File tree

2 files changed

+149
-0
lines changed

2 files changed

+149
-0
lines changed

docs/community/licensing.md

Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
# Licensing and Derived Works
2+
3+
All software packages and tools under the *NiPreps* umbrella must be licensed under the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0) by default, unless otherwise stated.
4+
The authors of new packages may not abide by this general rule of thumb if necessary and/or sufficiently justified (e.g., the source code is actually derived from a product licensed under a copyleft license).
5+
Data (distributed within the test data of packages or through the [`nipreps-data` GitHub organization](https://github.com/nipreps-data)) will preferably be distributed under the [Creative Commons Zero v1.0 Universal](https://choosealicense.com/licenses/cc0-1.0/).
6+
7+
## The Apache License 2.0
8+
9+
(This section is adapted from this [blog post by D. Marín](https://www.toptal.com/open-source/developers-guide-to-open-source-licenses))
10+
11+
The Apache License was created by the Apache Software Foundation (ASF) as the license for its Apache HTTP Server.
12+
13+
Just as the [MIT License](https://choosealicense.com/licenses/mit/), it’s a very permissive non-copyleft license that allows using the software for any purpose, distributing it, modifying it, and distributing derived works of it without concern for royalties. Its main differences, compared to the MIT License, are:
14+
15+
* Using the Apache License, the authors of the software grant patent licenses to any user or distributor of the code. This patent licenses apply to any patent that, being licenseable by any of the software author, would be infringed by the piece of code they have created.
16+
* Apache License required that unmodified parts in derived works keep the License.
17+
* In every licensed file, any original copyright, patent, trademark or attribution notices must be preserved.
18+
* In every licensed file change, there must be a notification stating that changes have been made in the file.
19+
* If the Apache-licensed software includes a `NOTICE` file, this file and its contents must be preserved in all the derived works.
20+
* If anyone intentionally sends a contribution for an Apache-licensed software to its authors, this contribution can automatically be used under the Apache License.
21+
22+
This license is interesting because of the automatic patent license, and the clause about contribution submission.
23+
24+
It’s compatible with the GPL, so you can mix Apache licensed-code into GPL software.
25+
26+
## Why Apache-2.0?
27+
28+
In the case of scientific software, we believe that clearly stating that a Derived Work introduces changes into the original Work is a fundamental measure of transparency.
29+
Other than that, we wanted a permissive, non-copyleft license.
30+
31+
## What is our expectation for Derived Works?
32+
33+
At the bare minimum, you must meet the conditions of the license ([simplified version](https://choosealicense.com/licenses/apache-2.0/)) about preserving the license text and copyright/attribution notices as well as corresponding statements of changes.
34+
35+
**How to state that a file has been changed in ad Derived Work.**
36+
We suggest to follow the advice by [P. Ombredanne at StackExchange](https://opensource.stackexchange.com/a/4420):
37+
38+
1. In each source file, add a note to the header comment stating that the file has been modified, with an approximate date, and a high-level description of the changes.
39+
The date and the description of the changes are not strictly required, but they are positive etiquette from a software engineering standpoint and substantially improve the transparency of the changes from a scientific point of view.
40+
1. If the source file did not have a license notice in the header comment, please add it to avoid ambiguity.
41+
1. Deleted files: please keep the file with just the header comment and state that the file is deleted.
42+
The change statement should follow the suggestion in 1), preferably stating whether the source has been deleted or moved over to other files.
43+
If preserving the filename as-is might become confusing to the user of the Derived Work, the filename can be modified to be marked as hidden with a dot `.` or underscore `_` prefix, or modifying the extension.
44+
1. Preferably, also include a link to the original file in our GitHub repository, making sure the link is done to a particular commit state.
45+
46+
**What changes would we like to see annotated?**
47+
The *high-level description of the changes* will preferably contain:
48+
49+
* Correction of bugs
50+
* Substantial performance improvement decisions
51+
* Replacement of relevant methods and dependencies by alternatives
52+
* Changes to the license
53+
54+
## Example of our expectations
55+
56+
Let's say a Derived Work modifies the `sdcflows.viz.utils` code-base.
57+
At the time of writing, the header comment of [this file](https://github.com/nipreps/sdcflows/blob/50393a8584dd0abf5f8e16e6ba66c43e1126f844/sdcflows/viz/utils.py) is:
58+
59+
``` {.python linenos=true title="Original Work header comment"}
60+
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
61+
# vi: set ft=python sts=4 ts=4 sw=4 et:
62+
#
63+
# Copyright 2021 The NiPreps Developers <[email protected]>
64+
#
65+
# Licensed under the Apache License, Version 2.0 (the "License");
66+
# you may not use this file except in compliance with the License.
67+
# You may obtain a copy of the License at
68+
#
69+
# http://www.apache.org/licenses/LICENSE-2.0
70+
#
71+
# Unless required by applicable law or agreed to in writing, software
72+
# distributed under the License is distributed on an "AS IS" BASIS,
73+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
74+
# See the License for the specific language governing permissions and
75+
# limitations under the License.
76+
"""Visualization tooling."""
77+
```
78+
79+
Some files may not have the attribution notice, for example:
80+
``` {.python linenos=true title="Original Work header comment"}
81+
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
82+
# vi: set ft=python sts=4 ts=4 sw=4 et:
83+
"""Visualization tooling."""
84+
```
85+
86+
Either way (whether the attribution notice is present or not), we suggest to update this header comment to something along the lines of the following:
87+
88+
``` {.python linenos=true title="Derived Work header comment"}
89+
# <shebang and editor settings can be preserved or removed freely>
90+
#
91+
# <your attribution notice, either maintaining the Apache-2.0 license or changing the license>
92+
#
93+
# STATEMENT OF CHANGES: This file is derived from sources licensed under the Apache-2.0 terms,
94+
# and this file has been changed.
95+
# <recommended> The original file this work derives from is found at:
96+
# https://github.com/nipreps/sdcflows/blob/50393a8584dd0abf5f8e16e6ba66c43e1126f844/sdcflows/viz/utils.py
97+
# <alternative> The original file this work derives from is found within
98+
# the version 2.0.2 distribution of the software.
99+
#
100+
# <recommended> [April 2021] CHANGES:
101+
# * BUGFIX: Outdated function call from the ``svgutils`` dependency that changed API as of version 0.3.2.
102+
# * ENH: Changed plotting dependency to the new `netplotbrain` package.
103+
# * DOC: Added docstrings to some functions that lacked them.
104+
#
105+
# ORIGINAL WORK'S ATTRIBUTION NOTICE:
106+
#
107+
# Copyright 2021 The NiPreps Developers <[email protected]>
108+
#
109+
# Licensed under the Apache License, Version 2.0 (the "License");
110+
# you may not use this file except in compliance with the License.
111+
# You may obtain a copy of the License at
112+
#
113+
# http://www.apache.org/licenses/LICENSE-2.0
114+
#
115+
# Unless required by applicable law or agreed to in writing, software
116+
# distributed under the License is distributed on an "AS IS" BASIS,
117+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
118+
# See the License for the specific language governing permissions and
119+
# limitations under the License.
120+
"""Visualization tooling."""
121+
```
122+
123+
Although it is not mandated by the license letter, the spirit of the Apache-2.0 (and all other licenses stipulating the statement of changes, such as the CC-BY 4.0) suggests that a date of modification and an overview of outstanding changes are pertinent.
124+
We also suggest a link to the original code, including the commit-hash (that long string starting with `50393a` in the URL above) for the location of the exact origin of the file.
125+
Alternatively, Derived Works may point to a exact release identifier where the original file is part of the code-base distribution.
126+
Please make sure to remove or replace with appropriate contents the comment tags `<...>` above.
127+
128+
**What if a Derived Work does not modify this particular file?**
129+
You should retain the original attribution notice as is (or introduce it if missing), unless you are relicensing the file.
130+
In that case, proceed with the suggestions above, and note the license change in the *STATEMENT OF CHANGES* block of the header comment.
131+
132+
## Are papers using Apache-2.0 licensed software considered as Derived Works?
133+
134+
No, they don't because they only ***reuse*** the software (in other words, they don't *redistribute* the software).
135+
The license stipulates that *redistribution* must retain the license and attribution notices as they are.
136+
In the scientific context, it is likely that a particular tool is modified (for example, to replace a method that you think is not appropriate for your data).
137+
Then, *redistribution* of the source would be desirable from the transparent reporting point of view, and therefore you should honor the License.
138+
139+
Generally, works using our *NiPreps* just need to follow the citation guidelines of the particular project and report the *citation boilerplate* including all software versions and literature references in the closest letter possible to that generated by the tool.
140+
141+
## Licensing of Docker and Singularity images
142+
143+
Container images redistribute copies of *NiPreps* alongside their third-party dependencies, all of them bundled in the image.
144+
That means that the text of a `NOTICE` file must be shown to the user.
145+
All *NiPreps* must insert a `NOTICE` file into their containerized distributions and print its contents out in the command line output, as well as in the visual reports.
146+
This `NOTICE` file for containers will be placed in the `/.docker/NOTICE` path of the repository.
147+
If the particular project already has a `NOTICE` file, the contents of `/.docker/NOTICE` must be appended to the `/NOTICE` file at image building time.

mkdocs.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ nav:
2525
- New features: community/features.md
2626
- Contributing: community/CONTRIBUTING.md
2727
- Code of Conduct: community/CODE_OF_CONDUCT.md
28+
- Licensing: community/licensing.md
2829
- Developers:
2930
- Versions Matrix: devs/versions.md
3031
- Releases: devs/releases.md
@@ -36,6 +37,7 @@ theme:
3637
markdown_extensions:
3738
- admonition
3839
- codehilite
40+
- fenced_code
3941
- footnotes
4042
- toc:
4143
permalink: true

0 commit comments

Comments
 (0)