Skip to content

Commit b16a42d

Browse files
authored
Merge branch 'main' into reduce-dependencies
2 parents 5a3796c + 9dbf7bf commit b16a42d

24 files changed

+110
-536
lines changed

.circleci/config.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,7 @@ jobs:
4949
# NOTE: bad interaction w/ blas multithreading on circleci
5050
export OMP_NUM_THREADS=1
5151
source venv/bin/activate
52-
cd devstats.scientific-python.org
53-
git submodule update --init
54-
make html
52+
(cd devstats.scientific-python.org && make html)
5553
5654
- store_artifacts:
5755
path: devstats.scientific-python.org/_build/html

.github/workflows/circleci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: circleci
1+
name: Run CircleCI asrtifacts redirector for rendered HTML
22

33
on: [status]
44
jobs:
@@ -7,7 +7,7 @@ jobs:
77
name: Run CircleCI documentation artifact redirector
88
steps:
99
- name: GitHub Action step
10-
uses: larsoner/circleci-artifacts-redirector-action@master
10+
uses: scientific-python/circleci-artifacts-redirector-action@4e13a10d89177f4bfc8007a7064bdbeda848d8d1 # v1.0.0
1111
with:
1212
repo-token: ${{ secrets.GITHUB_TOKEN }}
1313
api-token: ${{ secrets.DEVSTATS_CIRCLECI_TOKEN }}

.github/workflows/milestone-merged-prs.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
name: attach to PR
1313
runs-on: ubuntu-latest
1414
steps:
15-
- uses: scientific-python/attach-next-milestone-action@bc07be829f693829263e57d5e8489f4e57d3d420
15+
- uses: scientific-python/attach-next-milestone-action@c9cfab10ad0c67fed91b01103db26b7f16634639
1616
with:
1717
token: ${{ secrets.MILESTONE_LABELER_TOKEN }}
1818
force: true

.gitignore

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,5 +160,13 @@ cython_debug/
160160
# and can be added to the global gitignore or merged into this file. For a more nuclear
161161
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
162162
#.idea/
163-
# MAC
163+
164+
# MacOS
164165
.DS_Store
166+
167+
# VSCode
168+
.vscode/
169+
.history/
170+
171+
# devstats
172+
devstats-data/

.pre-commit-config.yaml

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
1-
# Install pre-commit hooks via
2-
# pre-commit install
3-
41
repos:
52
- repo: https://github.com/pre-commit/pre-commit-hooks
6-
rev: 2c9f875913ee60ca25ce70243dc24d5b6415598c # frozen: v4.6.0
3+
rev: cef0300fd0fc4d2a87a85fa2093c6b283ea36f4b # frozen: v5.0.0
74
hooks:
85
- id: check-added-large-files
96
- id: check-ast
@@ -18,22 +15,22 @@ repos:
1815
- id: mixed-line-ending
1916
- id: trailing-whitespace
2017

21-
- repo: https://github.com/pre-commit/mirrors-prettier
22-
rev: ffb6a759a979008c0e6dff86e39f4745a2d9eac4 # frozen: v3.1.0
18+
- repo: https://github.com/rbubley/mirrors-prettier
19+
rev: 787fb9f542b140ba0b2aced38e6a3e68021647a3 # frozen: v3.5.3
2320
hooks:
2421
- id: prettier
25-
files: \.(css|html|md|yml|yaml)
22+
files: \.(css|html|md|yml|yaml|gql)
2623
args: [--prose-wrap=preserve]
2724

2825
- repo: https://github.com/astral-sh/ruff-pre-commit
29-
rev: 1dc9eb131c2ea4816c708e4d85820d2cc8542683 # frozen: v0.5.0
26+
rev: 971923581912ef60a6b70dbf0c3e9a39563c9d47 # frozen: v0.11.4
3027
hooks:
3128
- id: ruff
3229
args: ["--fix", "--show-fixes", "--exit-non-zero-on-fix"]
3330
- id: ruff-format
3431

3532
- repo: https://github.com/codespell-project/codespell
36-
rev: "193cd7d27cd571f79358af09a8fb8997e54f8fff" # frozen: v2.3.0
33+
rev: "63c8f8312b7559622c0d82815639671ae42132ac" # frozen: v2.4.1
3734
hooks:
3835
- id: codespell
3936

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ This repository holds the `devstats` package. `devstats` is a Python command lin
66
generate developer statistics and a developer statistics report for a specified
77
project.
88

9+
## Data bundles & reports
10+
11+
We make [regular data-bundle releases](https://github.com/scientific-python/devstats-data/releases) for several key scientific Python projects.
12+
13+
We also build reports for this data, available at https://devstats.scientific-python.org
14+
915
## OAuth key for accessing GitHub
1016

1117
Per the [GitHub GraphQL API docs](https://developer.github.com/v4/guides/forming-calls/),

devstats/__main__.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
import collections
2+
import json
23
import os
34
import re
45
import sys
56
from glob import glob
67

78
import click
9+
import requests
810

911
from .publish import publish, template
1012
from .query import GithubGrabber
@@ -77,6 +79,30 @@ def query(repo_owner, repo_name, outdir):
7779
ftype = {"issues": "issues", "pullRequests": "PRs"}
7880
data.dump(f"{outdir}/{repo_name}_{ftype.get(qtype, qtype)}.json")
7981

82+
# get stars over time
83+
url = f"https://api.github.com/repos/{repo_owner}/{repo_name}/stargazers"
84+
headers = {
85+
"Accept": "application/vnd.github.v3.star+json",
86+
"Authorization": f"Bearer {token}",
87+
"X-GitHub-Api-Version": "2022-11-28",
88+
}
89+
90+
response = requests.get(url, headers=headers)
91+
92+
if response.status_code == 200:
93+
stargazers = response.json()
94+
with open(f"{outdir}/{repo_name}_stars.json", "w") as outf:
95+
simplified = [
96+
{"starred_at": user["starred_at"], "login": user["user"]["login"]}
97+
for user in stargazers
98+
]
99+
json.dump(simplified, outf)
100+
else:
101+
print(
102+
"Request failed for collecting start with status code "
103+
f"{response.status_code}"
104+
)
105+
80106

81107
cli.add_command(template)
82108
cli.add_command(publish)

devstats/publish.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def publish(project, templatedir, outdir):
8787
flags=re.MULTILINE,
8888
)
8989

90-
for v in variables:
91-
template = template.replace("{{ " + v + " }}", variables[v])
90+
for key, value in variables.items():
91+
template = template.replace("{{ " + key + " }}", value)
9292

9393
fh.write(template)

devstats/queries/issue_activity_since_date.gql

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,34 @@
11
query {
22
repository(owner: "_REPO_OWNER_", name: "_REPO_NAME_") {
3-
issues(first: 100, filterBy: {since: "2020-01-01T00:00:00Z"}) {
3+
issues(first: 100, filterBy: { since: "2020-01-01T00:00:00Z" }) {
44
totalCount
55
edges {
66
cursor
77
node {
88
number
99
title
1010
createdAt
11-
state
12-
closedAt
1311
updatedAt
12+
closedAt
13+
state
1414
url
15+
reactionGroups {
16+
content
17+
users {
18+
totalCount
19+
}
20+
}
1521
labels(first: 100) {
1622
edges {
1723
node {
1824
name
1925
}
2026
}
2127
}
22-
timelineItems(first: 100, itemTypes: [CROSS_REFERENCED_EVENT, ISSUE_COMMENT, CLOSED_EVENT]) {
28+
timelineItems(
29+
first: 100
30+
itemTypes: [CROSS_REFERENCED_EVENT, ISSUE_COMMENT, CLOSED_EVENT]
31+
) {
2332
totalCount
2433
edges {
2534
node {

devstats/queries/pr_data_query.gql

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,37 @@
11
query {
2-
repository(owner:"_REPO_OWNER_", name:"_REPO_NAME_") {
3-
pullRequests(first:100) {
2+
repository(owner: "_REPO_OWNER_", name: "_REPO_NAME_") {
3+
pullRequests(first: 100) {
44
totalCount
55
edges {
66
cursor
7-
node{
7+
node {
88
number
99
state
1010
title
1111
createdAt
12+
updatedAt
13+
closedAt
1214
baseRefName
1315
mergeable
14-
author{
16+
labels(first: 100) {
17+
edges {
18+
node {
19+
name
20+
}
21+
}
22+
}
23+
author {
1524
login
1625
}
1726
authorAssociation
18-
mergedBy{
27+
mergedBy {
1928
login
2029
}
2130
mergedAt
22-
reviews(states:APPROVED){
31+
reviews(states: APPROVED) {
2332
totalCount
2433
}
25-
participants(first:100){
34+
participants(first: 100) {
2635
totalCount
2736
}
2837
}

0 commit comments

Comments
 (0)