diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..5b635e4 --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,22 @@ +MIT License + +Copyright (c) 2019-2025 Ádám Fekete, Gábor Csányi, Tamás K. Stenczel, Elena Gelzinyte, +Elliott Kasoar, Alin Marin Elena + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md index a56a44f..4350f6b 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,6 @@ # ABCD +[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![Doc](https://img.shields.io/badge/docs-master-green.svg)](https://libatoms.github.io/abcd/) [![Build Status](https://travis-ci.org/libAtoms/abcd.svg?branch=master)](https://travis-ci.org/libAtoms/abcd) diff --git a/abcd/backends/atoms_http.py b/abcd/backends/atoms_http.py index e1b8eca..da66738 100644 --- a/abcd/backends/atoms_http.py +++ b/abcd/backends/atoms_http.py @@ -1,3 +1,7 @@ +# Copyright (c) 2025. +# Authors: Ádám Fekete, Elliott Kasoar, Tamás K. Stenczel +# This program is distributed under the MIT License, see LICENSE.md. + import json import logging from os import linesep diff --git a/abcd/backends/atoms_pymongo.py b/abcd/backends/atoms_pymongo.py index da230fb..84d402f 100644 --- a/abcd/backends/atoms_pymongo.py +++ b/abcd/backends/atoms_pymongo.py @@ -1,3 +1,7 @@ +# Copyright (c) 2025. +# Authors: Ádám Fekete, Elliott Kasoar, Tamás K. Stenczel, Gábor Csányi +# This program is distributed under the MIT License, see LICENSE.md. + from collections import Counter from collections.abc import Iterable from datetime import datetime diff --git a/abcd/database.py b/abcd/database.py index d0e0296..64a36d5 100644 --- a/abcd/database.py +++ b/abcd/database.py @@ -1,3 +1,7 @@ +# Copyright (c) 2025. +# Authors: Ádám Fekete, Elliott Kasoar, Tamás K. Stenczel +# This program is distributed under the MIT License, see LICENSE.md. + # ruff: noqa: B024, B027 from abc import ABCMeta import logging diff --git a/abcd/errors.py b/abcd/errors.py index f8cb516..53264f8 100644 --- a/abcd/errors.py +++ b/abcd/errors.py @@ -1,3 +1,8 @@ +# Copyright (c) 2025. +# Authors: Ádám Fekete, Tamás K. Stenczel +# This program is distributed under the MIT License, see LICENSE.md. + + class ABCDError(Exception): pass diff --git a/abcd/frontends/commandline/commands.py b/abcd/frontends/commandline/commands.py index 5d7d701..4cd6e6d 100644 --- a/abcd/frontends/commandline/commands.py +++ b/abcd/frontends/commandline/commands.py @@ -1,3 +1,7 @@ +# Copyright (c) 2025. +# Authors: Ádám Fekete, Elliott Kasoar, Tamás K. Stenczel, Gábor Csányi, Elena Gelzinyte +# This program is distributed under the MIT License, see LICENSE.md. + import logging import os diff --git a/abcd/frontends/commandline/config.py b/abcd/frontends/commandline/config.py index 7178b37..283ae58 100644 --- a/abcd/frontends/commandline/config.py +++ b/abcd/frontends/commandline/config.py @@ -1,3 +1,7 @@ +# Copyright (c) 2025. +# Authors: Ádám Fekete, Elliott Kasoar, Tamás K. Stenczel +# This program is distributed under the MIT License, see LICENSE.md. + import json import logging import os diff --git a/abcd/frontends/commandline/decorators.py b/abcd/frontends/commandline/decorators.py index 8fb3749..beabd3f 100644 --- a/abcd/frontends/commandline/decorators.py +++ b/abcd/frontends/commandline/decorators.py @@ -1,3 +1,7 @@ +# Copyright (c) 2025. +# Authors: Ádám Fekete, Elliott Kasoar, Tamás K. Stenczel +# This program is distributed under the MIT License, see LICENSE.md. + import logging from abcd import ABCD diff --git a/abcd/frontends/commandline/parser.py b/abcd/frontends/commandline/parser.py index 71aaca1..d8ead23 100644 --- a/abcd/frontends/commandline/parser.py +++ b/abcd/frontends/commandline/parser.py @@ -1,3 +1,7 @@ +# Copyright (c) 2025. +# Authors: Ádám Fekete, Elliott Kasoar, Tamás K. Stenczel, Elena Gelzinyte +# This program is distributed under the MIT License, see LICENSE.md. + from argparse import ArgumentParser import logging diff --git a/abcd/model.py b/abcd/model.py index 15a1ece..5247738 100644 --- a/abcd/model.py +++ b/abcd/model.py @@ -1,3 +1,7 @@ +# Copyright (c) 2025. +# Authors: Ádám Fekete, Elliott Kasoar, Tamás K. Stenczel +# This program is distributed under the MIT License, see LICENSE.md. + from collections import Counter, UserDict import datetime import getpass diff --git a/abcd/parsers/extras.py b/abcd/parsers/extras.py index af99fd0..8d5db3d 100644 --- a/abcd/parsers/extras.py +++ b/abcd/parsers/extras.py @@ -1,5 +1,8 @@ -# ruff: noqa: E731 +# Copyright (c) 2025. +# Authors: Ádám Fekete, Elliott Kasoar, Tamás K. Stenczel +# This program is distributed under the MIT License, see LICENSE.md. +# ruff: noqa: E731 from lark import Lark, Transformer, v_args grammar = r""" diff --git a/abcd/parsers/queries.py b/abcd/parsers/queries.py index 530d5ef..5a88815 100644 --- a/abcd/parsers/queries.py +++ b/abcd/parsers/queries.py @@ -1,5 +1,8 @@ -# ruff: noqa: E731 +# Copyright (c) 2025. +# Authors: Ádám Fekete, Elliott Kasoar, Tamás K. Stenczel +# This program is distributed under the MIT License, see LICENSE.md. +# ruff: noqa: E731 import logging from lark import Lark, Transformer, v_args diff --git a/abcd/parsers/queries_new.py b/abcd/parsers/queries_new.py index 3467be4..253b84f 100644 --- a/abcd/parsers/queries_new.py +++ b/abcd/parsers/queries_new.py @@ -1,3 +1,7 @@ +# Copyright (c) 2025. +# Authors: Ádám Fekete, Elliott Kasoar, Tamás K. Stenczel +# This program is distributed under the MIT License, see LICENSE.md. + import logging from lark import Lark, Transformer diff --git a/abcd/queryset.py b/abcd/queryset.py index 5b00df0..7824b44 100644 --- a/abcd/queryset.py +++ b/abcd/queryset.py @@ -1,3 +1,7 @@ +# Copyright (c) 2025. +# Authors: Ádám Fekete, Elliott Kasoar, Tamás K. Stenczel +# This program is distributed under the MIT License, see LICENSE.md. + from abc import ABCMeta import logging diff --git a/abcd/server/app/db.py b/abcd/server/app/db.py index eadc1f4..f0f1e0f 100644 --- a/abcd/server/app/db.py +++ b/abcd/server/app/db.py @@ -1,3 +1,7 @@ +# Copyright (c) 2025. +# Authors: Ádám Fekete, Elliott Kasoar, Tamás K. Stenczel +# This program is distributed under the MIT License, see LICENSE.md. + from abcd import ABCD # from flask_paginate import Pagination, get_page_args diff --git a/abcd/server/app/nav.py b/abcd/server/app/nav.py index 31c8ede..d09a7d7 100644 --- a/abcd/server/app/nav.py +++ b/abcd/server/app/nav.py @@ -1,3 +1,9 @@ +# Copyright (c) 2025. +# Authors: Ádám Fekete, Elliott Kasoar, Tamás K. Stenczel +# This program is distributed under the MIT License, see LICENSE.md. + +from flask_nav import Nav +from flask_nav.elements import Navbar, View, Separator, Subgroup, Link from hashlib import sha1 from dominate import tags diff --git a/abcd/server/app/views/api.py b/abcd/server/app/views/api.py index 26f5b99..61a9a5f 100644 --- a/abcd/server/app/views/api.py +++ b/abcd/server/app/views/api.py @@ -1,3 +1,7 @@ +# Copyright (c) 2025. +# Authors: Ádám Fekete, Elliott Kasoar, Tamás K. Stenczel +# This program is distributed under the MIT License, see LICENSE.md. + from flask import Blueprint, Response, jsonify, request bp = Blueprint("api", __name__) diff --git a/abcd/server/app/views/database.py b/abcd/server/app/views/database.py index 607dc8b..60922e3 100644 --- a/abcd/server/app/views/database.py +++ b/abcd/server/app/views/database.py @@ -1,3 +1,7 @@ +# Copyright (c) 2025. +# Authors: Ádám Fekete, Elliott Kasoar, Tamás K. Stenczel +# This program is distributed under the MIT License, see LICENSE.md. + from flask import Blueprint, Response, render_template, request bp = Blueprint("database", __name__) diff --git a/abcd/server/app/views/index.py b/abcd/server/app/views/index.py index 37faa52..1fde34e 100644 --- a/abcd/server/app/views/index.py +++ b/abcd/server/app/views/index.py @@ -1,3 +1,7 @@ +# Copyright (c) 2025. +# Authors: Ádám Fekete, Elliott Kasoar, Tamás K. Stenczel +# This program is distributed under the MIT License, see LICENSE.md. + from flask import Blueprint, render_template, url_for # from flask import Blueprint, render_template, flash, redirect, url_for, request diff --git a/devtools/update_copyright.py b/devtools/update_copyright.py new file mode 100644 index 0000000..1ebaf82 --- /dev/null +++ b/devtools/update_copyright.py @@ -0,0 +1,94 @@ +# Copyright (c) 2025. +# Authors: Tamás K. Stenczel +# This program is distributed under the MIT License, see LICENSE.md. + +"""Add or update copyright notice to all python files.""" + +from datetime import date +import os +import re +import subprocess + +# git users -> real name mapping for current contributors +USER_TO_REAL_NAME = { + "stenczelt": "Tamás K. Stenczel", + "Tamas K Stenczel": "Tamás K. Stenczel", + "Tamas Stenczel": "Tamás K. Stenczel", + "T. K. Stenczel": "Tamás K. Stenczel", + "Adam Fekete": "Ádám Fekete", + "ElliottKasoar": "Elliott Kasoar", + "gelzinyte": "Elena Gelzinyte", + "gabor1": "Gábor Csányi", + "gabor": "Gábor Csányi", +} + + +def get_contributors(file_path): + """Get list of contributors for a given file.""" + command = f"git log --pretty=format:'%an' {file_path} | sort | uniq" + contributors = subprocess.check_output(command, shell=True, text=True) + contributors = contributors.strip().split("\n") + + # Map usernames to real names, if possible + real_name_contributors = [] + for contributor in contributors: + if contributor == "": + continue + real_name = USER_TO_REAL_NAME[contributor] + if real_name not in real_name_contributors: + real_name_contributors.append(real_name) + + return real_name_contributors + + +def insert_copyright(file_path, contributors): + """Insert a copyright notice at the top of a file.""" + # Create the copyright notice string + author_names = ", ".join(contributors) + copyright_notice = ( + f"# Copyright (c) {date.today().year}.\n" + f"# Authors: {author_names}\n" + f"# This program is distributed under the MIT License, see LICENSE.md.\n\n" + ) + + with open(file_path) as file: + content = file.read() + + # replace existing notice if needed + pattern = re.compile( + r"^# Copyright \(c\) [\d-]+\.\n" + r"# Authors:\s*(.*?)\n" + r"# This program is distributed under the MIT License, see LICENSE\.md\.\n\n", + re.MULTILINE, + ) + + if m := pattern.match(content): + if m.group(1) == author_names: + print(file_path, "Matched! contributors unchanged") + else: + print(file_path, "Updating contributors: ", m.group(1), " ->", author_names) + content = pattern.sub(copyright_notice, content) + else: + print(file_path, "adding contributors", author_names) + content = copyright_notice + content + + # Insert the copyright notice at the top + with open(file_path, "w") as file: + file.write(content) + + +def process_files(directory): + """Process all Python files in the given directory.""" + for root, _, files in os.walk(directory): + if root.startswith("./.venv"): + continue + for file in files: + if file.endswith(".py") and file != "__init__.py": + file_path = os.path.join(root, file) + contributors = get_contributors(file_path) + insert_copyright(file_path, contributors) + + +if __name__ == "__main__": + # Replace with your folder path + process_files(".") diff --git a/docs_src/conf.py b/docs_src/conf.py index 4eddd06..4f734d6 100644 --- a/docs_src/conf.py +++ b/docs_src/conf.py @@ -1,3 +1,7 @@ +# Copyright (c) 2025. +# Authors: Elliott Kasoar, Tamás K. Stenczel, Gábor Csányi +# This program is distributed under the MIT License, see LICENSE.md. + # # Configuration file for the Sphinx documentation builder. # diff --git a/tests/hash.py b/tests/hash.py index c29e5a2..51062cf 100644 --- a/tests/hash.py +++ b/tests/hash.py @@ -1,3 +1,7 @@ +# Copyright (c) 2025. +# Authors: Elliott Kasoar, Tamás K. Stenczel +# This program is distributed under the MIT License, see LICENSE.md. + import io import ase diff --git a/tests/test_abstract_model.py b/tests/test_abstract_model.py index 069cdf9..96bd3ef 100644 --- a/tests/test_abstract_model.py +++ b/tests/test_abstract_model.py @@ -1,3 +1,7 @@ +# Copyright (c) 2025. +# Authors: Elliott Kasoar, Tamás K. Stenczel +# This program is distributed under the MIT License, see LICENSE.md. + import datetime import io from io import StringIO diff --git a/tests/test_database.py b/tests/test_database.py index 864ca5b..4d7c081 100644 --- a/tests/test_database.py +++ b/tests/test_database.py @@ -1,3 +1,7 @@ +# Copyright (c) 2025. +# Authors: Elliott Kasoar, Tamás K. Stenczel +# This program is distributed under the MIT License, see LICENSE.md. + from io import StringIO from ase.io import read diff --git a/tests/test_mongodb_srv.py b/tests/test_mongodb_srv.py index bfaf2c8..f89c11f 100644 --- a/tests/test_mongodb_srv.py +++ b/tests/test_mongodb_srv.py @@ -1,3 +1,7 @@ +# Copyright (c) 2025. +# Authors: Tamás K. Stenczel +# This program is distributed under the MIT License, see LICENSE.md. + """Tests for supporting `mongodb+srv://` URIs""" from pytest import fixture diff --git a/tests/test_parsers.py b/tests/test_parsers.py index 2a6383b..d15bafc 100644 --- a/tests/test_parsers.py +++ b/tests/test_parsers.py @@ -1,3 +1,7 @@ +# Copyright (c) 2025. +# Authors: Elliott Kasoar, Tamás K. Stenczel +# This program is distributed under the MIT License, see LICENSE.md. + import pytest from abcd.parsers.extras import parser as extras_parser diff --git a/tutorials/gb_upload.py b/tutorials/gb_upload.py index 37eb848..acaa832 100644 --- a/tutorials/gb_upload.py +++ b/tutorials/gb_upload.py @@ -1,3 +1,8 @@ +# Copyright (c) 2025. +# Authors: Ádám Fekete, Elliott Kasoar, Tamás K. Stenczel +# This program is distributed under the MIT License, see LICENSE.md. + +import sys from pathlib import Path import sys diff --git a/tutorials/scripts/Preprocess.py b/tutorials/scripts/Preprocess.py index 3d702b9..91280f7 100644 --- a/tutorials/scripts/Preprocess.py +++ b/tutorials/scripts/Preprocess.py @@ -1,3 +1,9 @@ +# Copyright (c) 2025. +# Authors: Ádám Fekete, Elliott Kasoar, Tamás K. Stenczel +# This program is distributed under the MIT License, see LICENSE.md. + +from pathlib import Path +from pprint import pprint import json from pathlib import Path diff --git a/tutorials/scripts/Reader.py b/tutorials/scripts/Reader.py index 64b32e6..3da9f78 100644 --- a/tutorials/scripts/Reader.py +++ b/tutorials/scripts/Reader.py @@ -1,3 +1,7 @@ +# Copyright (c) 2025. +# Authors: Ádám Fekete, Elliott Kasoar, Tamás K. Stenczel +# This program is distributed under the MIT License, see LICENSE.md. + import json from pathlib import Path diff --git a/tutorials/scripts/Visualise.py b/tutorials/scripts/Visualise.py index 577bdaa..2ab2214 100644 --- a/tutorials/scripts/Visualise.py +++ b/tutorials/scripts/Visualise.py @@ -1,3 +1,8 @@ +# Copyright (c) 2025. +# Authors: Ádám Fekete, Elliott Kasoar, Tamás K. Stenczel +# This program is distributed under the MIT License, see LICENSE.md. + +import io import uuid from ipywidgets import Dropdown, FloatSlider, Output, VBox diff --git a/tutorials/scripts/Visualise_quip.py b/tutorials/scripts/Visualise_quip.py index 577bdaa..2ab2214 100644 --- a/tutorials/scripts/Visualise_quip.py +++ b/tutorials/scripts/Visualise_quip.py @@ -1,3 +1,8 @@ +# Copyright (c) 2025. +# Authors: Ádám Fekete, Elliott Kasoar, Tamás K. Stenczel +# This program is distributed under the MIT License, see LICENSE.md. + +import io import uuid from ipywidgets import Dropdown, FloatSlider, Output, VBox diff --git a/tutorials/test_db.py b/tutorials/test_db.py index 87d6b27..43f1bc3 100644 --- a/tutorials/test_db.py +++ b/tutorials/test_db.py @@ -1,3 +1,7 @@ +# Copyright (c) 2025. +# Authors: Ádám Fekete, Elliott Kasoar, Tamás K. Stenczel +# This program is distributed under the MIT License, see LICENSE.md. + from pathlib import Path from ase.io import read diff --git a/tutorials/test_upload.py b/tutorials/test_upload.py index 1717a59..540d517 100644 --- a/tutorials/test_upload.py +++ b/tutorials/test_upload.py @@ -1,3 +1,7 @@ +# Copyright (c) 2025. +# Authors: Ádám Fekete, Elliott Kasoar, Tamás K. Stenczel +# This program is distributed under the MIT License, see LICENSE.md. + from abcd import ABCD if __name__ == "__main__":