From 4f60b7ad9ff02eb2e3280db3b1502423756f330c Mon Sep 17 00:00:00 2001 From: Wu Clan Date: Wed, 7 Feb 2024 12:39:24 +0800 Subject: [PATCH] Prepare for the release (#6) --- README.md | 9 +++++++-- example/main.py | 6 +++--- fastapi_oauth20/__init__.py | 12 ++++++++++++ .../clients/__init__.py | 0 .../clients/feishu.py | 0 .../clients/gitee.py | 0 .../clients/github.py | 0 .../clients/google.py | 0 .../clients/oschina.py | 0 {src/fastapi_oauth20 => fastapi_oauth20}/errors.py | 0 .../integrations/__init__.py | 0 .../integrations/fastapi.py | 0 {src/fastapi_oauth20 => fastapi_oauth20}/oauth20.py | 0 {src/fastapi_oauth20 => fastapi_oauth20}/py.typed | 0 pyproject.toml | 7 +++++-- src/fastapi_oauth20/__init__.py | 0 16 files changed, 27 insertions(+), 7 deletions(-) create mode 100644 fastapi_oauth20/__init__.py rename {src/fastapi_oauth20 => fastapi_oauth20}/clients/__init__.py (100%) rename {src/fastapi_oauth20 => fastapi_oauth20}/clients/feishu.py (100%) rename {src/fastapi_oauth20 => fastapi_oauth20}/clients/gitee.py (100%) rename {src/fastapi_oauth20 => fastapi_oauth20}/clients/github.py (100%) rename {src/fastapi_oauth20 => fastapi_oauth20}/clients/google.py (100%) rename {src/fastapi_oauth20 => fastapi_oauth20}/clients/oschina.py (100%) rename {src/fastapi_oauth20 => fastapi_oauth20}/errors.py (100%) rename {src/fastapi_oauth20 => fastapi_oauth20}/integrations/__init__.py (100%) rename {src/fastapi_oauth20 => fastapi_oauth20}/integrations/fastapi.py (100%) rename {src/fastapi_oauth20 => fastapi_oauth20}/oauth20.py (100%) rename {src/fastapi_oauth20 => fastapi_oauth20}/py.typed (100%) delete mode 100644 src/fastapi_oauth20/__init__.py diff --git a/README.md b/README.md index 39578fa..7453d8d 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,13 @@ # fastapi_oauth20 -在 fastapi 中轻松集成 OAuth 2.0 客户端 +![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/fastapi-practices/fastapi_oauth20/ci.yml?logo=github) +[![GitHub](https://img.shields.io/github/license/wu-clan/httpfpt)](https://github.com/wu-clan/httpfpt/blob/master/LICENSE) +![Static Badge](https://img.shields.io/badge/python-3.10%20%7C%203.11%20%7C%203.12-blue) +![GitHub release (with filter)](https://img.shields.io/github/v/release/fastapi-practices/fastapi_oauth20) +[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff) -全局异步,支持 python >= 3.10 + +在 FastAPI 中异步授权 OAuth2 客户端 我们的目标是集成多个 CN 第三方客户端,敬请期待 diff --git a/example/main.py b/example/main.py index e9575bc..e59d323 100644 --- a/example/main.py +++ b/example/main.py @@ -3,10 +3,10 @@ import uvicorn from fastapi import Depends, FastAPI -from fastapi_oauth20.clients.google import GoogleOAuth20 -from fastapi_oauth20.integrations.fastapi import OAuth20 from starlette.responses import PlainTextResponse +from fastapi_oauth20 import FastAPIOAuth20, GoogleOAuth20 + app = FastAPI() GOOGLE_CLIENT_ID = '1053650337583-ljnla4m1e5cg16erq3tld5vjflqh4bij.apps.googleusercontent.com' @@ -14,7 +14,7 @@ GOOGLE_REDIRECT_URI = 'http://localhost:8000/auth/google' google_client = GoogleOAuth20(GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET) -oauth20 = OAuth20(google_client, GOOGLE_REDIRECT_URI) +oauth20 = FastAPIOAuth20(google_client, GOOGLE_REDIRECT_URI) @app.get('/login/google') diff --git a/fastapi_oauth20/__init__.py b/fastapi_oauth20/__init__.py new file mode 100644 index 0000000..b939e42 --- /dev/null +++ b/fastapi_oauth20/__init__.py @@ -0,0 +1,12 @@ +"""在 FastAPI 中异步授权 OAuth2 客户端""" + +__version__ = '0.0.1a1' + +__all__ = ['OSChinaOAuth20', 'GoogleOAuth20', 'FeiShuOAuth20', 'GiteeOAuth20', 'GitHubOAuth20', 'FastAPIOAuth20'] + +from .clients.feishu import FeiShuOAuth20 +from .clients.gitee import GiteeOAuth20 +from .clients.github import GitHubOAuth20 +from .clients.google import GoogleOAuth20 +from .clients.oschina import OSChinaOAuth20 +from .integrations.fastapi import OAuth20 as FastAPIOAuth20 diff --git a/src/fastapi_oauth20/clients/__init__.py b/fastapi_oauth20/clients/__init__.py similarity index 100% rename from src/fastapi_oauth20/clients/__init__.py rename to fastapi_oauth20/clients/__init__.py diff --git a/src/fastapi_oauth20/clients/feishu.py b/fastapi_oauth20/clients/feishu.py similarity index 100% rename from src/fastapi_oauth20/clients/feishu.py rename to fastapi_oauth20/clients/feishu.py diff --git a/src/fastapi_oauth20/clients/gitee.py b/fastapi_oauth20/clients/gitee.py similarity index 100% rename from src/fastapi_oauth20/clients/gitee.py rename to fastapi_oauth20/clients/gitee.py diff --git a/src/fastapi_oauth20/clients/github.py b/fastapi_oauth20/clients/github.py similarity index 100% rename from src/fastapi_oauth20/clients/github.py rename to fastapi_oauth20/clients/github.py diff --git a/src/fastapi_oauth20/clients/google.py b/fastapi_oauth20/clients/google.py similarity index 100% rename from src/fastapi_oauth20/clients/google.py rename to fastapi_oauth20/clients/google.py diff --git a/src/fastapi_oauth20/clients/oschina.py b/fastapi_oauth20/clients/oschina.py similarity index 100% rename from src/fastapi_oauth20/clients/oschina.py rename to fastapi_oauth20/clients/oschina.py diff --git a/src/fastapi_oauth20/errors.py b/fastapi_oauth20/errors.py similarity index 100% rename from src/fastapi_oauth20/errors.py rename to fastapi_oauth20/errors.py diff --git a/src/fastapi_oauth20/integrations/__init__.py b/fastapi_oauth20/integrations/__init__.py similarity index 100% rename from src/fastapi_oauth20/integrations/__init__.py rename to fastapi_oauth20/integrations/__init__.py diff --git a/src/fastapi_oauth20/integrations/fastapi.py b/fastapi_oauth20/integrations/fastapi.py similarity index 100% rename from src/fastapi_oauth20/integrations/fastapi.py rename to fastapi_oauth20/integrations/fastapi.py diff --git a/src/fastapi_oauth20/oauth20.py b/fastapi_oauth20/oauth20.py similarity index 100% rename from src/fastapi_oauth20/oauth20.py rename to fastapi_oauth20/oauth20.py diff --git a/src/fastapi_oauth20/py.typed b/fastapi_oauth20/py.typed similarity index 100% rename from src/fastapi_oauth20/py.typed rename to fastapi_oauth20/py.typed diff --git a/pyproject.toml b/pyproject.toml index 5339eb0..46d1fb4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,9 @@ [project] name = "fastapi_oauth20" -version = "0.0.1" -description = "FastAPI easily integrates with clients OAuth 2.0" +description = "在 FastAPI 中异步授权 OAuth2 客户端" +dynamic = [ + "version", +] authors = [ { name = "Wu Clan", email = "jianhengwu0407@gmail.com" }, ] @@ -38,6 +40,7 @@ quote-style = "single" [tool.pdm] package-type = "library" +version = { source = "file", path = "fastapi_oauth20/__init__.py" } [build-system] requires = ["pdm-backend"] diff --git a/src/fastapi_oauth20/__init__.py b/src/fastapi_oauth20/__init__.py deleted file mode 100644 index e69de29..0000000