From 60d2c8b677aecf615e2b2ba8d66bd776575734ec Mon Sep 17 00:00:00 2001 From: Kristin Berry <kberry@usgs.gov> Date: Mon, 14 Sep 2020 11:00:14 -0700 Subject: [PATCH] Simple script to generate AUTHORS.rst from .zenodo.json file (#3995) * Add script to create AUTHORS.rst from .zenodo.json and update AUTHORS.rst * Update PR template and contributing docs * Removed json error in .zenodo.json and update script based on feedback * update based on more feedback * removed comment --- .github/pull_request_template.md | 2 +- .zenodo.json | 2 +- AUTHORS.rst | 120 +++++++++++++++--------------- CONTRIBUTING.md | 2 +- isis/scripts/zenodo_to_authors.py | 41 ++++++++++ 5 files changed, 102 insertions(+), 65 deletions(-) create mode 100644 isis/scripts/zenodo_to_authors.py diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index ecb1938582..36d9691219 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -36,7 +36,7 @@ - [ ] I have updated the documentation accordingly. - [ ] I have added tests to cover my changes. - [ ] All new and existing tests passed. -- [ ] I have added myself to the [AUTHORS.rst](https://github.com/USGS-Astrogeology/ISIS3/blob/dev/AUTHORS.rst) document. +- [ ] I have added myself to the [.zenodo.json](https://github.com/USGS-Astrogeology/ISIS3/blob/dev/.zenodo.json) document. - [ ] I have added any user impacting changes to the [CHANGELOG.md](https://github.com/USGS-Astrogeology/ISIS3/blob/dev/CHANGELOG.md) document. ## Licensing diff --git a/.zenodo.json b/.zenodo.json index 0c6f935d18..45a7fba1ec 100644 --- a/.zenodo.json +++ b/.zenodo.json @@ -188,7 +188,7 @@ }, { "name": "Addair, Travis" - }, + } ], "title": "Integrated Software for Imageers and Spectrometers", "description": "A software library and set of tools to support ingestions, processing, and analysis of planetary science data.", diff --git a/AUTHORS.rst b/AUTHORS.rst index 93b262096a..9040c3485e 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -1,68 +1,64 @@ ISIS3 Contributors ================== -- Aaron Curtis -- Adam Goins -- Adam Paquette -- Andrew Annex -- Andrew Stebenne -- Austin Sanders -- B. Seignovert -- Christopher Austin -- Christopher Ryan Combs Jr -- Cole Neubauer -- Curtis Rose -- David Miller -- Debbie Cook -- Ella Mae Lee -- Elpitha Howington-Kraus +- Jason Laura +- Jesse Mapel +- Kristin Berry +- Kaitlyn Lee +- Kelvin Rodriguez +- Stuart Sides +- Adam Paquette +- Kaj Williams +- Austin Sanders +- Lauren Adoram-Kershner +- John Shinaman +- Lynn Weller +- Evin Dunn +- Tim Giroux +- Tracie Sucharski +- Jeanie Backer +- Adam Goins +- Makayla Shepard +- Christopher Combs +- Debbie Cook +- Kris Becker +- Summer Stapleton +- Cole Neubauer +- Tyler Wilson +- Aaron Giroux +- Moses Milazzo +- Ross Beyer +- Elpitha Howington-Kraus +- Kenneth Edmundson +- Raad Saleh +- Oleg Alexandrov +- Aaron Curtis - Eric Gault -- Eric Hyer -- Evin Dunn -- Ian Humphrey -- Jac Shinaman -- Jai Rideout -- James Alexander Crough -- Janet Barrett -- Jason Laura -- Jeannie Backer -- Jeff Anderson -- Jeffrey Covington -- Jesse Mapel -- John Bonn -- Kaitlyn Lee -- Kaj E Williams -- Kelvin Rodriguez -- Ken Edmundson -- Kim Oyama -- Kris Becker -- Kristin Berry -- Lauren Adoram-Kershner -- Lynn Weller -- Mackenzie Boyd -- Makayla Shepherd -- Marjorie Hahn -- Mathew Eis -- Michael Aye -- Moses Milazzo -- Oleg Alexandrov -- Orrin Thomas -- Peter Giroux -- Raad A. Saleh -- Ross Beyer -- Sasha Brownsberger -- Sharmilla Prasad -- Steven Lambright -- Stuart Sides -- Summer Stapleton -- Timothy Giroux -- Tracie Sucharski -- Travis Addair -- Tyler Wilson -- Victor Silva +- Andrew Annex +- Victor Silva +- Benoit Seignovert +- Andrew Stebenne +- Christopher Austin +- Curtis Rose +- David Miller +- Ella Mae Lee +- Eric Heyer +- Ian Humphrey +- Jai Rideout +- James Alexander Crough +- Janet Barrett +- Jeff Anderson +- Jeffrey Covington +- John Bonn +- Kim Oyama +- Mackenzie Boyd +- Marjorie Hahn +- Mathew Eis +- Orrin Thomas +- Sasha Brownsberger +- Sharmilla Prasad +- Steven Lambright +- Travis Addair ----- -This list was initially generated using this bash command (additional manual edits are needed): - -git log --pretty="- %an %n" | sort | uniq -i >> AUTHORS.rst - +This list was generated from the .zenodo.json file by running python zenodo_to_authors.py. \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f68591f556..b7fd2b715c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -43,7 +43,7 @@ In the case of an objection being raised in a pull request by another committer, committers should seek to arrive at a consensus by way of addressing concerns being expressed by discussion, compromise on the proposed change, or withdrawal of the proposed change. -When making a contribution for the first time, please add your name to the Authors.rst file **and** the `.zenodo.json file.` We strongly recommend adding your affiliation and ORCiD to the `zenodo.json` file. These additions only have to happen once. +When making a contribution for the first time, please add your name to the `.zenodo.json file.` We strongly recommend adding your affiliation and ORCiD to the `zenodo.json` file. These additions only have to happen once. # Becoming a Committer diff --git a/isis/scripts/zenodo_to_authors.py b/isis/scripts/zenodo_to_authors.py new file mode 100644 index 0000000000..b4410eacf9 --- /dev/null +++ b/isis/scripts/zenodo_to_authors.py @@ -0,0 +1,41 @@ +# Uses a .zenodo.json file to generate an AUTHORS.rst file. + +import os +import argparse +import json + +parser = argparse.ArgumentParser(description="Generate an AUTHORS.rst file from a .zenodo.json file") +parser.add_argument("zenodo_input_file", type=str, help="The file path to the .zenodo.json file.") +parser.add_argument("authors_output_file", type=str, help="The path for the output AUTHORS.rst file.") + +args = parser.parse_args() + +zenodo_path = args.zenodo_input_file +authors_path = args.authors_output_file + +# Read .zenodo.json file: +try: + with open(zenodo_path, 'r') as zenodo_file: + parsed_json = json.load(zenodo_file) +except: + print("{} could not be read as the input file.".format(zenodo_path)) + raise + +output_lines = ["ISIS3 Contributors", "==================\n"] + +for elt in parsed_json['creators']: + name = elt['name'] + last, first = name.split(",") + output_lines.append("- {} {}".format(first.strip(),last.strip())) + +output_lines.append("\n-----") +output_lines.append("This list was generated from the .zenodo.json file by running python zenodo_to_authors.py.") + +# Write to AUTHORS.rst file +try: + with open(authors_path, 'w') as authors_file: + authors_file.write('\n'.join(output_lines)) +except: + print("{} could not be opened as the output file.".format(authors_path)) + raise + -- GitLab