pyosmeta 0.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pyosmeta-0.2/PKG-INFO +229 -0
- pyosmeta-0.2/README.md +205 -0
- pyosmeta-0.2/pyproject.toml +58 -0
- pyosmeta-0.2/src/pyosmeta/.DS_Store +0 -0
- pyosmeta-0.2/src/pyosmeta/__about__.py +4 -0
- pyosmeta-0.2/src/pyosmeta/__init__.py +8 -0
- pyosmeta-0.2/src/pyosmeta/_version_generated.py +1 -0
- pyosmeta-0.2/src/pyosmeta/cli/update_contributors.py +85 -0
- pyosmeta-0.2/src/pyosmeta/cli/update_review_contribs.py +134 -0
- pyosmeta-0.2/src/pyosmeta/cli/update_reviews.py +102 -0
- pyosmeta-0.2/src/pyosmeta/contributors.py +570 -0
- pyosmeta-0.2/src/pyosmeta/file_io.py +184 -0
- pyosmeta-0.2/src/pyosmeta/parse_issues.py +480 -0
- pyosmeta-0.2/src/tests/__init__.py +3 -0
pyosmeta-0.2/PKG-INFO
ADDED
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: pyosmeta
|
|
3
|
+
Version: 0.2
|
|
4
|
+
Summary: Tools that update the pyOpenSci contributor and review metadata that is posted on our website
|
|
5
|
+
Author-Email: Leah Wasser <leah@pyopensci.org>
|
|
6
|
+
Maintainer-Email: pyOpenSci <admin@pyopensci.org>
|
|
7
|
+
License: MIT
|
|
8
|
+
Classifier: Development Status :: 4 - Beta
|
|
9
|
+
Classifier: Intended Audience :: Developers
|
|
10
|
+
Classifier: Topic :: Software Development :: Build Tools
|
|
11
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
12
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
+
Project-URL: Homepage, https://www.pyopensci.org
|
|
16
|
+
Project-URL: Bug reports, https://github.com/pyopensci/pyosmeta/issues
|
|
17
|
+
Project-URL: Source, https://github.com/pyopensci/pyosmeta/issues
|
|
18
|
+
Requires-Python: >=3.10
|
|
19
|
+
Requires-Dist: ruamel-yaml>=0.17.21
|
|
20
|
+
Requires-Dist: requests
|
|
21
|
+
Requires-Dist: python-dotenv
|
|
22
|
+
Requires-Dist: pydantic
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
|
|
25
|
+
# PyOS Update and Clean Contributor & Peer Review Metadata
|
|
26
|
+
|
|
27
|
+
This repo contains a small module and 3 CLI scripts.
|
|
28
|
+
|
|
29
|
+
## Notes
|
|
30
|
+
|
|
31
|
+
To run `update-reviewers` you will need to run both `update-reviews` and `update-contributors` first to create the required input `.pickle` files.
|
|
32
|
+
|
|
33
|
+
The scripts run as follows:
|
|
34
|
+
|
|
35
|
+
## update-contributors script
|
|
36
|
+
|
|
37
|
+
This script parses data from all-contributors bot `.json`
|
|
38
|
+
files in the following repos:
|
|
39
|
+
|
|
40
|
+
- [software-submission repo](https://github.com/pyOpenSci/software-submission) where peer review happens
|
|
41
|
+
- [python-package-guide repo](https://github.com/pyOpenSci/python-package-guide)
|
|
42
|
+
- [peer review guide repo](https://github.com/pyOpenSci/software-peer-review)
|
|
43
|
+
- [pyopensci.github.io (website) repo](https://github.com/pyOpenSci/pyopensci.github.io)
|
|
44
|
+
- [update-package-meta repo](https://github.com/pyOpenSci/update-web-metadata) _(this repo)_
|
|
45
|
+
|
|
46
|
+
Running this this script:
|
|
47
|
+
|
|
48
|
+
1. Parses through all of the all-contributors bot `.json` files across our pyOpenSci repos to gather contributors to our organization. This allows us to [acknowledge contributors on our website](https://www.pyopensci.org/our-community/#pyopensci-community-contributors) who are not always making explicit code contributions (thus might not have commits). These contributors are reviewing guidebooks, participating in peer review, and performing other important tasks that are critical to our pyOpenSci mission. We acknowledge all contributions at pyOpenSci regardless of volume or size.
|
|
49
|
+
2. Updates the existing [contributors.yml](https://github.com/pyOpenSci/pyopensci.github.io/blob/main/_data/contributors.yml) file found in our website repo with new contributors and the contributor role (package guides, code workflows, peer review, etc).
|
|
50
|
+
a. If you run the script using `--update update_all`, this script will also use the GitHub api to update the users metadata from their GitHub profile.
|
|
51
|
+
|
|
52
|
+
## update-reviews script
|
|
53
|
+
|
|
54
|
+
This script parses through our (_accepted_) review issues to find packages that have been accepted. It then grabs each reviews editor, reviewers and package authors / maintainers. This information allows us to
|
|
55
|
+
|
|
56
|
+
1. Update a contributor's peer review metadata in the contributors.yml file in the third script.
|
|
57
|
+
1. Update the pyOpenSci website's package listing with the package's DOI, documentation URL.
|
|
58
|
+
1. Update the package's stats including stars, contributors, etc. using the GitHub API
|
|
59
|
+
|
|
60
|
+
## update-reviewers script
|
|
61
|
+
|
|
62
|
+
This final script is a bridge between the first it uses pickle files outputted from the
|
|
63
|
+
first two scripts to update each contributors peer review contributions including
|
|
64
|
+
|
|
65
|
+
1. packages submitted or reviewed
|
|
66
|
+
1. packages in which the contributor served as editors
|
|
67
|
+
1. contributor types associated with peer review including:
|
|
68
|
+
|
|
69
|
+
- peer-review
|
|
70
|
+
- package-maintainer
|
|
71
|
+
- package-reviewer
|
|
72
|
+
- package-editor
|
|
73
|
+
|
|
74
|
+
These general contributor types are used to drive our [website's
|
|
75
|
+
contributor search and filter functionality that you can see here.](https://www.pyopensci.org/our-community/index.html#pyopensci-community-contributors)
|
|
76
|
+
|
|
77
|
+
## Local setup
|
|
78
|
+
|
|
79
|
+
To begin:
|
|
80
|
+
|
|
81
|
+
1. Create a local environment and activate it.
|
|
82
|
+
2. Install the required dependencies via the `requirement.txt` file by running the following command;
|
|
83
|
+
`pip install -r requirements.txt`
|
|
84
|
+
3. Install the pyosmeta package in development/editable mode:
|
|
85
|
+
`pip install -e . `
|
|
86
|
+
|
|
87
|
+
### Setup token to authenticate with the GitHub API
|
|
88
|
+
|
|
89
|
+
To run this you need to [create a TOKEN that can be used to access the GitHub
|
|
90
|
+
API.](https://docs.github.com/en/rest/guides/getting-started-with-the-rest-api?apiVersion=2022-11-28#about-tokens)
|
|
91
|
+
|
|
92
|
+
After obtaining a token;
|
|
93
|
+
|
|
94
|
+
1. Duplicate the `.env-default` file and rename the copy to `.env`
|
|
95
|
+
2. Assign your token to the `GITHUB_TOKEN` variable in the `.env` file.
|
|
96
|
+
|
|
97
|
+
## How to run each script
|
|
98
|
+
|
|
99
|
+
Each script is available through the command line through entry points specified in our `pyproject.toml` file.
|
|
100
|
+
|
|
101
|
+
## update-contributors script
|
|
102
|
+
|
|
103
|
+
To run:
|
|
104
|
+
|
|
105
|
+
`update-contributors`
|
|
106
|
+
`update-contributors --update update_all`
|
|
107
|
+
|
|
108
|
+
The `update-contributors` script does the following:
|
|
109
|
+
|
|
110
|
+
1. It grabs the `all-contribs.json` files from each repository and turns that json data into a dictionary of all unique contributors across repos. Repos include:
|
|
111
|
+
- peer review guide
|
|
112
|
+
- packaging guide
|
|
113
|
+
- website
|
|
114
|
+
- software-review
|
|
115
|
+
- update-package-meta (this repo)
|
|
116
|
+
2. It then:
|
|
117
|
+
|
|
118
|
+
If you use the `--update update_all` flag, it will:
|
|
119
|
+
|
|
120
|
+
- Update contrib profile information including name using whatever information is available their public github
|
|
121
|
+
account for website, location, organization, twitter, etc).
|
|
122
|
+
- Check to see that the website in their profile works, if not removes it so it doesn't begin to fail our website ci tests.
|
|
123
|
+
|
|
124
|
+
Without the `update` flag, running `update-contributors` will only add any new users that
|
|
125
|
+
are not already in the website `contributors.yml` file to a output `.pickle` file.
|
|
126
|
+
|
|
127
|
+
### update-reviews Returns:
|
|
128
|
+
|
|
129
|
+
- `all-contributors.pickle` file that will be used in the final update-reviewers script to update all reviewer contribution data.
|
|
130
|
+
|
|
131
|
+
## update-reviews script
|
|
132
|
+
|
|
133
|
+
To run:
|
|
134
|
+
`update-reviews` or
|
|
135
|
+
`update-reviews --update update_all`
|
|
136
|
+
|
|
137
|
+
- This script parses through all pyOpenSci issues in the [software-submissions repo](https://github.com/pyOpenSci/software-submission) issues where the issue has a label of 6/`pyOS-approved 🚀🚀🚀`.
|
|
138
|
+
- Grabs crucial metadata including the reviewers and editors for each.
|
|
139
|
+
- Adds people who have participated in peer review who are NOT listed currently in the website `contributors.yml` file
|
|
140
|
+
|
|
141
|
+
It then collects the
|
|
142
|
+
GitHub id and user information for:
|
|
143
|
+
|
|
144
|
+
- reviewers,
|
|
145
|
+
- submitting authors,
|
|
146
|
+
- editors and
|
|
147
|
+
- maintainers.
|
|
148
|
+
|
|
149
|
+
Finally, it updates GitHub statistics for
|
|
150
|
+
each packages including stars, last commit date and more repo metadata.
|
|
151
|
+
|
|
152
|
+
### Returns
|
|
153
|
+
|
|
154
|
+
This returns a `packages.pickle` file that will be used in the final script which bridges data between the first two scripts.
|
|
155
|
+
|
|
156
|
+
## update_reviewers script`
|
|
157
|
+
|
|
158
|
+
This script is a bridge between `update-contributors` and `update-reviews`. It parses each review in the output
|
|
159
|
+
`update-reviews.pickle` file and
|
|
160
|
+
|
|
161
|
+
1. updates contributor name in the review data (often the github username is there but the first and last name is missing). This allows us to publish the maintainer names (rather than github usernames) [on our website package listing.](https://www.pyopensci.org/python-packages.html#explore-our-accepted-scientific-python-open-source-packages)
|
|
162
|
+
1. Updates each review issue contributor's name in the contributor metadata. This allows us to ensure we have updated contributor types, package submission information etc, in the contributor.yml file on our website.
|
|
163
|
+
|
|
164
|
+
To run:
|
|
165
|
+
`update_reviewers`
|
|
166
|
+
|
|
167
|
+
### Returns
|
|
168
|
+
|
|
169
|
+
This final script uses the two pickle files
|
|
170
|
+
to update information. It then returns
|
|
171
|
+
two output files:
|
|
172
|
+
|
|
173
|
+
1. `_data/contributors.yml`
|
|
174
|
+
2. `_data/packages.yml`
|
|
175
|
+
|
|
176
|
+
Each are stored in the `/_data/file.yml` directory to mimic the directory structure of our website.
|
|
177
|
+
|
|
178
|
+
## How these scripts are used in our organization
|
|
179
|
+
|
|
180
|
+
The scripts above are called in the [GitHub
|
|
181
|
+
actions located here](https://github.com/pyOpenSci/pyopensci.github.io/tree/main/.github/workflows). These actions can be run manually via workflow dispatch but also have a cron job to update our metadata periodically.
|
|
182
|
+
|
|
183
|
+
### Data that these scripts update / maintain
|
|
184
|
+
|
|
185
|
+
- [website contributors.yml file](https://github.com/pyOpenSci/pyopensci.github.io/blob/main/_data/contributors.yml)
|
|
186
|
+
- [website packages.yml file is here](https://github.com/pyOpenSci/pyopensci.github.io/blob/main/_data/packages.yml).
|
|
187
|
+
|
|
188
|
+
## Rate limiting
|
|
189
|
+
|
|
190
|
+
TODO: right now this isn't an issue but it will be in the future I suspect....
|
|
191
|
+
Rate limiting - how to handle this...
|
|
192
|
+
|
|
193
|
+
## Using this
|
|
194
|
+
|
|
195
|
+
Create environment:
|
|
196
|
+
|
|
197
|
+
`mamba env create -f environment.yml`
|
|
198
|
+
|
|
199
|
+
## Contributors ✨
|
|
200
|
+
|
|
201
|
+
Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
|
|
202
|
+
|
|
203
|
+
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
|
|
204
|
+
<!-- prettier-ignore-start -->
|
|
205
|
+
<!-- markdownlint-disable -->
|
|
206
|
+
<table>
|
|
207
|
+
<tbody>
|
|
208
|
+
<tr>
|
|
209
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/xmnlab"><img src="https://avatars.githubusercontent.com/u/5209757?v=4?s=100" width="100px;" alt="Ivan Ogasawara"/><br /><sub><b>Ivan Ogasawara</b></sub></a><br /><a href="https://github.com/pyOpenSci/update-web-metadata/commits?author=xmnlab" title="Code">💻</a> <a href="https://github.com/pyOpenSci/update-web-metadata/pulls?q=is%3Apr+reviewed-by%3Axmnlab" title="Reviewed Pull Requests">👀</a> <a href="#design-xmnlab" title="Design">🎨</a></td>
|
|
210
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/meerkatters"><img src="https://avatars.githubusercontent.com/u/50787305?v=4?s=100" width="100px;" alt="Meer (Miriam) Williamson"/><br /><sub><b>Meer (Miriam) Williamson</b></sub></a><br /><a href="https://github.com/pyOpenSci/update-web-metadata/commits?author=meerkatters" title="Code">💻</a> <a href="https://github.com/pyOpenSci/update-web-metadata/pulls?q=is%3Apr+reviewed-by%3Ameerkatters" title="Reviewed Pull Requests">👀</a></td>
|
|
211
|
+
<td align="center" valign="top" width="14.28%"><a href="https://tiffanyxiao.com/"><img src="https://avatars.githubusercontent.com/u/13580331?v=4?s=100" width="100px;" alt="Tiffany Xiao"/><br /><sub><b>Tiffany Xiao</b></sub></a><br /><a href="https://github.com/pyOpenSci/update-web-metadata/commits?author=tiffanyxiao" title="Code">💻</a> <a href="https://github.com/pyOpenSci/update-web-metadata/pulls?q=is%3Apr+reviewed-by%3Atiffanyxiao" title="Reviewed Pull Requests">👀</a></td>
|
|
212
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/austinlg96"><img src="https://avatars.githubusercontent.com/u/19922895?v=4?s=100" width="100px;" alt="austinlg96"/><br /><sub><b>austinlg96</b></sub></a><br /><a href="https://github.com/pyOpenSci/update-web-metadata/commits?author=austinlg96" title="Code">💻</a> <a href="https://github.com/pyOpenSci/update-web-metadata/pulls?q=is%3Apr+reviewed-by%3Aaustinlg96" title="Reviewed Pull Requests">👀</a> <a href="#design-austinlg96" title="Design">🎨</a></td>
|
|
213
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/paajake"><img src="https://avatars.githubusercontent.com/u/12656820?v=4?s=100" width="100px;" alt="JAKE"/><br /><sub><b>JAKE</b></sub></a><br /><a href="https://github.com/pyOpenSci/update-web-metadata/pulls?q=is%3Apr+reviewed-by%3Apaajake" title="Reviewed Pull Requests">👀</a> <a href="https://github.com/pyOpenSci/update-web-metadata/commits?author=paajake" title="Code">💻</a> <a href="#design-paajake" title="Design">🎨</a></td>
|
|
214
|
+
<td align="center" valign="top" width="14.28%"><a href="https://luizirber.org"><img src="https://avatars.githubusercontent.com/u/6642?v=4?s=100" width="100px;" alt="Luiz Irber"/><br /><sub><b>Luiz Irber</b></sub></a><br /><a href="https://github.com/pyOpenSci/update-web-metadata/commits?author=luizirber" title="Code">💻</a> <a href="https://github.com/pyOpenSci/update-web-metadata/pulls?q=is%3Apr+reviewed-by%3Aluizirber" title="Reviewed Pull Requests">👀</a></td>
|
|
215
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/bbulpett"><img src="https://avatars.githubusercontent.com/u/6424805?v=4?s=100" width="100px;" alt="Barnabas Bulpett (He/Him)"/><br /><sub><b>Barnabas Bulpett (He/Him)</b></sub></a><br /><a href="https://github.com/pyOpenSci/update-web-metadata/commits?author=bbulpett" title="Code">💻</a> <a href="https://github.com/pyOpenSci/update-web-metadata/pulls?q=is%3Apr+reviewed-by%3Abbulpett" title="Reviewed Pull Requests">👀</a></td>
|
|
216
|
+
</tr>
|
|
217
|
+
<tr>
|
|
218
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/juanis2112"><img src="https://avatars.githubusercontent.com/u/18587879?v=4?s=100" width="100px;" alt="Juanita Gomez"/><br /><sub><b>Juanita Gomez</b></sub></a><br /><a href="https://github.com/pyOpenSci/update-web-metadata/commits?author=juanis2112" title="Code">💻</a> <a href="https://github.com/pyOpenSci/update-web-metadata/pulls?q=is%3Apr+reviewed-by%3Ajuanis2112" title="Reviewed Pull Requests">👀</a></td>
|
|
219
|
+
<td align="center" valign="top" width="14.28%"><a href="https://www.sckaiser.com"><img src="https://avatars.githubusercontent.com/u/6486256?v=4?s=100" width="100px;" alt="Sarah Kaiser"/><br /><sub><b>Sarah Kaiser</b></sub></a><br /><a href="https://github.com/pyOpenSci/update-web-metadata/commits?author=crazy4pi314" title="Code">💻</a> <a href="https://github.com/pyOpenSci/update-web-metadata/pulls?q=is%3Apr+reviewed-by%3Acrazy4pi314" title="Reviewed Pull Requests">👀</a></td>
|
|
220
|
+
</tr>
|
|
221
|
+
</tbody>
|
|
222
|
+
</table>
|
|
223
|
+
|
|
224
|
+
<!-- markdownlint-restore -->
|
|
225
|
+
<!-- prettier-ignore-end -->
|
|
226
|
+
|
|
227
|
+
<!-- ALL-CONTRIBUTORS-LIST:END -->
|
|
228
|
+
|
|
229
|
+
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
|
pyosmeta-0.2/README.md
ADDED
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
# PyOS Update and Clean Contributor & Peer Review Metadata
|
|
2
|
+
|
|
3
|
+
This repo contains a small module and 3 CLI scripts.
|
|
4
|
+
|
|
5
|
+
## Notes
|
|
6
|
+
|
|
7
|
+
To run `update-reviewers` you will need to run both `update-reviews` and `update-contributors` first to create the required input `.pickle` files.
|
|
8
|
+
|
|
9
|
+
The scripts run as follows:
|
|
10
|
+
|
|
11
|
+
## update-contributors script
|
|
12
|
+
|
|
13
|
+
This script parses data from all-contributors bot `.json`
|
|
14
|
+
files in the following repos:
|
|
15
|
+
|
|
16
|
+
- [software-submission repo](https://github.com/pyOpenSci/software-submission) where peer review happens
|
|
17
|
+
- [python-package-guide repo](https://github.com/pyOpenSci/python-package-guide)
|
|
18
|
+
- [peer review guide repo](https://github.com/pyOpenSci/software-peer-review)
|
|
19
|
+
- [pyopensci.github.io (website) repo](https://github.com/pyOpenSci/pyopensci.github.io)
|
|
20
|
+
- [update-package-meta repo](https://github.com/pyOpenSci/update-web-metadata) _(this repo)_
|
|
21
|
+
|
|
22
|
+
Running this this script:
|
|
23
|
+
|
|
24
|
+
1. Parses through all of the all-contributors bot `.json` files across our pyOpenSci repos to gather contributors to our organization. This allows us to [acknowledge contributors on our website](https://www.pyopensci.org/our-community/#pyopensci-community-contributors) who are not always making explicit code contributions (thus might not have commits). These contributors are reviewing guidebooks, participating in peer review, and performing other important tasks that are critical to our pyOpenSci mission. We acknowledge all contributions at pyOpenSci regardless of volume or size.
|
|
25
|
+
2. Updates the existing [contributors.yml](https://github.com/pyOpenSci/pyopensci.github.io/blob/main/_data/contributors.yml) file found in our website repo with new contributors and the contributor role (package guides, code workflows, peer review, etc).
|
|
26
|
+
a. If you run the script using `--update update_all`, this script will also use the GitHub api to update the users metadata from their GitHub profile.
|
|
27
|
+
|
|
28
|
+
## update-reviews script
|
|
29
|
+
|
|
30
|
+
This script parses through our (_accepted_) review issues to find packages that have been accepted. It then grabs each reviews editor, reviewers and package authors / maintainers. This information allows us to
|
|
31
|
+
|
|
32
|
+
1. Update a contributor's peer review metadata in the contributors.yml file in the third script.
|
|
33
|
+
1. Update the pyOpenSci website's package listing with the package's DOI, documentation URL.
|
|
34
|
+
1. Update the package's stats including stars, contributors, etc. using the GitHub API
|
|
35
|
+
|
|
36
|
+
## update-reviewers script
|
|
37
|
+
|
|
38
|
+
This final script is a bridge between the first it uses pickle files outputted from the
|
|
39
|
+
first two scripts to update each contributors peer review contributions including
|
|
40
|
+
|
|
41
|
+
1. packages submitted or reviewed
|
|
42
|
+
1. packages in which the contributor served as editors
|
|
43
|
+
1. contributor types associated with peer review including:
|
|
44
|
+
|
|
45
|
+
- peer-review
|
|
46
|
+
- package-maintainer
|
|
47
|
+
- package-reviewer
|
|
48
|
+
- package-editor
|
|
49
|
+
|
|
50
|
+
These general contributor types are used to drive our [website's
|
|
51
|
+
contributor search and filter functionality that you can see here.](https://www.pyopensci.org/our-community/index.html#pyopensci-community-contributors)
|
|
52
|
+
|
|
53
|
+
## Local setup
|
|
54
|
+
|
|
55
|
+
To begin:
|
|
56
|
+
|
|
57
|
+
1. Create a local environment and activate it.
|
|
58
|
+
2. Install the required dependencies via the `requirement.txt` file by running the following command;
|
|
59
|
+
`pip install -r requirements.txt`
|
|
60
|
+
3. Install the pyosmeta package in development/editable mode:
|
|
61
|
+
`pip install -e . `
|
|
62
|
+
|
|
63
|
+
### Setup token to authenticate with the GitHub API
|
|
64
|
+
|
|
65
|
+
To run this you need to [create a TOKEN that can be used to access the GitHub
|
|
66
|
+
API.](https://docs.github.com/en/rest/guides/getting-started-with-the-rest-api?apiVersion=2022-11-28#about-tokens)
|
|
67
|
+
|
|
68
|
+
After obtaining a token;
|
|
69
|
+
|
|
70
|
+
1. Duplicate the `.env-default` file and rename the copy to `.env`
|
|
71
|
+
2. Assign your token to the `GITHUB_TOKEN` variable in the `.env` file.
|
|
72
|
+
|
|
73
|
+
## How to run each script
|
|
74
|
+
|
|
75
|
+
Each script is available through the command line through entry points specified in our `pyproject.toml` file.
|
|
76
|
+
|
|
77
|
+
## update-contributors script
|
|
78
|
+
|
|
79
|
+
To run:
|
|
80
|
+
|
|
81
|
+
`update-contributors`
|
|
82
|
+
`update-contributors --update update_all`
|
|
83
|
+
|
|
84
|
+
The `update-contributors` script does the following:
|
|
85
|
+
|
|
86
|
+
1. It grabs the `all-contribs.json` files from each repository and turns that json data into a dictionary of all unique contributors across repos. Repos include:
|
|
87
|
+
- peer review guide
|
|
88
|
+
- packaging guide
|
|
89
|
+
- website
|
|
90
|
+
- software-review
|
|
91
|
+
- update-package-meta (this repo)
|
|
92
|
+
2. It then:
|
|
93
|
+
|
|
94
|
+
If you use the `--update update_all` flag, it will:
|
|
95
|
+
|
|
96
|
+
- Update contrib profile information including name using whatever information is available their public github
|
|
97
|
+
account for website, location, organization, twitter, etc).
|
|
98
|
+
- Check to see that the website in their profile works, if not removes it so it doesn't begin to fail our website ci tests.
|
|
99
|
+
|
|
100
|
+
Without the `update` flag, running `update-contributors` will only add any new users that
|
|
101
|
+
are not already in the website `contributors.yml` file to a output `.pickle` file.
|
|
102
|
+
|
|
103
|
+
### update-reviews Returns:
|
|
104
|
+
|
|
105
|
+
- `all-contributors.pickle` file that will be used in the final update-reviewers script to update all reviewer contribution data.
|
|
106
|
+
|
|
107
|
+
## update-reviews script
|
|
108
|
+
|
|
109
|
+
To run:
|
|
110
|
+
`update-reviews` or
|
|
111
|
+
`update-reviews --update update_all`
|
|
112
|
+
|
|
113
|
+
- This script parses through all pyOpenSci issues in the [software-submissions repo](https://github.com/pyOpenSci/software-submission) issues where the issue has a label of 6/`pyOS-approved 🚀🚀🚀`.
|
|
114
|
+
- Grabs crucial metadata including the reviewers and editors for each.
|
|
115
|
+
- Adds people who have participated in peer review who are NOT listed currently in the website `contributors.yml` file
|
|
116
|
+
|
|
117
|
+
It then collects the
|
|
118
|
+
GitHub id and user information for:
|
|
119
|
+
|
|
120
|
+
- reviewers,
|
|
121
|
+
- submitting authors,
|
|
122
|
+
- editors and
|
|
123
|
+
- maintainers.
|
|
124
|
+
|
|
125
|
+
Finally, it updates GitHub statistics for
|
|
126
|
+
each packages including stars, last commit date and more repo metadata.
|
|
127
|
+
|
|
128
|
+
### Returns
|
|
129
|
+
|
|
130
|
+
This returns a `packages.pickle` file that will be used in the final script which bridges data between the first two scripts.
|
|
131
|
+
|
|
132
|
+
## update_reviewers script`
|
|
133
|
+
|
|
134
|
+
This script is a bridge between `update-contributors` and `update-reviews`. It parses each review in the output
|
|
135
|
+
`update-reviews.pickle` file and
|
|
136
|
+
|
|
137
|
+
1. updates contributor name in the review data (often the github username is there but the first and last name is missing). This allows us to publish the maintainer names (rather than github usernames) [on our website package listing.](https://www.pyopensci.org/python-packages.html#explore-our-accepted-scientific-python-open-source-packages)
|
|
138
|
+
1. Updates each review issue contributor's name in the contributor metadata. This allows us to ensure we have updated contributor types, package submission information etc, in the contributor.yml file on our website.
|
|
139
|
+
|
|
140
|
+
To run:
|
|
141
|
+
`update_reviewers`
|
|
142
|
+
|
|
143
|
+
### Returns
|
|
144
|
+
|
|
145
|
+
This final script uses the two pickle files
|
|
146
|
+
to update information. It then returns
|
|
147
|
+
two output files:
|
|
148
|
+
|
|
149
|
+
1. `_data/contributors.yml`
|
|
150
|
+
2. `_data/packages.yml`
|
|
151
|
+
|
|
152
|
+
Each are stored in the `/_data/file.yml` directory to mimic the directory structure of our website.
|
|
153
|
+
|
|
154
|
+
## How these scripts are used in our organization
|
|
155
|
+
|
|
156
|
+
The scripts above are called in the [GitHub
|
|
157
|
+
actions located here](https://github.com/pyOpenSci/pyopensci.github.io/tree/main/.github/workflows). These actions can be run manually via workflow dispatch but also have a cron job to update our metadata periodically.
|
|
158
|
+
|
|
159
|
+
### Data that these scripts update / maintain
|
|
160
|
+
|
|
161
|
+
- [website contributors.yml file](https://github.com/pyOpenSci/pyopensci.github.io/blob/main/_data/contributors.yml)
|
|
162
|
+
- [website packages.yml file is here](https://github.com/pyOpenSci/pyopensci.github.io/blob/main/_data/packages.yml).
|
|
163
|
+
|
|
164
|
+
## Rate limiting
|
|
165
|
+
|
|
166
|
+
TODO: right now this isn't an issue but it will be in the future I suspect....
|
|
167
|
+
Rate limiting - how to handle this...
|
|
168
|
+
|
|
169
|
+
## Using this
|
|
170
|
+
|
|
171
|
+
Create environment:
|
|
172
|
+
|
|
173
|
+
`mamba env create -f environment.yml`
|
|
174
|
+
|
|
175
|
+
## Contributors ✨
|
|
176
|
+
|
|
177
|
+
Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
|
|
178
|
+
|
|
179
|
+
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
|
|
180
|
+
<!-- prettier-ignore-start -->
|
|
181
|
+
<!-- markdownlint-disable -->
|
|
182
|
+
<table>
|
|
183
|
+
<tbody>
|
|
184
|
+
<tr>
|
|
185
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/xmnlab"><img src="https://avatars.githubusercontent.com/u/5209757?v=4?s=100" width="100px;" alt="Ivan Ogasawara"/><br /><sub><b>Ivan Ogasawara</b></sub></a><br /><a href="https://github.com/pyOpenSci/update-web-metadata/commits?author=xmnlab" title="Code">💻</a> <a href="https://github.com/pyOpenSci/update-web-metadata/pulls?q=is%3Apr+reviewed-by%3Axmnlab" title="Reviewed Pull Requests">👀</a> <a href="#design-xmnlab" title="Design">🎨</a></td>
|
|
186
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/meerkatters"><img src="https://avatars.githubusercontent.com/u/50787305?v=4?s=100" width="100px;" alt="Meer (Miriam) Williamson"/><br /><sub><b>Meer (Miriam) Williamson</b></sub></a><br /><a href="https://github.com/pyOpenSci/update-web-metadata/commits?author=meerkatters" title="Code">💻</a> <a href="https://github.com/pyOpenSci/update-web-metadata/pulls?q=is%3Apr+reviewed-by%3Ameerkatters" title="Reviewed Pull Requests">👀</a></td>
|
|
187
|
+
<td align="center" valign="top" width="14.28%"><a href="https://tiffanyxiao.com/"><img src="https://avatars.githubusercontent.com/u/13580331?v=4?s=100" width="100px;" alt="Tiffany Xiao"/><br /><sub><b>Tiffany Xiao</b></sub></a><br /><a href="https://github.com/pyOpenSci/update-web-metadata/commits?author=tiffanyxiao" title="Code">💻</a> <a href="https://github.com/pyOpenSci/update-web-metadata/pulls?q=is%3Apr+reviewed-by%3Atiffanyxiao" title="Reviewed Pull Requests">👀</a></td>
|
|
188
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/austinlg96"><img src="https://avatars.githubusercontent.com/u/19922895?v=4?s=100" width="100px;" alt="austinlg96"/><br /><sub><b>austinlg96</b></sub></a><br /><a href="https://github.com/pyOpenSci/update-web-metadata/commits?author=austinlg96" title="Code">💻</a> <a href="https://github.com/pyOpenSci/update-web-metadata/pulls?q=is%3Apr+reviewed-by%3Aaustinlg96" title="Reviewed Pull Requests">👀</a> <a href="#design-austinlg96" title="Design">🎨</a></td>
|
|
189
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/paajake"><img src="https://avatars.githubusercontent.com/u/12656820?v=4?s=100" width="100px;" alt="JAKE"/><br /><sub><b>JAKE</b></sub></a><br /><a href="https://github.com/pyOpenSci/update-web-metadata/pulls?q=is%3Apr+reviewed-by%3Apaajake" title="Reviewed Pull Requests">👀</a> <a href="https://github.com/pyOpenSci/update-web-metadata/commits?author=paajake" title="Code">💻</a> <a href="#design-paajake" title="Design">🎨</a></td>
|
|
190
|
+
<td align="center" valign="top" width="14.28%"><a href="https://luizirber.org"><img src="https://avatars.githubusercontent.com/u/6642?v=4?s=100" width="100px;" alt="Luiz Irber"/><br /><sub><b>Luiz Irber</b></sub></a><br /><a href="https://github.com/pyOpenSci/update-web-metadata/commits?author=luizirber" title="Code">💻</a> <a href="https://github.com/pyOpenSci/update-web-metadata/pulls?q=is%3Apr+reviewed-by%3Aluizirber" title="Reviewed Pull Requests">👀</a></td>
|
|
191
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/bbulpett"><img src="https://avatars.githubusercontent.com/u/6424805?v=4?s=100" width="100px;" alt="Barnabas Bulpett (He/Him)"/><br /><sub><b>Barnabas Bulpett (He/Him)</b></sub></a><br /><a href="https://github.com/pyOpenSci/update-web-metadata/commits?author=bbulpett" title="Code">💻</a> <a href="https://github.com/pyOpenSci/update-web-metadata/pulls?q=is%3Apr+reviewed-by%3Abbulpett" title="Reviewed Pull Requests">👀</a></td>
|
|
192
|
+
</tr>
|
|
193
|
+
<tr>
|
|
194
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/juanis2112"><img src="https://avatars.githubusercontent.com/u/18587879?v=4?s=100" width="100px;" alt="Juanita Gomez"/><br /><sub><b>Juanita Gomez</b></sub></a><br /><a href="https://github.com/pyOpenSci/update-web-metadata/commits?author=juanis2112" title="Code">💻</a> <a href="https://github.com/pyOpenSci/update-web-metadata/pulls?q=is%3Apr+reviewed-by%3Ajuanis2112" title="Reviewed Pull Requests">👀</a></td>
|
|
195
|
+
<td align="center" valign="top" width="14.28%"><a href="https://www.sckaiser.com"><img src="https://avatars.githubusercontent.com/u/6486256?v=4?s=100" width="100px;" alt="Sarah Kaiser"/><br /><sub><b>Sarah Kaiser</b></sub></a><br /><a href="https://github.com/pyOpenSci/update-web-metadata/commits?author=crazy4pi314" title="Code">💻</a> <a href="https://github.com/pyOpenSci/update-web-metadata/pulls?q=is%3Apr+reviewed-by%3Acrazy4pi314" title="Reviewed Pull Requests">👀</a></td>
|
|
196
|
+
</tr>
|
|
197
|
+
</tbody>
|
|
198
|
+
</table>
|
|
199
|
+
|
|
200
|
+
<!-- markdownlint-restore -->
|
|
201
|
+
<!-- prettier-ignore-end -->
|
|
202
|
+
|
|
203
|
+
<!-- ALL-CONTRIBUTORS-LIST:END -->
|
|
204
|
+
|
|
205
|
+
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = [
|
|
3
|
+
"pdm-backend",
|
|
4
|
+
]
|
|
5
|
+
build-backend = "pdm.backend"
|
|
6
|
+
|
|
7
|
+
[project]
|
|
8
|
+
name = "pyosmeta"
|
|
9
|
+
dynamic = []
|
|
10
|
+
description = "Tools that update the pyOpenSci contributor and review metadata that is posted on our website"
|
|
11
|
+
authors = [
|
|
12
|
+
{ name = "Leah Wasser", email = "leah@pyopensci.org" },
|
|
13
|
+
]
|
|
14
|
+
maintainers = [
|
|
15
|
+
{ name = "pyOpenSci", email = "admin@pyopensci.org" },
|
|
16
|
+
]
|
|
17
|
+
classifiers = [
|
|
18
|
+
"Development Status :: 4 - Beta",
|
|
19
|
+
"Intended Audience :: Developers",
|
|
20
|
+
"Topic :: Software Development :: Build Tools",
|
|
21
|
+
"License :: OSI Approved :: MIT License",
|
|
22
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
23
|
+
"Programming Language :: Python :: 3.10",
|
|
24
|
+
"Programming Language :: Python :: 3.11",
|
|
25
|
+
]
|
|
26
|
+
dependencies = [
|
|
27
|
+
"ruamel-yaml>=0.17.21",
|
|
28
|
+
"requests",
|
|
29
|
+
"python-dotenv",
|
|
30
|
+
"pydantic",
|
|
31
|
+
]
|
|
32
|
+
requires-python = ">=3.10"
|
|
33
|
+
readme = "README.md"
|
|
34
|
+
version = "0.2"
|
|
35
|
+
|
|
36
|
+
[project.license]
|
|
37
|
+
text = "MIT"
|
|
38
|
+
|
|
39
|
+
[project.urls]
|
|
40
|
+
Homepage = "https://www.pyopensci.org"
|
|
41
|
+
"Bug Reports" = "https://github.com/pyopensci/pyosmeta/issues"
|
|
42
|
+
Source = "https://github.com/pyopensci/pyosmeta/issues"
|
|
43
|
+
|
|
44
|
+
[project.scripts]
|
|
45
|
+
update-contributors = "pyosmeta.cli.update_contributors:main"
|
|
46
|
+
update-reviews = "pyosmeta.cli.update_reviews:main"
|
|
47
|
+
update-reviewers = "pyosmeta.cli.update_review_contribs:main"
|
|
48
|
+
|
|
49
|
+
[tool.pdm.build]
|
|
50
|
+
excludes = [
|
|
51
|
+
"./**/.git",
|
|
52
|
+
]
|
|
53
|
+
package-dir = "src"
|
|
54
|
+
|
|
55
|
+
[tool.pdm.version]
|
|
56
|
+
source = "scm"
|
|
57
|
+
write_to = "pyosmeta/_version_generated.py"
|
|
58
|
+
write_template = "__version__ = 'v{}'"
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = 'v0.2'
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import argparse
|
|
2
|
+
import pickle
|
|
3
|
+
|
|
4
|
+
from pyosmeta.contributors import ProcessContributors
|
|
5
|
+
from pyosmeta.file_io import clean_export_yml, load_website_yml
|
|
6
|
+
|
|
7
|
+
# TODO: will this still run in gh actions??
|
|
8
|
+
# TODO: add update=True like i did for update_reviews
|
|
9
|
+
# TODO: still need to add a flag to not update specific fields
|
|
10
|
+
# TODO: if i use composition and there are helpers in a class
|
|
11
|
+
# that are used in a method that i call via composition are the helpers
|
|
12
|
+
# still available?
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def main():
|
|
16
|
+
update_all = False
|
|
17
|
+
parser = argparse.ArgumentParser(
|
|
18
|
+
description="A CLI script to update pyOpenSci contributors"
|
|
19
|
+
)
|
|
20
|
+
parser.add_argument(
|
|
21
|
+
"--update",
|
|
22
|
+
type=str,
|
|
23
|
+
help="Will force update contrib info from GitHub for every contributor",
|
|
24
|
+
)
|
|
25
|
+
args = parser.parse_args()
|
|
26
|
+
|
|
27
|
+
if args:
|
|
28
|
+
update_all = True
|
|
29
|
+
|
|
30
|
+
# TODO - maybe add these as an attr in the contribs class?
|
|
31
|
+
base_url = "https://raw.githubusercontent.com/pyOpenSci/"
|
|
32
|
+
end_url = "/main/.all-contributorsrc"
|
|
33
|
+
repos = [
|
|
34
|
+
"python-package-guide",
|
|
35
|
+
"software-peer-review",
|
|
36
|
+
"pyopensci.github.io",
|
|
37
|
+
"software-review",
|
|
38
|
+
"update-web-metadata",
|
|
39
|
+
]
|
|
40
|
+
json_files = [base_url + repo + end_url for repo in repos]
|
|
41
|
+
|
|
42
|
+
# Get existing contribs from pyopensci.github.io repo (website data)
|
|
43
|
+
web_yaml_path = base_url + "pyopensci.github.io/main/_data/contributors.yml"
|
|
44
|
+
|
|
45
|
+
process_contribs = ProcessContributors(json_files)
|
|
46
|
+
|
|
47
|
+
# Returns a list of dict objects with gh usernames (lowercase) as keys
|
|
48
|
+
# TODO: File io module (could just be a function)
|
|
49
|
+
web_contribs = load_website_yml(url=web_yaml_path, key="github_username")
|
|
50
|
+
bot_all_contribs_dict = process_contribs.combine_json_data()
|
|
51
|
+
|
|
52
|
+
# Parse through each user in the web yaml, if they don't exist, add them
|
|
53
|
+
# finally - update contrib types
|
|
54
|
+
for key, users in bot_all_contribs_dict.items():
|
|
55
|
+
for gh_user in users:
|
|
56
|
+
# Add any new contributors
|
|
57
|
+
if gh_user not in web_contribs.keys():
|
|
58
|
+
print("I found a new contributor! Adding:", gh_user)
|
|
59
|
+
web_contribs.update(
|
|
60
|
+
# TODO: this is also used in the other 2 scripts
|
|
61
|
+
# but add user info is in the contribs class - i do
|
|
62
|
+
# think it belongs there
|
|
63
|
+
process_contribs.check_add_user(gh_user, web_contribs)
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
# Update contrib type list
|
|
67
|
+
existing_contribs = web_contribs[gh_user]["contributor_type"]
|
|
68
|
+
# TODO: This helper is used in all three scripts but defined
|
|
69
|
+
# in the contribs class
|
|
70
|
+
web_contribs[gh_user][
|
|
71
|
+
"contributor_type"
|
|
72
|
+
] = process_contribs.update_contrib_list(existing_contribs, key)
|
|
73
|
+
|
|
74
|
+
if update_all:
|
|
75
|
+
gh_data = process_contribs.get_gh_data(web_contribs)
|
|
76
|
+
web_contribs = process_contribs.update_contrib_data(web_contribs, gh_data)
|
|
77
|
+
|
|
78
|
+
# Export data
|
|
79
|
+
# Pickle supports updates after parsing reviews
|
|
80
|
+
with open("all_contribs.pickle", "wb") as f:
|
|
81
|
+
pickle.dump(web_contribs, f)
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
if __name__ == "__main__":
|
|
85
|
+
main()
|