oauth-cli-kit 0.1.1__tar.gz → 0.1.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,20 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *.pyd
5
+
6
+ # Test / coverage
7
+ .pytest_cache/
8
+ .coverage
9
+ htmlcov/
10
+
11
+ # Build artifacts
12
+ dist/
13
+ build/
14
+ *.egg-info/
15
+
16
+ # Envs
17
+ .venv/
18
+ .env
19
+
20
+ uv.lock
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: oauth-cli-kit
3
- Version: 0.1.1
3
+ Version: 0.1.3
4
4
  Summary: Reusable OAuth 2.0 + PKCE helpers for CLI applications
5
5
  Author: nanobot contributors
6
6
  License: MIT
@@ -14,3 +14,5 @@ Classifier: Programming Language :: Python :: 3.12
14
14
  Requires-Python: >=3.11
15
15
  Requires-Dist: httpx>=0.25.0
16
16
  Requires-Dist: platformdirs>=4.0.0
17
+ Provides-Extra: dev
18
+ Requires-Dist: pytest>=8.0.0; extra == 'dev'
@@ -1,8 +1,8 @@
1
1
  """oauth-cli-kit public API."""
2
2
 
3
- from oauth_cli_kit.constants import OPENAI_CODEX_PROVIDER
4
3
  from oauth_cli_kit.flow import get_token, login_oauth_interactive
5
4
  from oauth_cli_kit.models import OAuthProviderConfig, OAuthToken
5
+ from oauth_cli_kit.providers import OPENAI_CODEX_PROVIDER
6
6
 
7
7
  __all__ = [
8
8
  "OPENAI_CODEX_PROVIDER",
@@ -0,0 +1,25 @@
1
+ """Default provider settings and constants."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from oauth_cli_kit.providers.openai_codex import OPENAI_CODEX_PROVIDER
6
+
7
+ SUCCESS_HTML = (
8
+ "<!doctype html>"
9
+ "<html lang=\"en\">"
10
+ "<head>"
11
+ "<meta charset=\"utf-8\" />"
12
+ "<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />"
13
+ "<title>Authentication successful</title>"
14
+ "</head>"
15
+ "<body>"
16
+ "<p>Authentication successful. Return to your terminal to continue.</p>"
17
+ "</body>"
18
+ "</html>"
19
+ )
20
+
21
+ # 兼容性:历史上从 oauth_cli_kit.constants 导入 provider。
22
+ __all__ = [
23
+ "SUCCESS_HTML",
24
+ "OPENAI_CODEX_PROVIDER",
25
+ ]
@@ -12,8 +12,8 @@ from typing import Callable
12
12
 
13
13
  import httpx
14
14
 
15
- from oauth_cli_kit.constants import OPENAI_CODEX_PROVIDER
16
15
  from oauth_cli_kit.models import OAuthProviderConfig, OAuthToken
16
+ from oauth_cli_kit.providers import OPENAI_CODEX_PROVIDER
17
17
  from oauth_cli_kit.pkce import (
18
18
  _create_state,
19
19
  _decode_account_id,
@@ -0,0 +1,14 @@
1
+ """OAuth Provider 配置集合。
2
+
3
+ 设计目标:
4
+ 1) 让 codex / Claude Code 等多个 CLI 的 OAuth 配置以“providers 子包”统一管理;
5
+ 2) 保持现有对外 API(例如 oauth_cli_kit.constants.OPENAI_CODEX_PROVIDER)不变;
6
+ 3) 后续新增 provider 时,只需在本目录新增一个模块并在此处导出即可。
7
+ """
8
+
9
+ from oauth_cli_kit.providers.openai_codex import OPENAI_CODEX_PROVIDER
10
+
11
+ __all__ = [
12
+ "OPENAI_CODEX_PROVIDER",
13
+ ]
14
+
@@ -1,23 +1,11 @@
1
- """Default provider settings and constants."""
1
+ """OpenAI Codex CLI 的默认 OAuth Provider 配置。"""
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
5
  from oauth_cli_kit.models import OAuthProviderConfig
6
6
 
7
- SUCCESS_HTML = (
8
- "<!doctype html>"
9
- "<html lang=\"en\">"
10
- "<head>"
11
- "<meta charset=\"utf-8\" />"
12
- "<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />"
13
- "<title>Authentication successful</title>"
14
- "</head>"
15
- "<body>"
16
- "<p>Authentication successful. Return to your terminal to continue.</p>"
17
- "</body>"
18
- "</html>"
19
- )
20
7
 
8
+ # 注意:这里仅组织配置位置(从 constants.py 挪到 providers/),不改变任何字段/逻辑。
21
9
  OPENAI_CODEX_PROVIDER = OAuthProviderConfig(
22
10
  client_id="app_EMoamEEZ73f0CkXaXp7hrann",
23
11
  authorize_url="https://auth.openai.com/oauth/authorize",
@@ -28,4 +16,5 @@ OPENAI_CODEX_PROVIDER = OAuthProviderConfig(
28
16
  account_id_claim="chatgpt_account_id",
29
17
  default_originator="nanobot",
30
18
  token_filename="codex.json",
31
- )
19
+ )
20
+
@@ -19,6 +19,12 @@ dependencies = [
19
19
  "platformdirs>=4.0.0",
20
20
  ]
21
21
 
22
+ [project.optional-dependencies]
23
+ # 开发/CI 使用的依赖,不影响库的运行时依赖与现有逻辑。
24
+ dev = [
25
+ "pytest>=8.0.0",
26
+ ]
27
+
22
28
  [build-system]
23
29
  requires = ["hatchling", "hatch-vcs"]
24
30
  build-backend = "hatchling.build"
@@ -35,3 +41,7 @@ include = [
35
41
 
36
42
  [tool.hatch.version]
37
43
  source = "vcs"
44
+
45
+ [tool.pytest.ini_options]
46
+ addopts = "-q"
47
+ testpaths = ["tests"]
File without changes
File without changes