Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
alejsdev committed Feb 7, 2024
2 parents f9a7099 + e79bd16 commit 7813af5
Show file tree
Hide file tree
Showing 1,085 changed files with 69,711 additions and 20,982 deletions.
14 changes: 14 additions & 0 deletions .github/DISCUSSION_TEMPLATE/questions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,20 @@ body:
```
validations:
required: true
- type: input
id: pydantic-version
attributes:
label: Pydantic Version
description: |
What Pydantic version are you using?
You can find the Pydantic version with:
```bash
python -c "import pydantic; print(pydantic.version.VERSION)"
```
validations:
required: true
- type: input
id: python-version
attributes:
Expand Down
6 changes: 4 additions & 2 deletions .github/actions/comment-docs-preview-in-pr/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
FROM python:3.7
FROM python:3.10

RUN pip install httpx "pydantic==1.5.1" pygithub
COPY ./requirements.txt /app/requirements.txt

RUN pip install -r /app/requirements.txt

COPY ./app /app

Expand Down
3 changes: 2 additions & 1 deletion .github/actions/comment-docs-preview-in-pr/app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
import httpx
from github import Github
from github.PullRequest import PullRequest
from pydantic import BaseModel, BaseSettings, SecretStr, ValidationError
from pydantic import BaseModel, SecretStr, ValidationError
from pydantic_settings import BaseSettings

github_api = "https://api.github.com"

Expand Down
4 changes: 4 additions & 0 deletions .github/actions/comment-docs-preview-in-pr/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
PyGithub
pydantic>=2.5.3,<3.0.0
pydantic-settings>=2.1.0,<3.0.0
httpx
2 changes: 1 addition & 1 deletion .github/actions/notify-translations/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.7
FROM python:3.9

RUN pip install httpx PyGithub "pydantic==1.5.1" "pyyaml>=5.3.1,<6.0.0"

Expand Down
2 changes: 1 addition & 1 deletion .github/actions/notify-translations/app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from github import Github
from pydantic import BaseModel, BaseSettings, SecretStr

awaiting_label = "awaiting review"
awaiting_label = "awaiting-review"
lang_all_label = "lang-all"
approved_label = "approved-2"
translations_path = Path(__file__).parent / "translations.yml"
Expand Down
4 changes: 2 additions & 2 deletions .github/actions/people/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM python:3.7
FROM python:3.9

RUN pip install httpx PyGithub "pydantic==1.5.1" "pyyaml>=5.3.1,<6.0.0"
RUN pip install httpx PyGithub "pydantic==2.0.2" pydantic-settings "pyyaml>=5.3.1,<6.0.0"

COPY ./app /app

Expand Down
5 changes: 1 addition & 4 deletions .github/actions/people/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@ description: "Generate the data for the FastAPI People page"
author: "Sebastián Ramírez <tiangolo@gmail.com>"
inputs:
token:
description: 'User token, to read the GitHub API. Can be passed in using {{ secrets.ACTION_TOKEN }}'
required: true
standard_token:
description: 'Default GitHub Action token, used for the PR. Can be passed in using {{ secrets.GITHUB_TOKEN }}'
description: 'User token, to read the GitHub API. Can be passed in using {{ secrets.FASTAPI_PEOPLE }}'
required: true
runs:
using: 'docker'
Expand Down
17 changes: 9 additions & 8 deletions .github/actions/people/app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
import httpx
import yaml
from github import Github
from pydantic import BaseModel, BaseSettings, SecretStr
from pydantic import BaseModel, SecretStr
from pydantic_settings import BaseSettings

github_graphql_url = "https://api.github.com/graphql"
questions_category_id = "MDE4OkRpc2N1c3Npb25DYXRlZ29yeTMyMDAxNDM0"
Expand Down Expand Up @@ -352,7 +353,6 @@ class SponsorsResponse(BaseModel):

class Settings(BaseSettings):
input_token: SecretStr
input_standard_token: SecretStr
github_repository: str
httpx_timeout: int = 30

Expand Down Expand Up @@ -383,14 +383,15 @@ def get_graphql_response(
data = response.json()
if "errors" in data:
logging.error(f"Errors in response, after: {after}, category_id: {category_id}")
logging.error(data["errors"])
logging.error(response.text)
raise RuntimeError(response.text)
return data


def get_graphql_issue_edges(*, settings: Settings, after: Union[str, None] = None):
data = get_graphql_response(settings=settings, query=issues_query, after=after)
graphql_response = IssuesResponse.parse_obj(data)
graphql_response = IssuesResponse.model_validate(data)
return graphql_response.data.repository.issues.edges


Expand All @@ -405,19 +406,19 @@ def get_graphql_question_discussion_edges(
after=after,
category_id=questions_category_id,
)
graphql_response = DiscussionsResponse.parse_obj(data)
graphql_response = DiscussionsResponse.model_validate(data)
return graphql_response.data.repository.discussions.edges


def get_graphql_pr_edges(*, settings: Settings, after: Union[str, None] = None):
data = get_graphql_response(settings=settings, query=prs_query, after=after)
graphql_response = PRsResponse.parse_obj(data)
graphql_response = PRsResponse.model_validate(data)
return graphql_response.data.repository.pullRequests.edges


def get_graphql_sponsor_edges(*, settings: Settings, after: Union[str, None] = None):
data = get_graphql_response(settings=settings, query=sponsors_query, after=after)
graphql_response = SponsorsResponse.parse_obj(data)
graphql_response = SponsorsResponse.model_validate(data)
return graphql_response.data.user.sponsorshipsAsMaintainer.edges


Expand Down Expand Up @@ -608,8 +609,8 @@ def get_top_users(
if __name__ == "__main__":
logging.basicConfig(level=logging.INFO)
settings = Settings()
logging.info(f"Using config: {settings.json()}")
g = Github(settings.input_standard_token.get_secret_value())
logging.info(f"Using config: {settings.model_dump_json()}")
g = Github(settings.input_token.get_secret_value())
repo = g.get_repo(settings.github_repository)
question_commentors, question_last_month_commentors, question_authors = get_experts(
settings=settings
Expand Down
7 changes: 0 additions & 7 deletions .github/actions/watch-previews/Dockerfile

This file was deleted.

10 changes: 0 additions & 10 deletions .github/actions/watch-previews/action.yml

This file was deleted.

101 changes: 0 additions & 101 deletions .github/actions/watch-previews/app/main.py

This file was deleted.

6 changes: 5 additions & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ updates:
- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "daily"
interval: "monthly"
groups:
python-packages:
patterns:
- "*"
commit-message:
prefix:

0 comments on commit 7813af5

Please sign in to comment.