mirror of https://github.com/tiangolo/fastapi.git
🔧 Update FastAPI People GitHub Sponsors order (#2620)
This commit is contained in:
parent
d2eb4a71ee
commit
a7cc25eb11
|
|
@ -1,10 +1,10 @@
|
||||||
import logging
|
import logging
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
from collections import Counter
|
from collections import Counter, defaultdict
|
||||||
from datetime import datetime, timedelta, timezone
|
from datetime import datetime, timedelta, timezone
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Container, Dict, List, Optional, Set
|
from typing import Container, DefaultDict, Dict, List, Optional, Set
|
||||||
|
|
||||||
import httpx
|
import httpx
|
||||||
import yaml
|
import yaml
|
||||||
|
|
@ -375,7 +375,7 @@ def get_contributors(settings: Settings):
|
||||||
return contributors, commentors, reviewers, authors
|
return contributors, commentors, reviewers, authors
|
||||||
|
|
||||||
|
|
||||||
def get_individual_sponsors(settings: Settings, max_individual_sponsor: int = 5):
|
def get_individual_sponsors(settings: Settings):
|
||||||
nodes: List[SponsorshipAsMaintainerNode] = []
|
nodes: List[SponsorshipAsMaintainerNode] = []
|
||||||
edges = get_graphql_sponsor_edges(settings=settings)
|
edges = get_graphql_sponsor_edges(settings=settings)
|
||||||
|
|
||||||
|
|
@ -385,12 +385,12 @@ def get_individual_sponsors(settings: Settings, max_individual_sponsor: int = 5)
|
||||||
last_edge = edges[-1]
|
last_edge = edges[-1]
|
||||||
edges = get_graphql_sponsor_edges(settings=settings, after=last_edge.cursor)
|
edges = get_graphql_sponsor_edges(settings=settings, after=last_edge.cursor)
|
||||||
|
|
||||||
entities: Dict[str, SponsorEntity] = {}
|
tiers: DefaultDict[float, Dict[str, SponsorEntity]] = defaultdict(dict)
|
||||||
for node in nodes:
|
for node in nodes:
|
||||||
if node.tier.monthlyPriceInDollars > max_individual_sponsor:
|
tiers[node.tier.monthlyPriceInDollars][
|
||||||
continue
|
node.sponsorEntity.login
|
||||||
entities[node.sponsorEntity.login] = node.sponsorEntity
|
] = node.sponsorEntity
|
||||||
return entities
|
return tiers
|
||||||
|
|
||||||
|
|
||||||
def get_top_users(
|
def get_top_users(
|
||||||
|
|
@ -475,12 +475,22 @@ if __name__ == "__main__":
|
||||||
skip_users=skip_users,
|
skip_users=skip_users,
|
||||||
)
|
)
|
||||||
|
|
||||||
sponsors_by_login = get_individual_sponsors(settings=settings)
|
tiers = get_individual_sponsors(settings=settings)
|
||||||
sponsors = []
|
sponsors_50 = []
|
||||||
for login, sponsor in sponsors_by_login.items():
|
for login, sponsor in tiers[50].items():
|
||||||
sponsors.append(
|
sponsors_50.append(
|
||||||
{"login": login, "avatarUrl": sponsor.avatarUrl, "url": sponsor.url}
|
{"login": login, "avatarUrl": sponsor.avatarUrl, "url": sponsor.url}
|
||||||
)
|
)
|
||||||
|
keys = list(tiers.keys())
|
||||||
|
keys.sort(reverse=True)
|
||||||
|
sponsors = []
|
||||||
|
for key in keys:
|
||||||
|
if key >= 50:
|
||||||
|
continue
|
||||||
|
for login, sponsor in tiers[key].items():
|
||||||
|
sponsors.append(
|
||||||
|
{"login": login, "avatarUrl": sponsor.avatarUrl, "url": sponsor.url}
|
||||||
|
)
|
||||||
|
|
||||||
people = {
|
people = {
|
||||||
"maintainers": maintainers,
|
"maintainers": maintainers,
|
||||||
|
|
@ -488,6 +498,7 @@ if __name__ == "__main__":
|
||||||
"last_month_active": last_month_active,
|
"last_month_active": last_month_active,
|
||||||
"top_contributors": top_contributors,
|
"top_contributors": top_contributors,
|
||||||
"top_reviewers": top_reviewers,
|
"top_reviewers": top_reviewers,
|
||||||
|
"sponsors_50": sponsors_50,
|
||||||
"sponsors": sponsors,
|
"sponsors": sponsors,
|
||||||
}
|
}
|
||||||
people_path = Path("./docs/en/data/people.yml")
|
people_path = Path("./docs/en/data/people.yml")
|
||||||
|
|
|
||||||
|
|
@ -130,6 +130,22 @@ They are supporting my work with **FastAPI** (and others), mainly through <a hre
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
{% if people %}
|
||||||
|
{% if people.sponsors_50 %}
|
||||||
|
|
||||||
|
### Bronze Sponsors
|
||||||
|
|
||||||
|
<div class="user-list user-list-center">
|
||||||
|
{% for user in people.sponsors_50 %}
|
||||||
|
|
||||||
|
<div class="user"><a href="{{ user.url }}" target="_blank"><div class="avatar-wrapper"><img src="{{ user.avatarUrl }}"/></div><div class="title">@{{ user.login }}</div></a></div>
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
### Individual Sponsors
|
### Individual Sponsors
|
||||||
|
|
||||||
{% if people %}
|
{% if people %}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue