unifyport-sdk 0.1.0__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.
Files changed (186) hide show
  1. unifyport_sdk-0.1.0/.github/dependabot.yml +12 -0
  2. unifyport_sdk-0.1.0/.github/workflows/ci.yml +122 -0
  3. unifyport_sdk-0.1.0/.github/workflows/release.yml +148 -0
  4. unifyport_sdk-0.1.0/.gitignore +16 -0
  5. unifyport_sdk-0.1.0/AGENTS.md +51 -0
  6. unifyport_sdk-0.1.0/CHANGELOG.md +15 -0
  7. unifyport_sdk-0.1.0/LICENSE +21 -0
  8. unifyport_sdk-0.1.0/PKG-INFO +193 -0
  9. unifyport_sdk-0.1.0/README.md +139 -0
  10. unifyport_sdk-0.1.0/README.zh-CN.md +137 -0
  11. unifyport_sdk-0.1.0/contracts/device.openapi.yaml +3141 -0
  12. unifyport_sdk-0.1.0/docs/acceptance-report.md +49 -0
  13. unifyport_sdk-0.1.0/docs/api-coverage.md +23 -0
  14. unifyport_sdk-0.1.0/docs/api-reference/README.md +74 -0
  15. unifyport_sdk-0.1.0/docs/api-reference/block-contact.md +59 -0
  16. unifyport_sdk-0.1.0/docs/api-reference/cancel-account-auth.md +59 -0
  17. unifyport_sdk-0.1.0/docs/api-reference/check-account-qr-auth.md +59 -0
  18. unifyport_sdk-0.1.0/docs/api-reference/create-account.md +59 -0
  19. unifyport_sdk-0.1.0/docs/api-reference/create-api-key.md +59 -0
  20. unifyport_sdk-0.1.0/docs/api-reference/create-group.md +59 -0
  21. unifyport_sdk-0.1.0/docs/api-reference/create-webhook-endpoint.md +59 -0
  22. unifyport_sdk-0.1.0/docs/api-reference/deactivate-webhook-endpoint.md +59 -0
  23. unifyport_sdk-0.1.0/docs/api-reference/delete-account.md +59 -0
  24. unifyport_sdk-0.1.0/docs/api-reference/delete-conversation-label.md +59 -0
  25. unifyport_sdk-0.1.0/docs/api-reference/delete-webhook-endpoint.md +59 -0
  26. unifyport_sdk-0.1.0/docs/api-reference/edit-message.md +59 -0
  27. unifyport_sdk-0.1.0/docs/api-reference/get-account-auth-state.md +59 -0
  28. unifyport_sdk-0.1.0/docs/api-reference/get-account.md +59 -0
  29. unifyport_sdk-0.1.0/docs/api-reference/get-contact.md +59 -0
  30. unifyport_sdk-0.1.0/docs/api-reference/get-conversation.md +60 -0
  31. unifyport_sdk-0.1.0/docs/api-reference/get-group-invite-code.md +59 -0
  32. unifyport_sdk-0.1.0/docs/api-reference/get-group.md +59 -0
  33. unifyport_sdk-0.1.0/docs/api-reference/get-webhook-endpoint.md +59 -0
  34. unifyport_sdk-0.1.0/docs/api-reference/get-workspace.md +59 -0
  35. unifyport_sdk-0.1.0/docs/api-reference/import-account-auth-session.md +59 -0
  36. unifyport_sdk-0.1.0/docs/api-reference/leave-group.md +59 -0
  37. unifyport_sdk-0.1.0/docs/api-reference/list-accounts.md +59 -0
  38. unifyport_sdk-0.1.0/docs/api-reference/list-api-keys.md +59 -0
  39. unifyport_sdk-0.1.0/docs/api-reference/list-contact-blocklist.md +59 -0
  40. unifyport_sdk-0.1.0/docs/api-reference/list-contacts.md +62 -0
  41. unifyport_sdk-0.1.0/docs/api-reference/list-conversation-labels.md +60 -0
  42. unifyport_sdk-0.1.0/docs/api-reference/list-conversation-members.md +62 -0
  43. unifyport_sdk-0.1.0/docs/api-reference/list-conversations.md +62 -0
  44. unifyport_sdk-0.1.0/docs/api-reference/list-group-join-requests.md +59 -0
  45. unifyport_sdk-0.1.0/docs/api-reference/list-groups.md +60 -0
  46. unifyport_sdk-0.1.0/docs/api-reference/list-provider-regions.md +59 -0
  47. unifyport_sdk-0.1.0/docs/api-reference/list-webhook-endpoints.md +59 -0
  48. unifyport_sdk-0.1.0/docs/api-reference/mark-conversation-read.md +59 -0
  49. unifyport_sdk-0.1.0/docs/api-reference/mark-conversation-unread.md +59 -0
  50. unifyport_sdk-0.1.0/docs/api-reference/mute-conversation.md +59 -0
  51. unifyport_sdk-0.1.0/docs/api-reference/pin-conversation.md +59 -0
  52. unifyport_sdk-0.1.0/docs/api-reference/pin-message.md +59 -0
  53. unifyport_sdk-0.1.0/docs/api-reference/react-message.md +59 -0
  54. unifyport_sdk-0.1.0/docs/api-reference/reconnect-account-runtime.md +59 -0
  55. unifyport_sdk-0.1.0/docs/api-reference/refresh-account-runtime.md +59 -0
  56. unifyport_sdk-0.1.0/docs/api-reference/revoke-message.md +59 -0
  57. unifyport_sdk-0.1.0/docs/api-reference/rotate-api-key.md +59 -0
  58. unifyport_sdk-0.1.0/docs/api-reference/send-message.md +59 -0
  59. unifyport_sdk-0.1.0/docs/api-reference/set-contact-note.md +59 -0
  60. unifyport_sdk-0.1.0/docs/api-reference/set-conversation-label-members.md +59 -0
  61. unifyport_sdk-0.1.0/docs/api-reference/set-group-join-approval-mode.md +59 -0
  62. unifyport_sdk-0.1.0/docs/api-reference/start-account-auth.md +59 -0
  63. unifyport_sdk-0.1.0/docs/api-reference/start-account-qr-auth.md +59 -0
  64. unifyport_sdk-0.1.0/docs/api-reference/start-account-runtime.md +59 -0
  65. unifyport_sdk-0.1.0/docs/api-reference/stop-account-runtime.md +59 -0
  66. unifyport_sdk-0.1.0/docs/api-reference/submit-account-auth-code.md +59 -0
  67. unifyport_sdk-0.1.0/docs/api-reference/submit-account-auth-password.md +59 -0
  68. unifyport_sdk-0.1.0/docs/api-reference/unblock-contact.md +59 -0
  69. unifyport_sdk-0.1.0/docs/api-reference/unmute-conversation.md +59 -0
  70. unifyport_sdk-0.1.0/docs/api-reference/unpin-conversation.md +59 -0
  71. unifyport_sdk-0.1.0/docs/api-reference/update-account.md +59 -0
  72. unifyport_sdk-0.1.0/docs/api-reference/update-api-key-status.md +59 -0
  73. unifyport_sdk-0.1.0/docs/api-reference/update-group-info.md +59 -0
  74. unifyport_sdk-0.1.0/docs/api-reference/update-group-join-requests.md +59 -0
  75. unifyport_sdk-0.1.0/docs/api-reference/update-group-members.md +59 -0
  76. unifyport_sdk-0.1.0/docs/api-reference/update-webhook-endpoint.md +59 -0
  77. unifyport_sdk-0.1.0/docs/api-reference/update-workspace.md +59 -0
  78. unifyport_sdk-0.1.0/docs/api-reference/upsert-conversation-label.md +59 -0
  79. unifyport_sdk-0.1.0/docs/architecture.md +62 -0
  80. unifyport_sdk-0.1.0/docs/contract-maintenance.md +42 -0
  81. unifyport_sdk-0.1.0/docs/release-notes.md +17 -0
  82. unifyport_sdk-0.1.0/docs/security.md +62 -0
  83. unifyport_sdk-0.1.0/docs/zh-CN/acceptance-report.md +48 -0
  84. unifyport_sdk-0.1.0/docs/zh-CN/api-coverage.md +23 -0
  85. unifyport_sdk-0.1.0/docs/zh-CN/api-reference/README.md +74 -0
  86. unifyport_sdk-0.1.0/docs/zh-CN/api-reference/block-contact.md +59 -0
  87. unifyport_sdk-0.1.0/docs/zh-CN/api-reference/cancel-account-auth.md +59 -0
  88. unifyport_sdk-0.1.0/docs/zh-CN/api-reference/check-account-qr-auth.md +59 -0
  89. unifyport_sdk-0.1.0/docs/zh-CN/api-reference/create-account.md +59 -0
  90. unifyport_sdk-0.1.0/docs/zh-CN/api-reference/create-api-key.md +59 -0
  91. unifyport_sdk-0.1.0/docs/zh-CN/api-reference/create-group.md +59 -0
  92. unifyport_sdk-0.1.0/docs/zh-CN/api-reference/create-webhook-endpoint.md +59 -0
  93. unifyport_sdk-0.1.0/docs/zh-CN/api-reference/deactivate-webhook-endpoint.md +59 -0
  94. unifyport_sdk-0.1.0/docs/zh-CN/api-reference/delete-account.md +59 -0
  95. unifyport_sdk-0.1.0/docs/zh-CN/api-reference/delete-conversation-label.md +59 -0
  96. unifyport_sdk-0.1.0/docs/zh-CN/api-reference/delete-webhook-endpoint.md +59 -0
  97. unifyport_sdk-0.1.0/docs/zh-CN/api-reference/edit-message.md +59 -0
  98. unifyport_sdk-0.1.0/docs/zh-CN/api-reference/get-account-auth-state.md +59 -0
  99. unifyport_sdk-0.1.0/docs/zh-CN/api-reference/get-account.md +59 -0
  100. unifyport_sdk-0.1.0/docs/zh-CN/api-reference/get-contact.md +59 -0
  101. unifyport_sdk-0.1.0/docs/zh-CN/api-reference/get-conversation.md +60 -0
  102. unifyport_sdk-0.1.0/docs/zh-CN/api-reference/get-group-invite-code.md +59 -0
  103. unifyport_sdk-0.1.0/docs/zh-CN/api-reference/get-group.md +59 -0
  104. unifyport_sdk-0.1.0/docs/zh-CN/api-reference/get-webhook-endpoint.md +59 -0
  105. unifyport_sdk-0.1.0/docs/zh-CN/api-reference/get-workspace.md +59 -0
  106. unifyport_sdk-0.1.0/docs/zh-CN/api-reference/import-account-auth-session.md +59 -0
  107. unifyport_sdk-0.1.0/docs/zh-CN/api-reference/leave-group.md +59 -0
  108. unifyport_sdk-0.1.0/docs/zh-CN/api-reference/list-accounts.md +59 -0
  109. unifyport_sdk-0.1.0/docs/zh-CN/api-reference/list-api-keys.md +59 -0
  110. unifyport_sdk-0.1.0/docs/zh-CN/api-reference/list-contact-blocklist.md +59 -0
  111. unifyport_sdk-0.1.0/docs/zh-CN/api-reference/list-contacts.md +62 -0
  112. unifyport_sdk-0.1.0/docs/zh-CN/api-reference/list-conversation-labels.md +60 -0
  113. unifyport_sdk-0.1.0/docs/zh-CN/api-reference/list-conversation-members.md +62 -0
  114. unifyport_sdk-0.1.0/docs/zh-CN/api-reference/list-conversations.md +62 -0
  115. unifyport_sdk-0.1.0/docs/zh-CN/api-reference/list-group-join-requests.md +59 -0
  116. unifyport_sdk-0.1.0/docs/zh-CN/api-reference/list-groups.md +60 -0
  117. unifyport_sdk-0.1.0/docs/zh-CN/api-reference/list-provider-regions.md +59 -0
  118. unifyport_sdk-0.1.0/docs/zh-CN/api-reference/list-webhook-endpoints.md +59 -0
  119. unifyport_sdk-0.1.0/docs/zh-CN/api-reference/mark-conversation-read.md +59 -0
  120. unifyport_sdk-0.1.0/docs/zh-CN/api-reference/mark-conversation-unread.md +59 -0
  121. unifyport_sdk-0.1.0/docs/zh-CN/api-reference/mute-conversation.md +59 -0
  122. unifyport_sdk-0.1.0/docs/zh-CN/api-reference/pin-conversation.md +59 -0
  123. unifyport_sdk-0.1.0/docs/zh-CN/api-reference/pin-message.md +59 -0
  124. unifyport_sdk-0.1.0/docs/zh-CN/api-reference/react-message.md +59 -0
  125. unifyport_sdk-0.1.0/docs/zh-CN/api-reference/reconnect-account-runtime.md +59 -0
  126. unifyport_sdk-0.1.0/docs/zh-CN/api-reference/refresh-account-runtime.md +59 -0
  127. unifyport_sdk-0.1.0/docs/zh-CN/api-reference/revoke-message.md +59 -0
  128. unifyport_sdk-0.1.0/docs/zh-CN/api-reference/rotate-api-key.md +59 -0
  129. unifyport_sdk-0.1.0/docs/zh-CN/api-reference/send-message.md +59 -0
  130. unifyport_sdk-0.1.0/docs/zh-CN/api-reference/set-contact-note.md +59 -0
  131. unifyport_sdk-0.1.0/docs/zh-CN/api-reference/set-conversation-label-members.md +59 -0
  132. unifyport_sdk-0.1.0/docs/zh-CN/api-reference/set-group-join-approval-mode.md +59 -0
  133. unifyport_sdk-0.1.0/docs/zh-CN/api-reference/start-account-auth.md +59 -0
  134. unifyport_sdk-0.1.0/docs/zh-CN/api-reference/start-account-qr-auth.md +59 -0
  135. unifyport_sdk-0.1.0/docs/zh-CN/api-reference/start-account-runtime.md +59 -0
  136. unifyport_sdk-0.1.0/docs/zh-CN/api-reference/stop-account-runtime.md +59 -0
  137. unifyport_sdk-0.1.0/docs/zh-CN/api-reference/submit-account-auth-code.md +59 -0
  138. unifyport_sdk-0.1.0/docs/zh-CN/api-reference/submit-account-auth-password.md +59 -0
  139. unifyport_sdk-0.1.0/docs/zh-CN/api-reference/unblock-contact.md +59 -0
  140. unifyport_sdk-0.1.0/docs/zh-CN/api-reference/unmute-conversation.md +59 -0
  141. unifyport_sdk-0.1.0/docs/zh-CN/api-reference/unpin-conversation.md +59 -0
  142. unifyport_sdk-0.1.0/docs/zh-CN/api-reference/update-account.md +59 -0
  143. unifyport_sdk-0.1.0/docs/zh-CN/api-reference/update-api-key-status.md +59 -0
  144. unifyport_sdk-0.1.0/docs/zh-CN/api-reference/update-group-info.md +59 -0
  145. unifyport_sdk-0.1.0/docs/zh-CN/api-reference/update-group-join-requests.md +59 -0
  146. unifyport_sdk-0.1.0/docs/zh-CN/api-reference/update-group-members.md +59 -0
  147. unifyport_sdk-0.1.0/docs/zh-CN/api-reference/update-webhook-endpoint.md +59 -0
  148. unifyport_sdk-0.1.0/docs/zh-CN/api-reference/update-workspace.md +59 -0
  149. unifyport_sdk-0.1.0/docs/zh-CN/api-reference/upsert-conversation-label.md +59 -0
  150. unifyport_sdk-0.1.0/docs/zh-CN/architecture.md +59 -0
  151. unifyport_sdk-0.1.0/docs/zh-CN/contract-maintenance.md +40 -0
  152. unifyport_sdk-0.1.0/docs/zh-CN/release-notes.md +17 -0
  153. unifyport_sdk-0.1.0/docs/zh-CN/security.md +58 -0
  154. unifyport_sdk-0.1.0/parity/manifest.gen.json +2974 -0
  155. unifyport_sdk-0.1.0/parity/source.json +17 -0
  156. unifyport_sdk-0.1.0/policy/operation-policies.json +79 -0
  157. unifyport_sdk-0.1.0/pyproject.toml +114 -0
  158. unifyport_sdk-0.1.0/pyright_tests/provider_profile.py +14 -0
  159. unifyport_sdk-0.1.0/scripts/check_docs.py +179 -0
  160. unifyport_sdk-0.1.0/scripts/check_node_parity.py +187 -0
  161. unifyport_sdk-0.1.0/scripts/check_public.py +279 -0
  162. unifyport_sdk-0.1.0/scripts/generate.py +1293 -0
  163. unifyport_sdk-0.1.0/scripts/smoke_installed.py +69 -0
  164. unifyport_sdk-0.1.0/src/unifyport/__init__.py +74 -0
  165. unifyport_sdk-0.1.0/src/unifyport/_generated/__init__.py +23 -0
  166. unifyport_sdk-0.1.0/src/unifyport/_generated/async_methods.py +1664 -0
  167. unifyport_sdk-0.1.0/src/unifyport/_generated/models.py +1848 -0
  168. unifyport_sdk-0.1.0/src/unifyport/_generated/operations.py +2609 -0
  169. unifyport_sdk-0.1.0/src/unifyport/_generated/sync_methods.py +1664 -0
  170. unifyport_sdk-0.1.0/src/unifyport/_runtime/__init__.py +6 -0
  171. unifyport_sdk-0.1.0/src/unifyport/_runtime/async_runtime.py +304 -0
  172. unifyport_sdk-0.1.0/src/unifyport/_runtime/common.py +906 -0
  173. unifyport_sdk-0.1.0/src/unifyport/_runtime/sync_runtime.py +291 -0
  174. unifyport_sdk-0.1.0/src/unifyport/async_client.py +112 -0
  175. unifyport_sdk-0.1.0/src/unifyport/client.py +115 -0
  176. unifyport_sdk-0.1.0/src/unifyport/config.py +103 -0
  177. unifyport_sdk-0.1.0/src/unifyport/errors.py +115 -0
  178. unifyport_sdk-0.1.0/src/unifyport/models.py +5 -0
  179. unifyport_sdk-0.1.0/src/unifyport/pagination.py +162 -0
  180. unifyport_sdk-0.1.0/src/unifyport/py.typed +1 -0
  181. unifyport_sdk-0.1.0/src/unifyport/result.py +20 -0
  182. unifyport_sdk-0.1.0/tests/test_contract.py +171 -0
  183. unifyport_sdk-0.1.0/tests/test_generation.py +201 -0
  184. unifyport_sdk-0.1.0/tests/test_pagination.py +80 -0
  185. unifyport_sdk-0.1.0/tests/test_runtime.py +772 -0
  186. unifyport_sdk-0.1.0/typing_tests/public_api.py +28 -0
@@ -0,0 +1,12 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: pip
4
+ directory: /
5
+ schedule:
6
+ interval: weekly
7
+ open-pull-requests-limit: 5
8
+ - package-ecosystem: github-actions
9
+ directory: /
10
+ schedule:
11
+ interval: weekly
12
+ open-pull-requests-limit: 5
@@ -0,0 +1,122 @@
1
+ name: CI
2
+
3
+ on:
4
+ pull_request:
5
+ push:
6
+ branches: [main]
7
+
8
+ permissions:
9
+ contents: read
10
+
11
+ concurrency:
12
+ group: ci-${{ github.workflow }}-${{ github.ref }}
13
+ cancel-in-progress: true
14
+
15
+ jobs:
16
+ quality:
17
+ runs-on: ubuntu-latest
18
+ steps:
19
+ - uses: actions/checkout@v4
20
+ - uses: actions/setup-python@v5
21
+ with:
22
+ python-version: "3.11"
23
+ cache: pip
24
+ - uses: actions/setup-node@v4
25
+ with:
26
+ node-version: "24"
27
+ - name: Upgrade packaging installer
28
+ # pip-audit 会审计当前环境,先更新 runner 自带打包工具,避免已修复漏洞污染 SDK 审计结论。
29
+ run: python -m pip install --upgrade pip "setuptools>=83"
30
+ - name: Install project
31
+ run: python -m pip install -e ".[dev]"
32
+ - name: Check generated files
33
+ run: python scripts/generate.py --check
34
+ - name: Check documentation
35
+ run: python scripts/check_docs.py
36
+ - name: Check public repository boundary
37
+ run: python scripts/check_public.py
38
+ - name: Check format
39
+ run: ruff format --check .
40
+ - name: Lint
41
+ run: ruff check .
42
+ - name: Type check
43
+ run: mypy --strict src scripts typing_tests
44
+ - name: Check PEP 728 public typing
45
+ # mypy 2.3 尚未实现 extra_items;Pyright gate 验证 open ProviderProfile 的标准语义。
46
+ run: npx --yes pyright@1.1.411 pyright_tests
47
+ - name: Test
48
+ run: pytest
49
+ - name: Audit dependencies
50
+ run: pip-audit
51
+
52
+ compatibility:
53
+ runs-on: ubuntu-latest
54
+ strategy:
55
+ fail-fast: false
56
+ matrix:
57
+ python-version: ["3.11", "3.12", "3.13"]
58
+ steps:
59
+ - uses: actions/checkout@v4
60
+ - uses: actions/setup-python@v5
61
+ with:
62
+ python-version: ${{ matrix.python-version }}
63
+ cache: pip
64
+ - name: Install project
65
+ run: python -m pip install -e ".[dev]"
66
+ - name: Run tests
67
+ run: pytest
68
+
69
+ node-parity:
70
+ runs-on: ubuntu-latest
71
+ steps:
72
+ - uses: actions/checkout@v4
73
+ with:
74
+ path: python-sdk
75
+ - uses: actions/checkout@v4
76
+ with:
77
+ repository: Unify-Port/UnifyPort-SDK-Nodejs
78
+ ref: v0.4.0
79
+ fetch-depth: 0
80
+ path: node-sdk
81
+ - uses: actions/setup-python@v5
82
+ with:
83
+ python-version: "3.11"
84
+ cache: pip
85
+ cache-dependency-path: python-sdk/pyproject.toml
86
+ - name: Install parity dependencies
87
+ working-directory: python-sdk
88
+ run: python -m pip install -e ".[dev]"
89
+ - name: Verify frozen Node baseline
90
+ working-directory: python-sdk
91
+ # 独立 checkout 防止本仓库相对路径或本机状态掩盖 upstream drift。
92
+ run: python scripts/check_node_parity.py --node-repo ../node-sdk --node-ref v0.4.0
93
+
94
+ package:
95
+ needs: [quality, compatibility, node-parity]
96
+ runs-on: ubuntu-latest
97
+ steps:
98
+ - uses: actions/checkout@v4
99
+ - uses: actions/setup-python@v5
100
+ with:
101
+ python-version: "3.11"
102
+ cache: pip
103
+ - name: Install build tools
104
+ run: python -m pip install -e ".[dev]"
105
+ - name: Build distributions
106
+ run: python -m build
107
+ - name: Check distributions
108
+ run: twine check dist/*
109
+ - name: Inspect public artifacts
110
+ run: python scripts/check_public.py dist/*
111
+ - name: Create clean wheel environment
112
+ # 独立 venv 避免 editable source checkout 掩盖 wheel 的缺失文件或 metadata 问题。
113
+ run: python -m venv /tmp/unifyport-sdk-wheel-venv
114
+ - name: Install built wheel
115
+ run: /tmp/unifyport-sdk-wheel-venv/bin/python -m pip install dist/*.whl
116
+ - name: Smoke test installed wheel
117
+ run: /tmp/unifyport-sdk-wheel-venv/bin/python scripts/smoke_installed.py
118
+ - uses: actions/upload-artifact@v4
119
+ with:
120
+ name: unifyport-sdk-dist
121
+ path: dist/*
122
+ if-no-files-found: error
@@ -0,0 +1,148 @@
1
+ name: Release
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - "v*"
7
+
8
+ # 同一版本不能覆盖上传,禁止自动取消已进入 registry publish 的 release run。
9
+ concurrency:
10
+ group: release-${{ github.ref }}
11
+ cancel-in-progress: false
12
+
13
+ permissions:
14
+ contents: read
15
+
16
+ jobs:
17
+ build:
18
+ name: Validate and build distributions
19
+ runs-on: ubuntu-latest
20
+ outputs:
21
+ version: ${{ steps.package-version.outputs.value }}
22
+ steps:
23
+ # release job 具有供应链影响,固定第三方 action SHA,避免浮动 tag 在无审查时改变行为。
24
+ - uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
25
+ with:
26
+ persist-credentials: false
27
+ - uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
28
+ with:
29
+ python-version: "3.11"
30
+ cache: pip
31
+ - name: Check public repository boundary
32
+ # Node parity 基准包含其自身的发布配置,先扫描本仓库,避免只读上游 checkout 污染公开边界结论。
33
+ run: python scripts/check_public.py
34
+ - uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
35
+ with:
36
+ repository: Unify-Port/UnifyPort-SDK-Nodejs
37
+ ref: v0.4.0
38
+ fetch-depth: 0
39
+ path: node-sdk
40
+ persist-credentials: false
41
+ - uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6.5.0
42
+ with:
43
+ node-version: "24"
44
+ package-manager-cache: false
45
+ - name: Upgrade audited packaging tools
46
+ # pip-audit 会检查 runner 环境,先升级已知修复版本,避免基础镜像工具链污染 SDK 结论。
47
+ run: python -m pip install --upgrade pip "setuptools>=83"
48
+ - name: Install project
49
+ run: python -m pip install -e ".[dev]"
50
+ - name: Read package version
51
+ id: package-version
52
+ run: echo "value=$(python -c 'import unifyport; print(unifyport.__version__)')" >> "$GITHUB_OUTPUT"
53
+ - name: Match tag to package version
54
+ # tag 与 wheel metadata 不一致会留下无法修正的 registry 版本,因此在 build 前立即失败。
55
+ env:
56
+ PACKAGE_VERSION: ${{ steps.package-version.outputs.value }}
57
+ run: test "$GITHUB_REF_NAME" = "v$PACKAGE_VERSION"
58
+ - name: Check generated files
59
+ run: python scripts/generate.py --check
60
+ - name: Check Node contract parity
61
+ run: python scripts/check_node_parity.py --node-repo node-sdk --node-ref v0.4.0
62
+ - name: Check documentation
63
+ run: python scripts/check_docs.py
64
+ - name: Check format
65
+ run: ruff format --check .
66
+ - name: Lint
67
+ run: ruff check .
68
+ - name: Type check
69
+ run: mypy --strict src scripts typing_tests
70
+ - name: Check PEP 728 public typing
71
+ run: npx --yes pyright@1.1.411 pyright_tests
72
+ - name: Test
73
+ run: pytest
74
+ - name: Audit dependencies
75
+ run: pip-audit
76
+ - name: Build distributions
77
+ run: python -m build
78
+ - name: Check distributions
79
+ run: twine check dist/*
80
+ - name: Inspect public artifacts
81
+ run: python scripts/check_public.py dist/*
82
+ - name: Install wheel in a clean environment
83
+ run: |
84
+ python -m venv /tmp/unifyport-release-wheel-venv
85
+ /tmp/unifyport-release-wheel-venv/bin/python -m pip install dist/*.whl
86
+ /tmp/unifyport-release-wheel-venv/bin/python scripts/smoke_installed.py
87
+ - name: Print distribution checksums
88
+ run: sha256sum dist/*
89
+ - name: Store distributions
90
+ uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
91
+ with:
92
+ name: unifyport-sdk-dist-${{ github.ref_name }}
93
+ path: dist/*
94
+ if-no-files-found: error
95
+ retention-days: 90
96
+
97
+ publish-pypi:
98
+ name: Publish to PyPI
99
+ # 用户确认首发跳过 TestPyPI;仍由 build 全门禁与 pypi environment 审批保护正式发布。
100
+ needs: build
101
+ runs-on: ubuntu-latest
102
+ environment:
103
+ name: pypi
104
+ url: https://pypi.org/p/unifyport-sdk
105
+ permissions:
106
+ id-token: write
107
+ steps:
108
+ # production publish 只接收同一 run 的 build 验收 artifact,并由 pypi environment 提供人工审批门禁。
109
+ - name: Download distributions
110
+ uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0
111
+ with:
112
+ name: unifyport-sdk-dist-${{ github.ref_name }}
113
+ path: dist/
114
+ - name: Publish distributions to PyPI
115
+ uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # v1.14.2
116
+ with:
117
+ print-hash: true
118
+
119
+ verify-pypi:
120
+ name: Verify PyPI installation
121
+ needs: [build, publish-pypi]
122
+ runs-on: ubuntu-latest
123
+ permissions:
124
+ contents: read
125
+ steps:
126
+ - uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
127
+ with:
128
+ persist-credentials: false
129
+ - uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
130
+ with:
131
+ python-version: "3.11"
132
+ - name: Install exact PyPI version
133
+ env:
134
+ PACKAGE_VERSION: ${{ needs.build.outputs.version }}
135
+ run: |
136
+ python -m venv /tmp/unifyport-pypi-venv
137
+ for attempt in {1..12}; do
138
+ if /tmp/unifyport-pypi-venv/bin/python -m pip install \
139
+ --index-url https://pypi.org/simple/ "unifyport-sdk==$PACKAGE_VERSION"; then
140
+ break
141
+ fi
142
+ if [ "$attempt" -eq 12 ]; then
143
+ exit 1
144
+ fi
145
+ sleep 10
146
+ done
147
+ - name: Smoke test PyPI installation
148
+ run: /tmp/unifyport-pypi-venv/bin/python scripts/smoke_installed.py
@@ -0,0 +1,16 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ *.egg-info/
4
+ .coverage
5
+ .mypy_cache/
6
+ .pytest_cache/
7
+ .ruff_cache/
8
+ .venv/
9
+ build/
10
+ dist/
11
+ htmlcov/
12
+
13
+ # 本地环境文件可能包含 credential,始终排除在版本控制之外。
14
+ .env
15
+ .env.*
16
+ !.env.example
@@ -0,0 +1,51 @@
1
+ # AGENTS.md
2
+
3
+ 本文件适用于整个仓库,约束自动化 agent 与维护者的协作方式。
4
+
5
+ ## 语言与注释
6
+
7
+ - 默认使用简体中文协作;代码标识符、命令、配置键、协议字段和错误码保持英文。
8
+ - 英文是公开文档的默认入口;修改用户文档时同步更新完整的简体中文版本。
9
+ - 代码注释只用简短中文解释 why:边界、兼容性、外部限制或风险,不逐行翻译实现。
10
+
11
+ ## 范围与来源
12
+
13
+ - 本仓库只覆盖公开的 UnifyPort Device API。
14
+ - `contracts/device.openapi.yaml` 是唯一协议生成输入;不得根据未公开实现推断字段或行为。
15
+ - `policy/operation-policies.json` 记录不能从 HTTP method 推导的重试、破坏性和 secret 分类。
16
+ - 不要手改 `src/unifyport/_generated/`;修改 contract、policy 或生成器后运行生成命令。
17
+ - 不提供 generic `raw_request`、MCP、Agent Skills 或 provider-specific orchestration。
18
+
19
+ ## 安全不变量
20
+
21
+ - `X-Api-Key` 只能来自 client config,operation input 不得覆盖它。
22
+ - 默认只允许 HTTPS;显式 opt-in 的明文 HTTP 也仅限 loopback。
23
+ - 自动重试只适用于 policy allowlist;单次调用只能收紧全局 timeout 和 retry budget。
24
+ - redirect、跨 origin、base path 逃逸、无限分页和无上限响应体必须拒绝。
25
+ - 公开错误和 `ApiResult` 不得携带 raw HTTP response、credential、query、响应正文或底层异常文本。
26
+ - `provider_profile` 与 `reply_token` 按敏感输出处理;fixture、日志和文档不得包含真实 secret。
27
+
28
+ ## 修改流程
29
+
30
+ 1. 先检查 worktree、真实文件和既有测试,保留用户及其他 agent 的改动。
31
+ 2. API 变化按 contract → policy → generated code → runtime/tests/docs 的顺序处理。
32
+ 3. 新 operation 必须显式分类 auth、mutability、retry、secret input/output 与 parity。
33
+ 4. 保持最小改动,不做无关重构或依赖升级。
34
+ 5. 交付前运行并如实报告生成、格式、lint、type、test、build、artifact、audit 和 clean-install 门禁。
35
+
36
+ ## 常用验收
37
+
38
+ ```bash
39
+ python scripts/generate.py --check
40
+ python scripts/check_node_parity.py --node-repo ../unifyport-sdk-node --node-ref v0.4.0
41
+ ruff format --check .
42
+ ruff check .
43
+ mypy --strict src scripts typing_tests
44
+ npx --yes pyright@1.1.411 pyright_tests
45
+ pytest
46
+ python -m build
47
+ twine check dist/*
48
+ python scripts/check_public.py dist/*
49
+ python scripts/smoke_installed.py
50
+ pip-audit
51
+ ```
@@ -0,0 +1,15 @@
1
+ # Changelog
2
+
3
+ All notable SDK changes are documented here. The format follows Keep a Changelog, and the project uses
4
+ Semantic Versioning for the Python distribution.
5
+
6
+ ## [0.1.0] - 2026-07-31
7
+
8
+ ### Added
9
+
10
+ - Initial synchronous and asynchronous Device API clients.
11
+ - Generated coverage for the Node SDK `v0.4.0` public surface: 64 operations and 70 schemas.
12
+ - Security-oriented transport, error, retry, timeout, response-size, and pagination behavior.
13
+ - Deterministic generation, parity, packaging, public artifact, and bilingual documentation gates.
14
+
15
+ [0.1.0]: https://github.com/Unify-Port/UnifyPort-SDK-Python/releases/tag/v0.1.0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 UnifyPort
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,193 @@
1
+ Metadata-Version: 2.4
2
+ Name: unifyport-sdk
3
+ Version: 0.1.0
4
+ Summary: Type-safe Python SDK for the UnifyPort Device API.
5
+ Project-URL: Homepage, https://www.unifyport.ai
6
+ Project-URL: Repository, https://github.com/Unify-Port/UnifyPort-SDK-Python
7
+ Project-URL: Issues, https://github.com/Unify-Port/UnifyPort-SDK-Python/issues
8
+ Author: UnifyPort
9
+ License: MIT License
10
+
11
+ Copyright (c) 2026 UnifyPort
12
+
13
+ Permission is hereby granted, free of charge, to any person obtaining a copy
14
+ of this software and associated documentation files (the "Software"), to deal
15
+ in the Software without restriction, including without limitation the rights
16
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
17
+ copies of the Software, and to permit persons to whom the Software is
18
+ furnished to do so, subject to the following conditions:
19
+
20
+ The above copyright notice and this permission notice shall be included in all
21
+ copies or substantial portions of the Software.
22
+
23
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
26
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
28
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
29
+ SOFTWARE.
30
+ License-File: LICENSE
31
+ Keywords: device-api,python,sdk,unifyport
32
+ Classifier: Development Status :: 4 - Beta
33
+ Classifier: Intended Audience :: Developers
34
+ Classifier: License :: OSI Approved :: MIT License
35
+ Classifier: Programming Language :: Python :: 3
36
+ Classifier: Programming Language :: Python :: 3.11
37
+ Classifier: Programming Language :: Python :: 3.12
38
+ Classifier: Programming Language :: Python :: 3.13
39
+ Classifier: Typing :: Typed
40
+ Requires-Python: >=3.11
41
+ Requires-Dist: httpx<1,>=0.27
42
+ Requires-Dist: typing-extensions<5,>=4.13
43
+ Provides-Extra: dev
44
+ Requires-Dist: build<2,>=1.2; extra == 'dev'
45
+ Requires-Dist: mypy<3,>=1.13; extra == 'dev'
46
+ Requires-Dist: pip-audit<3,>=2.7; extra == 'dev'
47
+ Requires-Dist: pytest-asyncio<2,>=0.24; extra == 'dev'
48
+ Requires-Dist: pytest-cov<8,>=6; extra == 'dev'
49
+ Requires-Dist: pytest<10,>=8.3; extra == 'dev'
50
+ Requires-Dist: pyyaml<7,>=6; extra == 'dev'
51
+ Requires-Dist: ruff<1,>=0.9; extra == 'dev'
52
+ Requires-Dist: twine<8,>=6; extra == 'dev'
53
+ Description-Content-Type: text/markdown
54
+
55
+ # UnifyPort Python SDK
56
+
57
+ [English](https://github.com/Unify-Port/UnifyPort-SDK-Python/blob/main/README.md) |
58
+ [简体中文](https://github.com/Unify-Port/UnifyPort-SDK-Python/blob/main/README.zh-CN.md) |
59
+ [Website](https://www.unifyport.ai)
60
+
61
+ Type-safe sync and async Python clients for the public UnifyPort Device API. The SDK is generated from
62
+ the approved public OpenAPI contract and currently tracks `@unifyport/sdk-node` `v0.4.0`: 64 operations,
63
+ 70 component schemas, and the same retry and secret-handling classifications.
64
+
65
+ The Python package is `unifyport-sdk`; the import package is `unifyport`. This repository starts at SDK
66
+ version `0.1.0`. A Git tag or local build alone does not prove that a version reached PyPI.
67
+
68
+ ## Requirements
69
+
70
+ - Python `>=3.11`
71
+ - `httpx` `>=0.27,<1`
72
+ - `typing-extensions` `>=4.13,<5` for the Python 3.11-3.13 PEP 728 backport
73
+
74
+ Install the published package from PyPI:
75
+
76
+ ```bash
77
+ python -m pip install unifyport-sdk
78
+ ```
79
+
80
+ To work from a source checkout:
81
+
82
+ ```bash
83
+ python -m pip install -e ".[dev]"
84
+ ```
85
+
86
+ ## Quick start
87
+
88
+ ```python
89
+ import os
90
+
91
+ from unifyport import UnifyPortDeviceClient
92
+
93
+
94
+ def required_env(name: str) -> str:
95
+ value = os.environ.get(name)
96
+ if not value:
97
+ raise RuntimeError(f"Missing required environment variable: {name}")
98
+ return value
99
+
100
+
101
+ with UnifyPortDeviceClient(
102
+ base_url=required_env("UNIFYPORT_DEVICE_API_BASE_URL"),
103
+ api_key=required_env("UNIFYPORT_DEVICE_API_KEY"),
104
+ ) as device:
105
+ workspace = device.get_workspace()
106
+ print(workspace.data)
107
+ ```
108
+
109
+ The async client exposes the same generated snake_case operation surface:
110
+
111
+ ```python
112
+ import os
113
+
114
+ from unifyport import AsyncUnifyPortDeviceClient
115
+
116
+
117
+ async def main() -> None:
118
+ async with AsyncUnifyPortDeviceClient(
119
+ base_url=os.environ["UNIFYPORT_DEVICE_API_BASE_URL"],
120
+ api_key=os.environ["UNIFYPORT_DEVICE_API_KEY"],
121
+ ) as device:
122
+ workspace = await device.get_workspace()
123
+ print(workspace.data)
124
+ ```
125
+
126
+ Generated operation methods expose path, query, and the allowlisted `x_request_id` header as typed keyword
127
+ arguments, plus typed `body=` and `options=` when applicable. Authentication is never an operation argument:
128
+
129
+ ```python
130
+ account = device.get_account(account_id="acc_example", x_request_id="req_example")
131
+ ```
132
+
133
+ Every call returns `ApiResult[data]` with only filtered metadata: `data`, `status`, and optional
134
+ `request_id`. Raw `httpx.Response` objects are intentionally not public.
135
+
136
+ ## Safety boundaries
137
+
138
+ - `X-Api-Key` comes only from client configuration and is resolved once per logical operation.
139
+ - HTTPS is required by default. Explicitly enabled plaintext HTTP remains limited to loopback hosts.
140
+ - Redirects are not followed, and credential-bearing requests cannot escape the configured origin or
141
+ base path.
142
+ - Automatic retry is restricted to the 19 reviewed operations and the statuses `408`, `429`, `502`,
143
+ `503`, and `504`, plus transport failures. Per-call settings can only tighten the global budget.
144
+ - Requests require identity encoding; compressed responses are rejected before raw bodies are streamed
145
+ through the byte limit and parsed as JSON.
146
+ - Public errors retain stable status, error code, operation ID, and request ID only; raw response text,
147
+ query strings, credentials, and underlying exception text are not exposed.
148
+ - Cursor helpers enforce a finite page limit and reject missing or repeated cursors.
149
+ - `provider_profile` and `reply_token` are sensitive outputs. Do not log complete account or message
150
+ responses.
151
+
152
+ The package does not expose MCP tools, Agent Skills, a generic raw-request escape hatch, provider-specific
153
+ orchestration, or an inferred webhook-signature algorithm.
154
+
155
+ ## Contract and generated code
156
+
157
+ `contracts/device.openapi.yaml` is the only protocol source for generation. The language-neutral policy
158
+ file records semantics that cannot be inferred safely from HTTP methods. Do not edit
159
+ `src/unifyport/_generated/` or generated API reference pages directly.
160
+
161
+ ```bash
162
+ python scripts/generate.py
163
+ python scripts/generate.py --check
164
+ python scripts/check_node_parity.py --node-repo ../unifyport-sdk-node --node-ref v0.4.0
165
+ ```
166
+
167
+ See the [API coverage report](https://github.com/Unify-Port/UnifyPort-SDK-Python/blob/main/docs/api-coverage.md),
168
+ [architecture](https://github.com/Unify-Port/UnifyPort-SDK-Python/blob/main/docs/architecture.md),
169
+ [security boundaries](https://github.com/Unify-Port/UnifyPort-SDK-Python/blob/main/docs/security.md),
170
+ [contract maintenance guide](https://github.com/Unify-Port/UnifyPort-SDK-Python/blob/main/docs/contract-maintenance.md),
171
+ [acceptance report](https://github.com/Unify-Port/UnifyPort-SDK-Python/blob/main/docs/acceptance-report.md),
172
+ and [release notes](https://github.com/Unify-Port/UnifyPort-SDK-Python/blob/main/docs/release-notes.md).
173
+
174
+ ## Validation
175
+
176
+ ```bash
177
+ ruff format --check .
178
+ ruff check .
179
+ mypy --strict src scripts typing_tests
180
+ npx --yes pyright@1.1.411 pyright_tests
181
+ pytest
182
+ python -m build
183
+ twine check dist/*
184
+ python scripts/check_public.py dist/*
185
+ python scripts/smoke_installed.py
186
+ pip-audit
187
+ ```
188
+
189
+ ## License
190
+
191
+ The SDK source is available under the
192
+ [MIT License](https://github.com/Unify-Port/UnifyPort-SDK-Python/blob/main/LICENSE). The Device API
193
+ contract describes the service interface and retains its own license metadata.