Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -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.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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)

Expand Down
4 changes: 4 additions & 0 deletions abcd/backends/atoms_http.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 4 additions & 0 deletions abcd/backends/atoms_pymongo.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 4 additions & 0 deletions abcd/database.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
5 changes: 5 additions & 0 deletions abcd/errors.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down
4 changes: 4 additions & 0 deletions abcd/frontends/commandline/commands.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down
4 changes: 4 additions & 0 deletions abcd/frontends/commandline/config.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 4 additions & 0 deletions abcd/frontends/commandline/decorators.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 4 additions & 0 deletions abcd/frontends/commandline/parser.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down
4 changes: 4 additions & 0 deletions abcd/model.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
5 changes: 4 additions & 1 deletion abcd/parsers/extras.py
Original file line number Diff line number Diff line change
@@ -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"""
Expand Down
5 changes: 4 additions & 1 deletion abcd/parsers/queries.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 4 additions & 0 deletions abcd/parsers/queries_new.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 4 additions & 0 deletions abcd/queryset.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down
4 changes: 4 additions & 0 deletions abcd/server/app/db.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
6 changes: 6 additions & 0 deletions abcd/server/app/nav.py
Original file line number Diff line number Diff line change
@@ -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

Check warning on line 6 in abcd/server/app/nav.py

View check run for this annotation

Codecov / codecov/patch

abcd/server/app/nav.py#L5-L6

Added lines #L5 - L6 were not covered by tests
from hashlib import sha1

from dominate import tags
Expand Down
4 changes: 4 additions & 0 deletions abcd/server/app/views/api.py
Original file line number Diff line number Diff line change
@@ -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__)
Expand Down
4 changes: 4 additions & 0 deletions abcd/server/app/views/database.py
Original file line number Diff line number Diff line change
@@ -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__)
Expand Down
4 changes: 4 additions & 0 deletions abcd/server/app/views/index.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
94 changes: 94 additions & 0 deletions devtools/update_copyright.py
Original file line number Diff line number Diff line change
@@ -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(".")
4 changes: 4 additions & 0 deletions docs_src/conf.py
Original file line number Diff line number Diff line change
@@ -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.
#
Expand Down
4 changes: 4 additions & 0 deletions tests/hash.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 4 additions & 0 deletions tests/test_abstract_model.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 4 additions & 0 deletions tests/test_database.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 4 additions & 0 deletions tests/test_mongodb_srv.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 4 additions & 0 deletions tests/test_parsers.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
5 changes: 5 additions & 0 deletions tutorials/gb_upload.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down
6 changes: 6 additions & 0 deletions tutorials/scripts/Preprocess.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down
4 changes: 4 additions & 0 deletions tutorials/scripts/Reader.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down
5 changes: 5 additions & 0 deletions tutorials/scripts/Visualise.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
5 changes: 5 additions & 0 deletions tutorials/scripts/Visualise_quip.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 4 additions & 0 deletions tutorials/test_db.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 4 additions & 0 deletions tutorials/test_upload.py
Original file line number Diff line number Diff line change
@@ -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__":
Expand Down