11"""This script updates our editorial team csv file with the most current editors.
22
3- 1. It parses a manually created list of editors found in the csv
4- file: `_data/editorial_team_domains`. This csv was created by
5- manually adding editor names to the file with domain areas from our Google sheet.
6- The (private) google sheet is generated from a google form that collects editor
3+ 1. It parses a manually created list of editors found in the csv
4+ file: `_data/editorial_team_domains`. This csv was created by
5+ manually adding editor names to the file with domain areas from our Google sheet.
6+ The (private) google sheet is generated from a google form that collects editor
77expertise and domains when they apply to be an editor with us.
8- 2. The script, uses the GitHub API to return the list of GitHub usernames from
8+ 2. The script, uses the GitHub API to return the list of GitHub usernames from
99the editorial team on GitHub. (see)
1010 * https://github.com/orgs/pyOpenSci/teams/emeritus-editors/members
1111 * https://github.com/orgs/pyOpenSci/teams/editorial-board/members
12- When we onboard a new editor, we add them to the editorial-board GitHub team so
12+ When we onboard a new editor, we add them to the editorial-board GitHub team so
1313they have proper permissions in repositories in our organization. When an editor
14- wishes to step down, we move them to the emeritus-editors team. However, they
15- may still be active in reviews so we keep them on the editorial-board team until
14+ wishes to step down, we move them to the emeritus-editors team. However, they
15+ may still be active in reviews so we keep them on the editorial-board team until
1616they have completed all of their reviews.
1717
1818The GitHub team data are collected using the GitHub graphQL interface.
1919
20- 3. Finally, this script merges the data parsed from the team with the .csv file.
20+ 3. Finally, this script merges the data parsed from the team with the .csv file.
2121
22- This script creates two .csv files. The _data/editorial_team_domains.csv contains
23- all currently "activate" editors. _data/emeritus_editor_domains.csv contains
24- editors that are either fully offboarded of intend to offboard after theyr currently
25- active reviews.
22+ This script creates two .csv files. The _data/editorial_team_domains.csv contains
23+ all currently "activate" editors. _data/emeritus_editor_domains.csv contains
24+ editors that are either fully offboarded or intend to offboard after they
25+ finish their currently active reviews.
2626
2727TODO:
28- * it would be good to find a more automated way to get the domain data from our
29- Google Sheet. one way to do this would be to create a new spreadsheet that
30- pulls from our editor signup but only contains gh username and then the domain
31- areas.
28+ * it would be good to find a more automated way to get the domain data from our
29+ Google Sheet. one way to do this would be to create a new spreadsheet that
30+ pulls from our editor signup but only contains gh username and then the domain
31+ areas.
3232
3333"""
3434
4747
4848
4949def get_team_members (team_name : str = "editorial-board" ):
50- """A function that hits the GH graphQL api and pulls down members
51- from our editorial team. This list should be the most current list of
52- pyOpenSci editors. """
50+ """A function that hits the GH graphQL api and pulls down members
51+ from our editorial team. This list should be the most current list of
52+ pyOpenSci editors."""
5353
5454 query = """
5555 query ($slug: String!){
@@ -71,9 +71,7 @@ def get_team_members(team_name: str = "editorial-board"):
7171 }
7272
7373 response = requests .post (
74- GITHUB_API_URL ,
75- json = {"query" : query , "variables" : variables },
76- headers = headers
74+ GITHUB_API_URL , json = {"query" : query , "variables" : variables }, headers = headers
7775 )
7876
7977 if response .status_code == 200 :
@@ -91,10 +89,9 @@ def filter_members(members, exclude):
9189
9290
9391if __name__ == "__main__" :
94-
9592 # Pull down the list of GitHub usernames from our teams
9693 editors = get_team_members ("editorial-board" )
97- emeritus = get_team_members ("emeritus-editors" )
94+ emeritus = get_team_members ("emeritus-editors" )
9895
9996 # Cleanup usernames
10097 editors = sorted ({(u or "" ).strip ().lower () for u in editors })
@@ -103,11 +100,19 @@ def filter_members(members, exclude):
103100 # Open the CSV that contains domain info for editors
104101 data_dir = Path ("_data" )
105102 editor_domains = pd .read_csv (data_dir / "editorial_team_domains.csv" )
106- editor_domains ["gh_username" ] = ( editor_domains ["gh_username" ].astype (str ) )
103+ editor_domains ["gh_username" ] = editor_domains ["gh_username" ].astype (str )
107104
108105 # Build DataFrames of current editors and emeritus from the live team lists
109- editors_df = pd .DataFrame (editors , columns = ["gh_username" ]) if editors else pd .DataFrame (columns = ["gh_username" ])
110- emeritus_df = pd .DataFrame (emeritus , columns = ["gh_username" ]) if emeritus else pd .DataFrame (columns = ["gh_username" ])
106+ editors_df = (
107+ pd .DataFrame (editors , columns = ["gh_username" ])
108+ if editors
109+ else pd .DataFrame (columns = ["gh_username" ])
110+ )
111+ emeritus_df = (
112+ pd .DataFrame (emeritus , columns = ["gh_username" ])
113+ if emeritus
114+ else pd .DataFrame (columns = ["gh_username" ])
115+ )
111116
112117 # Merge with domain info (left join to keep the team list as the source of truth)
113118 all_editors = editors_df .merge (editor_domains , on = "gh_username" , how = "left" )
0 commit comments