Closed leouieda closed 3 years ago
We can always automate the process with bash
.
notice
file containing the copyright notice:
# Copyright (c) YEAR The PROJECT Developers.
# Distributed under the terms of the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause
bash
commands:
for i in $(find . -name "*.py" | grep -v "./doc/"); do cat notice $i > temp && mv temp $i; done
notice
file and you are ready to push all the changes.Or with Python 😉 :
from pathlib import Path
notice = """
# Copyright (c) YEAR The PROJECT Developers.
# Distributed under the terms of the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause
""".strip()
python_files = [
path for path in Path(".").glob("**/*.py") if not str(path).startswith(".")
]
print("Adding notice to:")
for pyfile in python_files:
print(f" {pyfile}")
code = pyfile.read_text()
pyfile.write_text("\n".join([notice, code]))
Actually, here is a better version that doesn't write the message twice by mistake:
from pathlib import Path
notice = """
# Copyright (c) YEAR The PROJECT Developers.
# Distributed under the terms of the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause
""".strip()
python_files = [
path for path in Path(".").glob("**/*.py") if not str(path).startswith(".")
]
print("Added notice to:")
for pyfile in python_files:
code = pyfile.read_text()
if not code.startswith(notice):
pyfile.write_text("\n".join([notice, code]))
print(f" {pyfile}")
cc @santisoler
How about adding # This code is part of the Fatiando a Terra project (https://www.fatiando.org)
to the end of the notice?
Sure! So the script should look like this then:
from pathlib import Path
notice = """
# Copyright (c) YEAR The PROJECT Developers.
# Distributed under the terms of the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause
#
# This code is part of the Fatiando a Terra project (https://www.fatiando.org)
#
""".strip()
python_files = [
path for path in Path(".").glob("**/*.py") if not str(path).startswith(".")
]
print("Added notice to:")
for pyfile in python_files:
code = pyfile.read_text()
if not code.startswith(notice):
pyfile.write_text("\n".join([notice, code]))
print(f" {pyfile}")
Citing here for context also https://www.gnu.org/licenses/gpl-faq.en.html#NoticeInSourceFile
Why should I put a license notice in each source file? (#NoticeInSourceFile)
You should put a notice at the start of each source file, stating what license it carries, in order to avoid risk of the code's getting disconnected from its license. If your repository's README says that source file is under the GNU GPL, what happens if someone copies that file to another program? That other context may not show what the file's license is. It may appear to have some other license, or no license at all (which would make the code nonfree).
Adding a copyright notice and a license notice at the start of each source file is easy and makes such confusion unlikely.
This has nothing to do with the specifics of the GNU GPL. It is true for any free license.
This :arrow_up: was the reason why I included it in every file of empymod
and emg3d
.
Pretty much done. Again, rockhound needs a rewrite so we'll sort this as part of that.
Description
We need to add a copyright notice and license information (name and terms) to every
.py
file. This can be found in the LICENSE files of each repository. The notice should be put in a comment at the top of the files:This is how MetPy does it.
I never thought that this was a big deal but I have since changed my mind. A couple of months ago I came across this repository: https://github.com/igp-gravity/geoist. Shockingly, it includes most files from
fatiando/fatiando
andfatiando/verde
without any mention or attribution. Some files even go so far as to claim authorship for the code (for example, the old code for coordinate generation). I have opened igp-gravity/geoist#7 to raise the issue of violation of our license terms and got a reply but so far nothing has happened. I don't particularly mind them reusing thefatiando/fatiando
code since we're not updating it anymore but I was really bothered by the lack of attribution and copying Verde.The package seems to include a whole bunch of code from other people just blatantly copied, some with the copyright and attribution intact (at least they didn't remove existing notices). This is what prompted this maintenance task. If we had the notice on our files, some of the bad feelings this generated might have been avoided. Though copying code instead of linking (importing) from active projects like Verde is generally frowned upon, it's prohibited by open-source licenses.
Apply changes to
Libraries:
Other repositories:
Further instructions
In order to solve this issue we need to start opening Pull Requests on each repository listed above. Optionally, we can open Issues on each repository if further discussion specific to that repository is needed.
Remember to mention this Issue on every Issue or Pull Request opened on each repository for keeping a record by adding something like:
A quick checklist:
We want your help
We know that maintenance tasks are very demanding, so we don't expect a single person to tackle this issue by themselves. Any help is very welcomed, so please comment below that you want to take care of the changes on any repository and we will assign it to you.