Skip to content

Commit e0c512e

Browse files
willingclwasser
authored andcommitted
Simplify readme by splitting content to a contributing file. Add badges and title structure.
1 parent bb7e8ab commit e0c512e

File tree

2 files changed

+238
-191
lines changed

2 files changed

+238
-191
lines changed

CONTRIBUTING.md

Lines changed: 186 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,186 @@
1+
# Contributing
2+
3+
To run `update-reviewers` you will need to run both `update-reviews` and `update-contributors` first to create the required input `.pickle` files.
4+
5+
The scripts run as follows:
6+
7+
## update-contributors script
8+
9+
To run this script, you can call the following at the command line:
10+
11+
`update-contributors`
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 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+
To run this script, you can call the following at the command line:
31+
32+
`update-reviews`
33+
34+
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
35+
36+
1. Update a contributor's peer review metadata in the contributors.yml file in the third script.
37+
2. Update the pyOpenSci website's package listing with the package's DOI, documentation URL.
38+
3. Update the package's stats including stars, contributors, etc. using the GitHub API
39+
40+
## process_reviews.py script
41+
42+
To run this script, you can call the following at the command line:
43+
44+
`update-review-teams`
45+
46+
This final script is a bridge between the first it uses pickle files outputted from the
47+
first two scripts to update each contributors peer review contributions including
48+
49+
1. packages submitted or reviewed
50+
2. packages in which the contributor served as editors
51+
3. contributor types associated with peer review including:
52+
53+
- peer-review
54+
- package-maintainer
55+
- package-reviewer
56+
- package-editor
57+
58+
These general contributor types are used to drive our [website's
59+
contributor search and filter functionality that you can see here.](https://www.pyopensci.org/our-community/index.html#pyopensci-community-contributors)
60+
61+
## Local setup
62+
63+
1. Create a local environment and activate it. If you are using conda:
64+
65+
```bash
66+
mamba create -n pyos-meta python=3.10
67+
mamba activate pyos-meta
68+
```
69+
70+
2. Install the package in editable mode and associated development dependencies:
71+
72+
```
73+
pip install -e ".[dev]"
74+
```
75+
76+
### Setup token to authenticate with the GitHub API
77+
78+
To run this you need to [create a TOKEN that can be used to access the GitHub
79+
API.](https://docs.github.com/en/rest/guides/getting-started-with-the-rest-api?apiVersion=2022-11-28#about-tokens)
80+
81+
After obtaining a token;
82+
83+
1. Duplicate the `.env-default` file and rename the copy to `.env`
84+
2. Assign your token to the `GITHUB_TOKEN` variable in the `.env` file.
85+
86+
## How to run each script
87+
88+
Each script is available through the command line through entry points specified in our `pyproject.toml` file.
89+
90+
## update-contributors script
91+
92+
To run:
93+
94+
`update-contributors`
95+
`update-contributors --update update_all`
96+
97+
The `update-contributors` script does the following:
98+
99+
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:
100+
- peer review guide
101+
- packaging guide
102+
- website
103+
- software-review
104+
- update-package-meta (this repo)
105+
2. It then:
106+
107+
If you use the `--update update_all` flag, it will:
108+
109+
- Update contrib profile information including name using whatever information is available their public github
110+
account for website, location, organization, twitter, etc).
111+
- 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.
112+
113+
Without the `update` flag, running `update-contributors` will only add any new users that
114+
are not already in the website `contributors.yml` file to a output `.pickle` file.
115+
116+
### update-reviews Returns:
117+
118+
- `all-contributors.pickle` file that will be used in the final update-reviewers script to update all reviewer contribution data.
119+
120+
## update-reviews script
121+
122+
To run:
123+
`update-reviews` or
124+
`update-reviews --update update_all`
125+
126+
- 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 🚀🚀🚀`.
127+
- Grabs crucial metadata including the reviewers and editors for each.
128+
- Adds people who have participated in peer review who are NOT listed currently in the website `contributors.yml` file
129+
130+
It then collects the
131+
GitHub id and user information for:
132+
133+
- reviewers,
134+
- submitting authors,
135+
- editors and
136+
- maintainers.
137+
138+
Finally, it updates GitHub statistics for
139+
each packages including stars, last commit date and more repo metadata.
140+
141+
### Returns
142+
143+
This returns a `packages.pickle` file that will be used in the final script which bridges data between the first two scripts.
144+
145+
## update_reviewers script`
146+
147+
This script is a bridge between `update-contributors` and `update-reviews`. It parses each review in the output
148+
`update-reviews.pickle` file and
149+
150+
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)
151+
2. 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.
152+
153+
To run:
154+
`update_reviewers`
155+
156+
### Returns
157+
158+
This final script uses the two pickle files
159+
to update information. It then returns
160+
two output files:
161+
162+
1. `_data/contributors.yml`
163+
2. `_data/packages.yml`
164+
165+
Each are stored in the `/_data/file.yml` directory to mimic the directory structure of our website.
166+
167+
## How these scripts are used in our organization
168+
169+
The scripts above are called in the [GitHub
170+
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.
171+
172+
### Data that these scripts update / maintain
173+
174+
- [website contributors.yml file](https://github.com/pyOpenSci/pyopensci.github.io/blob/main/_data/contributors.yml)
175+
- [website packages.yml file is here](https://github.com/pyOpenSci/pyopensci.github.io/blob/main/_data/packages.yml).
176+
177+
## Rate limiting
178+
179+
TODO: right now this isn't an issue but it will be in the future I suspect....
180+
Rate limiting - how to handle this...
181+
182+
## Using this
183+
184+
Create environment:
185+
186+
`mamba env create -f environment.yml`

0 commit comments

Comments
 (0)