Skip to content

copyrights: update copyright headers in all files of the project - #410

Merged
glesur merged 13 commits into
idefix-code:developfrom
svalat:feature/authors-in-file-headers
Sep 23, 2026
Merged

glesur merged 13 commits into
idefix-code:developfrom
svalat:feature/authors-in-file-headers

Conversation

@svalat

@svalat svalat commented Sep 10, 2026

Copy link
Copy Markdown
Collaborator

Goal

This PR adds a script ./pytools/update_file_headers.py to update the copyright headers for all the files in the project.

It is configured via ./pytools/update_file_headers.json.

How

  • It scans the git blame of all files listed in the git repo.
  • The files are filtered about their type (shell / C / HTML) to inject the proper comment style, some are excluded.
  • The authors are assigned to their institution & years of contribution on the file.
  • The last modification MONTH / YEAR and the FILENAME is now present in the header.

Usage

# update all git files
./pytools/update_file_headers.py --git-all .

# update a single file
./pytools/update_file_headers.py ./test.py

Commit name

Ideally when making a commit to update the copyrights before a release, you need to name this commit :

copyrights: ...............

Any other regexp can be configured in the config file in key exclude_summary_regexps.

So it will be ignored by the next scan to ignore the copyright lines in the git blame and not adding the authors updater to all files of the project.

In case you forgot, you can add the git commit to skip in the key exclude_hashes of the config file.

Imported extern source

The core script to apply the patching comes originally from MALT :
https://github.com/memtt/malt/blob/v1.6.3/dev/update_file_headers.py and is just slightly patched here to adapt the style to Idefix.

The original license is same than Idefix : CeCILL-C so no problem to redistribute it with its original copyright still in.

Note

This PR affect most of the files of the project.

Comment thread pytools/update_file_headers.json Outdated
"",
"Copyright(C) by :",
"@COPYRIGHTS@",
"- and other code contributors",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"- and other code contributors",
"and other code contributors",

Comment thread pytools/update_file_headers.json Outdated
"63753204+nscepi@users.noreply.github.com": "nicolas.scepi@univ-grenoble-alpes.fr",
"nicolas.scepi@gmail.com": "nicolas.scepi@univ-grenoble-alpes.fr",
"geoffroy.lesur@obs.ujf-grenoble.fr": "geoffroy.lesur@univ-grenoble-alpes.fr",
"93188557+vdbma@users.noreply.github.com": "vreville@irap.omp.eu",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"93188557+vdbma@users.noreply.github.com": "vreville@irap.omp.eu",
"93188557+vdbma@users.noreply.github.com": "mbossche@aip.de",

Comment thread pytools/update_file_headers.json Outdated
"geoffroy.lesur@obs.ujf-grenoble.fr": "geoffroy.lesur@univ-grenoble-alpes.fr",
"93188557+vdbma@users.noreply.github.com": "vreville@irap.omp.eu",
"victorreville@gmail.com": "vreville@irap.omp.eu",
"cr52@protonmail.com": [

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure we want to have this option for Clément, as we don't do that for others (Baghdadi, Van den Bossche,Mauxion) and it implies that we track everybody's email, while I'm pretty sure we won't. Let's just keep one unique email for everyone, hopefully the last one.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here I track the mail, because this is how the code relates to the institution.
But that's looks ok to me to keep it simpler, I will remove it.

Comment thread pytools/update_file_headers.json Outdated
]
},
"affiliation_domains": {
"@irap.omp.eu": "IPAP",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"@irap.omp.eu": "IPAP",
"@irap.omp.eu": "IRAP",

Comment thread pytools/update_file_headers.json Outdated
},
"affiliation_domains": {
"@irap.omp.eu": "IPAP",
"geoffroy.lesur@univ-grenoble-alpes.fr": "IPAG / CNRS",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can't we say that @univ-grenoble-alpes.fr is IPAG/UGA/CNRS in all generality?

@svalat svalat Sep 10, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently we can perfectly do that, I will apply.
It might change in the future if you get other contributions from other labs of UGA, but we can adapt at that time.

For this latter case, I will just make such the code takes the full mail with precedence over the domain one, this is a 1 line fix or already done.

Comment thread pytools/update_file_headers.json Outdated
"marc.coiffier@univ-grenoble-alpes.fr": "IPAG / CNRS",
"clement.robert@univ-grenoble-alpes.fr": "IPAG / CNRS",
"nicolas.scepi@univ-grenoble-alpes.fr": "IPAG / CNRS",
"jonah.mauxion@univ-grenoble-alpes.fr": "IPAG / CNRS"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably missing van den bossche here (IAP Postdam)

@dutta-alankar dutta-alankar Sep 11, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just wanted to notify that my affiliation is "Max-Planck-Institut für Astrophysik, Garching b. München" or "MPA Garching"

Comment thread src/fluid/boundary/axis.cpp Outdated
// Licensed under CeCILL 2.1 License, see COPYING for more information
// ***********************************************************************************
// Other contributors :
// - Gaylor Wafflard <gaylor.wafflard@univ-grenoble-alpes.fr> (IPAG / CNRS - 2024)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a bit confused as to why Gaylor doesn't appear as a regular contributor here. He's not at the origin of the axis module, but he certainly contributed at some point.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hum, this is because he is mentioned as co-author of one of your merge 19ed7be. As I have no way to distinguish I added him in all related files.

@svalat

svalat commented Sep 11, 2026

Copy link
Copy Markdown
Collaborator Author

Wait for merge that I made a last patch to handle the co-authors in commits summary so authors like Gaylor will appear in the right place in the header instead of after it.

@neutrinoceros neutrinoceros left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple suggestions about the script itself

commiter_name = "INIT"
commiter_time = "INIT"
commiter_zone = "INIT"
summary = "INIT"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there should probably be a else: raise ... here

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just added a else: pass because I just ignore the other fields here.

Comment thread pytools/update_file_headers.py Outdated
Comment thread pytools/update_file_headers.py Outdated
# direct definition or per year mode
if isinstance(db[mail], str):
return db[mail]
elif isinstance(db[mail], list):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

assuming my type hint is correct, this could be simplified by simply removing the elif condition and de-indent its content ?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added an else: raise, the type checking is not an error handling. I prefer to stay safe here by re-checking.

Comment thread pytools/update_file_headers.py Outdated
Comment thread pytools/update_file_headers.py Outdated
Comment thread pytools/update_file_headers.py Outdated


############################################################
def main():

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make this testable and return an exit status

Suggested change
def main():
def main(argv: list[str] | None = None) -> int:

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't test it yet, as it is not an infrastructure issue, I keep it simple.


# run
run_from_args(options)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return 0

if (
fnmatch.fnmatch(filename, ipattern)
or filename.startswith(ipattern)
or filename == ipattern

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This condition will never be evaluated to True because the previous one would already short-circuit it

Suggested change
or filename == ipattern

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good eyes ;).

Comment thread pytools/update_file_headers.py Outdated

@neutrinoceros neutrinoceros Sep 11, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple suggestions for the script itself:

  • add PEP 723 script metadata (first and foremost, declare the third party dependency on gitPython)
  • move the script to somewhere not importable (e.g., to a new scripts subdir)
  • ensure portability on all platforms using pathlib instead of the occasional Unix-only /
  • ensure the script can be run from anywhere using relative paths

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a helper script just for us when we make release, I would not pass too much time on it for now.
We can improve it latter.
For the script directory I will have another one which will come later, I will move it at that moment.

@svalat svalat left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the remarks, I fixed most, even if it is an internal script for us mainly.

commiter_name = "INIT"
commiter_time = "INIT"
commiter_zone = "INIT"
summary = "INIT"

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just added a else: pass because I just ignore the other fields here.

Comment thread pytools/update_file_headers.py Outdated
Comment thread pytools/update_file_headers.py Outdated
# direct definition or per year mode
if isinstance(db[mail], str):
return db[mail]
elif isinstance(db[mail], list):

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added an else: raise, the type checking is not an error handling. I prefer to stay safe here by re-checking.

Comment thread pytools/update_file_headers.py Outdated
Comment thread pytools/update_file_headers.py Outdated
Comment thread pytools/update_file_headers.py Outdated
Comment thread pytools/update_file_headers.py Outdated
Comment thread pytools/update_file_headers.py Outdated


############################################################
def main():

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't test it yet, as it is not an infrastructure issue, I keep it simple.

Comment thread pytools/update_file_headers.py Outdated

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a helper script just for us when we make release, I would not pass too much time on it for now.
We can improve it latter.
For the script directory I will have another one which will come later, I will move it at that moment.

@glesur glesur left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one last author got his email wrong :-(

"93188557+vdbma@users.noreply.github.com": "mbossche@aip.de",
"victorreville@gmail.com": "vreville@irap.omp.eu",
"cr52@protonmail.com": "clement.robert@univ-grenoble-alpes.fr"
},

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
},
"89980449+Anto6453@users.noreply.github.com": "antonin.borderies@ens-lyon.fr"
},

Comment thread pytools/update_file_headers.json Outdated
"@irap.omp.eu": "IRAP",
"@univ-grenoble-alpes.fr": "IPAG/UGA/CNRS",
"dutta.alankar@gmail.com": "MPA Garching",
"@aip.de": "IAP Postdam"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"@aip.de": "IAP Postdam"
"@aip.de": "IAP Postdam"
"@ens-lyon.fr": "ENS Lyon"

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed + some others and added an error message when the affiliation is not yet known to me sure to not miss others.
I will give another look & check pass tomorrow morning.

@glesur
glesur merged commit f0403bb into idefix-code:develop Sep 23, 2026
41 checks passed
@glesur glesur mentioned this pull request Sep 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants