Skip to content

Commit d6d7321

Browse files
authored
Upgrade dependencies and ci (#10)
* Upgrade dependencies and ci * update lock * add docs * fix pre-commit * fix dependencies * update ci
1 parent b8b6e91 commit d6d7321

20 files changed

+336
-396
lines changed

.github/workflows/changelog.yml

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Release changelog
2+
3+
on:
4+
push:
5+
tags:
6+
- v*
7+
8+
jobs:
9+
changelog:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@v4
14+
with:
15+
ref: master
16+
17+
- uses: rhysd/changelog-from-release/action@v3
18+
with:
19+
file: docs/changelog.md
20+
pull_request: true
21+
github_token: ${{ secrets.GH_TOKEN }}

.github/workflows/ci.yml

+2-4
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ on:
44
push:
55
branches:
66
- master
7-
tags:
8-
- '**'
97
pull_request:
108

119
jobs:
@@ -17,10 +15,10 @@ jobs:
1715
python-version: [ '3.10', '3.11', '3.12' ]
1816
fail-fast: false
1917
steps:
20-
- uses: actions/checkout@v3
18+
- uses: actions/checkout@v4
2119

2220
- name: Setup PDM
23-
uses: pdm-project/setup-pdm@v3
21+
uses: pdm-project/setup-pdm@v4
2422
with:
2523
python-version: ${{ matrix.python-version }}
2624

.github/workflows/docs.yml

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: docs
2+
on:
3+
push:
4+
branches:
5+
- master
6+
permissions:
7+
contents: write
8+
9+
jobs:
10+
deploy:
11+
runs-on: ubuntu-latest
12+
if: github.event.repository.fork == false
13+
steps:
14+
- uses: actions/checkout@v4
15+
- name: Configure Git Credentials
16+
run: |
17+
git config user.name github-actions[bot]
18+
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
19+
- uses: actions/setup-python@v5
20+
with:
21+
python-version: 3.x
22+
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
23+
- uses: actions/cache@v4
24+
with:
25+
key: mkdocs-material-${{ env.cache_id }}
26+
path: .cache
27+
restore-keys: |
28+
mkdocs-material-
29+
- run: sudo apt-get install pngquant
30+
- run: pip install git+https://${GH_TOKEN}@github.com/squidfunk/mkdocs-material.git
31+
- run: mkdocs gh-deploy --force
32+
env:
33+
GH_TOKEN: ${{ secrets.GH_TOKEN }}

.pre-commit-config.yaml

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
repos:
22
- repo: https://github.com/pre-commit/pre-commit-hooks
3-
rev: v4.6.0
3+
rev: v5.0.0
44
hooks:
55
- id: end-of-file-fixer
6-
- id: check-yaml
76
- id: check-toml
87

98
- repo: https://github.com/charliermarsh/ruff-pre-commit
10-
rev: v0.5.0
9+
rev: v0.9.9
1110
hooks:
1211
- id: ruff
1312
args:
1413
- '--fix'
14+
- '--unsafe-fixes'
1515
- id: ruff-format
1616

1717
- repo: https://github.com/pdm-project/pdm
18-
rev: 2.16.1
18+
rev: 2.22.3
1919
hooks:
2020
- id: pdm-lock-check

README.md

+3-22
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,11 @@
1-
# fastapi_oauth20
1+
# FastAPI OAuth 2.0
22

33
![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/fastapi-practices/fastapi_oauth20/ci.yml?logo=github)
44
[![GitHub](https://img.shields.io/github/license/wu-clan/httpfpt)](https://github.com/wu-clan/httpfpt/blob/master/LICENSE)
5-
![Static Badge](https://img.shields.io/badge/python-3.10%20%7C%203.11%20%7C%203.12-blue)
5+
![Static Badge](https://img.shields.io/badge/python-3.10%20%7C%203.11%20%7C%203.12%20%7C%203.13-blue)
66
![GitHub release (with filter)](https://img.shields.io/github/v/release/fastapi-practices/fastapi_oauth20)
77
[![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)
88

9-
在 FastAPI 中异步授权 OAuth2 客户端
9+
在 FastAPI 中异步授权 OAuth 2.0 客户端
1010

1111
我们的目标是集成多个 CN 第三方客户端,敬请期待(🐦)...
12-
13-
#### TODO:
14-
15-
如果我们能够很容易获取测试客户端,或许这会很快
16-
17-
- [ ] tests
18-
- [x] [Google](https://developers.google.cn/identity/protocols/oauth2/javascript-implicit-flow?hl=en)
19-
- [ ] 微信
20-
- [ ] QQ
21-
- [ ] 抖音
22-
- [x] [飞书](https://open.feishu.cn/document/common-capabilities/sso/web-application-sso/web-app-overview)
23-
- [ ] 钉钉
24-
- [ ] 微博
25-
- [ ] 百度
26-
- [x] [Gitee](https://gitee.com/api/v5/oauth_doc#/)
27-
- [x] [Github](https://docs.github.com/en/apps/creating-github-apps/authenticating-with-a-github-app/generating-a-user-access-token-for-a-github-app)
28-
- [X] [开源中国](https://www.oschina.net/openapi)
29-
- [ ] 阿里云
30-
- [ ] [Linux Do](https://connect.linux.do/)

docs/advanced.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
TODO...

docs/changelog.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
TODO...

docs/explanation.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
TODO...

docs/index.md

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<div align="center">
2+
<h1>🔐</h1>
3+
</div>
4+
5+
---
6+
7+
**Documentation
8+
**: <a href="https://fastapi-practices.github.io/fastapi-oauth20" target="_blank">https://fastapi-practices.github.io/fastapi-oauth20</a>
9+
10+
**Source Code
11+
**: <a href="https://github.com/fastapi-practices/fastapi-oauth20" target="_blank">https://github.com/fastapi-practices/fastapi-oauth20</a>
12+
13+
---
14+
15+
在 FastAPI 中异步授权 OAuth 2.0 客户端
16+
17+
我们的目标是集成多个 CN 第三方客户端,敬请期待(🐦)...
18+
19+
你可以在 [集成状态](integration.md) 获取当前集成情况
20+
21+
## 互动
22+
23+
[TG / Discord](https://wu-clan.github.io/homepage/)
24+
25+
## 赞助
26+
27+
如果此项目能够帮助到你,你可以赞助作者一些咖啡豆表示鼓励:[Sponsor](https://wu-clan.github.io/sponsor/)

docs/install.md

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
## 依赖
2+
3+
在安装 fastapi-oauth20 之前,请确保您满足以下先决条件:
4+
5+
- **Python** 版本 >= 3.10
6+
- **FastAPI** 版本 >= 0.100.0
7+
8+
## 安装
9+
10+
=== ":simple-piped: pip"
11+
12+
```sh
13+
pip install fastapi-oauth20
14+
```
15+
16+
=== ":simple-pdm: pdm"
17+
18+
```sh
19+
pdm add fastapi-oauth20
20+
```
21+
22+
=== ":simple-uv: uv"
23+
24+
```sh
25+
uv add fastapi-oauth20
26+
```

docs/integration.md

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
如果你有更多需求,请在仓库内创建 Issues,我们将尽力完成所有目标
2+
3+
- [x] 表示已集成
4+
- [ ] 表示待集成
5+
6+
---
7+
8+
- [x] [Linux Do](https://connect.linux.do/)
9+
- [x] [GitHub](https://docs.github.com/en/apps/creating-github-apps/authenticating-with-a-github-app/generating-a-user-access-token-for-a-github-app)
10+
- [x] [Gitee](https://gitee.com/api/v5/oauth_doc#/)
11+
- [x] [开源中国](https://www.oschina.net/openapi)
12+
- [ ] [微信小程序](https://mp.weixin.qq.com/)
13+
- [ ] [微信开放平台](https://open.weixin.qq.com/)
14+
- [ ] [企业微信二维码登录](https://work.weixin.qq.com/wework_admin/loginpage_wx?from=myhome_openApi)
15+
- [x] [飞书](https://open.feishu.cn/document/common-capabilities/sso/web-application-sso/web-app-overview)
16+
- [ ] [钉钉](https://open.dingtalk.com/document/orgapp/tutorial-obtaining-user-personal-information)
17+
- [ ] [阿里云](https://help.aliyun.com/zh/ram/user-guide/access-alibaba-cloud-apis-from-a-web-application?spm=a2c4g.11186623.0.i2)
18+
- [ ] [QQ](https://connect.qq.com/)
19+
- [ ] [微博](https://open.weibo.com/apps)
20+
- [ ] [抖音](https://open.douyin.com/)
21+
- [x] [Google](https://developers.google.cn/identity/protocols/oauth2/javascript-implicit-flow?hl=en)

docs/usage.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
TODO...

example/__init__.py

-2
This file was deleted.

example/main.py

-38
This file was deleted.

fastapi_oauth20/__init__.py

+9-19
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,11 @@
1-
"""在 FastAPI 中异步授权 OAuth2 客户端"""
1+
#!/usr/bin/env python3
2+
# -*- coding: utf-8 -*-
3+
from .clients.feishu import FeiShuOAuth20 as FeiShuOAuth20
4+
from .clients.gitee import GiteeOAuth20 as GiteeOAuth20
5+
from .clients.github import GitHubOAuth20 as GitHubOAuth20
6+
from .clients.google import GoogleOAuth20 as GoogleOAuth20
7+
from .clients.linuxdo import LinuxDoOAuth20 as LinuxDoOAuth20
8+
from .clients.oschina import OSChinaOAuth20 as OSChinaOAuth20
9+
from .integrations.fastapi import FastAPIOAuth20 as FastAPIOAuth20
210

311
__version__ = '0.0.1a2'
4-
5-
__all__ = [
6-
'OSChinaOAuth20',
7-
'GoogleOAuth20',
8-
'FeiShuOAuth20',
9-
'GiteeOAuth20',
10-
'GitHubOAuth20',
11-
'FastAPIOAuth20',
12-
'LinuxDoOAuth20',
13-
]
14-
15-
from .clients.feishu import FeiShuOAuth20
16-
from .clients.gitee import GiteeOAuth20
17-
from .clients.github import GitHubOAuth20
18-
from .clients.google import GoogleOAuth20
19-
from .clients.linuxdo import LinuxDoOAuth20
20-
from .clients.oschina import OSChinaOAuth20
21-
from .integrations.fastapi import OAuth20 as FastAPIOAuth20

fastapi_oauth20/integrations/fastapi.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from fastapi_oauth20.oauth20 import OAuth20Base
77

88

9-
class OAuth20:
9+
class FastAPIOAuth20:
1010
def __init__(
1111
self,
1212
client: OAuth20Base,

mkdocs.yml

+74
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# yaml-language-server: $schema=https://squidfunk.github.io/mkdocs-material/schema.json
2+
site_name: FastAPI OAuth 2.0
3+
site_description: 在 FastAPI 中异步授权 OAuth 2.0 客户端
4+
site_url: https://wu-clan.github.io/fastapi-oauth20
5+
site_author: Wu Clan
6+
repo_name: fastapi-oauth20
7+
repo_url: https://github.com/wu-clan/fastapi-oauth20
8+
nav:
9+
- Home:
10+
- 主页: index.md
11+
- 集成状态: integration.md
12+
- Install: install.md
13+
- Explanation: explanation.md
14+
- Usage: usage.md
15+
- Advanced: advanced.md
16+
- Changelog: changelog.md
17+
theme:
18+
name: material
19+
font:
20+
code: Roboto Mono
21+
palette:
22+
- media: '(prefers-color-scheme)'
23+
toggle:
24+
icon: material/brightness-auto
25+
name: Switch to light mode
26+
- media: '(prefers-color-scheme: light)'
27+
scheme: default
28+
primary: pink
29+
toggle:
30+
icon: material/brightness-7
31+
name: Switch to dark mode
32+
- media: '(prefers-color-scheme: dark)'
33+
scheme: slate
34+
primary: teal
35+
toggle:
36+
icon: material/brightness-4
37+
name: Switch to system preference
38+
features:
39+
- content.code.annotate
40+
- content.code.select
41+
- navigation.instant
42+
- navigation.instant.progress
43+
- navigation.path
44+
- navigation.tracking
45+
- navigation.tabs
46+
- navigation.tabs.sticky
47+
- navigation.top
48+
- navigation.footer
49+
- search.suggest
50+
- toc.follow
51+
plugins:
52+
- search
53+
markdown_extensions:
54+
- toc:
55+
permalink: true
56+
- tables
57+
- admonition
58+
- attr_list
59+
- def_list
60+
- md_in_html
61+
- pymdownx.snippets
62+
- pymdownx.superfences
63+
- pymdownx.inlinehilite
64+
- pymdownx.highlight:
65+
anchor_linenums: true
66+
line_spans: __span
67+
pygments_lang_class: true
68+
- pymdownx.tabbed:
69+
alternate_style: true
70+
- pymdownx.emoji:
71+
emoji_index: !!python/name:material.extensions.emoji.twemoji
72+
emoji_generator: !!python/name:material.extensions.emoji.to_svg
73+
- pymdownx.tasklist:
74+
custom_checkbox: true

0 commit comments

Comments
 (0)