oxy-py-sdk 1.0.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 (52) hide show
  1. oxy_py_sdk-1.0.0/.editorconfig +258 -0
  2. oxy_py_sdk-1.0.0/.github/dependabot.yml +6 -0
  3. oxy_py_sdk-1.0.0/.github/workflows/release.yml +32 -0
  4. oxy_py_sdk-1.0.0/.gitignore +59 -0
  5. oxy_py_sdk-1.0.0/.python-version +1 -0
  6. oxy_py_sdk-1.0.0/CHANGELOG.md +14 -0
  7. oxy_py_sdk-1.0.0/LICENSE +21 -0
  8. oxy_py_sdk-1.0.0/PKG-INFO +135 -0
  9. oxy_py_sdk-1.0.0/README.md +95 -0
  10. oxy_py_sdk-1.0.0/pyproject.toml +68 -0
  11. oxy_py_sdk-1.0.0/src/oxy/__init__.py +0 -0
  12. oxy_py_sdk-1.0.0/src/oxy/py.typed +0 -0
  13. oxy_py_sdk-1.0.0/src/oxy/utils/__init__.py +0 -0
  14. oxy_py_sdk-1.0.0/src/oxy/utils/codec/__init__.py +0 -0
  15. oxy_py_sdk-1.0.0/src/oxy/utils/codec/crypto.py +285 -0
  16. oxy_py_sdk-1.0.0/src/oxy/utils/codec/crypto_model.py +15 -0
  17. oxy_py_sdk-1.0.0/src/oxy/utils/codec/des.py +66 -0
  18. oxy_py_sdk-1.0.0/src/oxy/utils/codec/md5.py +10 -0
  19. oxy_py_sdk-1.0.0/src/oxy/utils/codec/sha256.py +21 -0
  20. oxy_py_sdk-1.0.0/src/oxy/utils/data/__init__.py +0 -0
  21. oxy_py_sdk-1.0.0/src/oxy/utils/data/_split.py +31 -0
  22. oxy_py_sdk-1.0.0/src/oxy/utils/data/cache/__init__.py +1 -0
  23. oxy_py_sdk-1.0.0/src/oxy/utils/data/cache/_cache.py +30 -0
  24. oxy_py_sdk-1.0.0/src/oxy/utils/http/__init__.py +37 -0
  25. oxy_py_sdk-1.0.0/src/oxy/utils/http/_api.py +307 -0
  26. oxy_py_sdk-1.0.0/src/oxy/utils/http/_model.py +235 -0
  27. oxy_py_sdk-1.0.0/src/oxy/utils/http/api.py +144 -0
  28. oxy_py_sdk-1.0.0/src/oxy/utils/lang/__init__.py +17 -0
  29. oxy_py_sdk-1.0.0/src/oxy/utils/lang/_datetime.py +13 -0
  30. oxy_py_sdk-1.0.0/src/oxy/utils/lang/_exception.py +25 -0
  31. oxy_py_sdk-1.0.0/src/oxy/utils/lang/_split.py +75 -0
  32. oxy_py_sdk-1.0.0/src/oxy/utils/lang/_uuid.py +5 -0
  33. oxy_py_sdk-1.0.0/src/oxy/utils/lang/asserts.py +19 -0
  34. oxy_py_sdk-1.0.0/src/oxy/utils/lang/charset.py +28 -0
  35. oxy_py_sdk-1.0.0/src/oxy/utils/lang/collection/__init__.py +7 -0
  36. oxy_py_sdk-1.0.0/src/oxy/utils/lang/collection/_collection.py +36 -0
  37. oxy_py_sdk-1.0.0/src/oxy/utils/lang/logger/__init__.py +6 -0
  38. oxy_py_sdk-1.0.0/src/oxy/utils/lang/logger/_logger.py +68 -0
  39. oxy_py_sdk-1.0.0/src/oxy/utils/lang/path.py +33 -0
  40. oxy_py_sdk-1.0.0/src/oxy/utils/setting/__init__.py +23 -0
  41. oxy_py_sdk-1.0.0/src/oxy/utils/setting/_setting.py +213 -0
  42. oxy_py_sdk-1.0.0/tests/__init__.py +1 -0
  43. oxy_py_sdk-1.0.0/tests/config.py +16 -0
  44. oxy_py_sdk-1.0.0/tests/oxy/test_codec.py +40 -0
  45. oxy_py_sdk-1.0.0/tests/oxy/test_collection.py +27 -0
  46. oxy_py_sdk-1.0.0/tests/oxy/test_http.py +170 -0
  47. oxy_py_sdk-1.0.0/tests/oxy/test_lang.py +73 -0
  48. oxy_py_sdk-1.0.0/tests/oxy/test_optional_dependencies.py +16 -0
  49. oxy_py_sdk-1.0.0/tests/oxy/test_response_processors.py +8 -0
  50. oxy_py_sdk-1.0.0/tests/oxy/test_setting.py +31 -0
  51. oxy_py_sdk-1.0.0/tests/resources//344/270/211/345/271/264/347/272/247/345/210/206/346/225/260/346/216/222/345/220/215.xlsx +0 -0
  52. oxy_py_sdk-1.0.0/uv.lock +569 -0
@@ -0,0 +1,258 @@
1
+ # https://editorconfig.org
2
+ root = true
3
+
4
+ # -----------------------------------------------------------------------------
5
+ # Defaults
6
+ # -----------------------------------------------------------------------------
7
+ [*]
8
+ charset = utf-8
9
+ end_of_line = lf
10
+ insert_final_newline = true
11
+ trim_trailing_whitespace = true
12
+ indent_style = space
13
+ indent_size = 4
14
+ max_line_length = 120
15
+
16
+ # -----------------------------------------------------------------------------
17
+ # Python
18
+ # -----------------------------------------------------------------------------
19
+ [*.py]
20
+ indent_size = 4
21
+ max_line_length = 120
22
+
23
+ [*.pyi]
24
+ indent_size = 4
25
+ max_line_length = 120
26
+
27
+ [*.pyw]
28
+ indent_size = 4
29
+
30
+ # -----------------------------------------------------------------------------
31
+ # Config / data (usually 2-space)
32
+ # -----------------------------------------------------------------------------
33
+ [*.{yml,yaml}]
34
+ indent_size = 2
35
+
36
+ [*.toml]
37
+ indent_size = 2
38
+
39
+ [*.json]
40
+ indent_size = 2
41
+
42
+ [*.jsonc]
43
+ indent_size = 2
44
+
45
+ [*.json5]
46
+ indent_size = 2
47
+
48
+ [{.eslintrc,.babelrc,.stylelintrc,.prettierrc,.botorcc,jest.config,*.bowerrc,*.jsb3,*.jsb2}]
49
+ indent_size = 2
50
+
51
+ [*.{ini,cfg,conf}]
52
+ indent_size = 4
53
+
54
+ [*.env]
55
+ indent_size = 4
56
+ trim_trailing_whitespace = false
57
+
58
+ [*.env.*]
59
+ indent_size = 4
60
+ trim_trailing_whitespace = false
61
+
62
+ # -----------------------------------------------------------------------------
63
+ # Docs / markup
64
+ # -----------------------------------------------------------------------------
65
+ [*.md]
66
+ indent_size = 2
67
+ # Trailing spaces can mean hard line breaks in Markdown.
68
+ trim_trailing_whitespace = false
69
+ max_line_length = off
70
+
71
+ [*.mdx]
72
+ indent_size = 2
73
+ trim_trailing_whitespace = false
74
+ max_line_length = off
75
+
76
+ [*.rst]
77
+ indent_size = 3
78
+ trim_trailing_whitespace = false
79
+
80
+ [*.adoc]
81
+ indent_size = 2
82
+ trim_trailing_whitespace = false
83
+
84
+ [*.txt]
85
+ indent_size = 4
86
+ trim_trailing_whitespace = true
87
+
88
+ [*.html]
89
+ indent_size = 2
90
+
91
+ [*.htm]
92
+ indent_size = 2
93
+
94
+ [*.css]
95
+ indent_size = 2
96
+
97
+ [*.scss]
98
+ indent_size = 2
99
+
100
+ [*.sass]
101
+ indent_size = 2
102
+ indent_style = space
103
+
104
+ [*.less]
105
+ indent_size = 2
106
+
107
+ [*.svg]
108
+ indent_size = 2
109
+
110
+ # -----------------------------------------------------------------------------
111
+ # JavaScript / TypeScript / frontend
112
+ # -----------------------------------------------------------------------------
113
+ [*.{js,cjs,mjs,jsx}]
114
+ indent_size = 2
115
+ max_line_length = 120
116
+
117
+ [*.{ts,cts,mts,tsx}]
118
+ indent_size = 2
119
+ max_line_length = 120
120
+
121
+ [*.vue]
122
+ indent_size = 2
123
+ max_line_length = 120
124
+
125
+ [*.svelte]
126
+ indent_size = 2
127
+ max_line_length = 120
128
+
129
+ [*.js.map]
130
+ indent_size = 2
131
+
132
+ # -----------------------------------------------------------------------------
133
+ # Shell / Docker / Make / CI
134
+ # -----------------------------------------------------------------------------
135
+ [*.{sh,bash,zsh,ksh}]
136
+ indent_size = 2
137
+
138
+ [Dockerfile]
139
+ indent_size = 4
140
+
141
+ [Dockerfile*]
142
+ indent_size = 4
143
+
144
+ [docker-compose*.{yml,yaml}]
145
+ indent_size = 2
146
+
147
+ [Makefile]
148
+ indent_style = tab
149
+ indent_size = 4
150
+
151
+ [GNUmakefile]
152
+ indent_style = tab
153
+ indent_size = 4
154
+
155
+ [*.mk]
156
+ indent_style = tab
157
+ indent_size = 4
158
+
159
+ [{.github/workflows/*.yml,.github/workflows/*.yaml}]
160
+ indent_size = 2
161
+
162
+ # -----------------------------------------------------------------------------
163
+ # Windows scripts (keep CRLF)
164
+ # -----------------------------------------------------------------------------
165
+ [*.{bat,cmd,ps1}]
166
+ end_of_line = crlf
167
+
168
+ [*.bat]
169
+ indent_style = space
170
+ indent_size = 4
171
+
172
+ [*.cmd]
173
+ indent_style = space
174
+ indent_size = 4
175
+
176
+ [*.ps1]
177
+ indent_style = space
178
+ indent_size = 4
179
+
180
+ # -----------------------------------------------------------------------------
181
+ # SQL / database
182
+ # -----------------------------------------------------------------------------
183
+ [*.{sql,ddl}]
184
+ indent_size = 2
185
+
186
+ # -----------------------------------------------------------------------------
187
+ # Java / Kotlin / Groovy / XML family
188
+ # -----------------------------------------------------------------------------
189
+ [*.{java,kt,kts,groovy,gradle}]
190
+ indent_size = 4
191
+ continuation_indent_size = 8
192
+ max_line_length = 120
193
+
194
+ [*.{xml,xsd,xsl,xslt,wsdl,wsdd,wadl,tld,jnlp,fxml,pom,ant,xul,rng,xjb,jrxml,plan,jhm}]
195
+ indent_size = 2
196
+
197
+ [*.{mod,ent,dtd,elt}]
198
+ indent_size = 2
199
+
200
+ # -----------------------------------------------------------------------------
201
+ # Go / Rust / C-family (common defaults)
202
+ # -----------------------------------------------------------------------------
203
+ [*.go]
204
+ indent_style = tab
205
+ indent_size = 4
206
+
207
+ [*.rs]
208
+ indent_size = 4
209
+ max_line_length = 100
210
+
211
+ [*.{c,h,cpp,hpp,cc,hh,cxx,hxx}]
212
+ indent_size = 4
213
+
214
+ [*.{m,mm}]
215
+ indent_size = 4
216
+
217
+ # -----------------------------------------------------------------------------
218
+ # Misc project files
219
+ # -----------------------------------------------------------------------------
220
+ [*.gradle.kts]
221
+ indent_size = 4
222
+
223
+ [*.properties]
224
+ indent_size = 4
225
+
226
+ [*.graphql]
227
+ indent_size = 2
228
+
229
+ [*.proto]
230
+ indent_size = 2
231
+
232
+ [*.tf]
233
+ indent_size = 2
234
+
235
+ [*.hcl]
236
+ indent_size = 2
237
+
238
+ [*.nix]
239
+ indent_size = 2
240
+
241
+ [*.lock]
242
+ indent_size = 2
243
+ insert_final_newline = true
244
+
245
+ [*.diff]
246
+ trim_trailing_whitespace = false
247
+
248
+ [*.patch]
249
+ trim_trailing_whitespace = false
250
+
251
+ # Binary / generated: avoid editors "fixing" them
252
+ [*.{png,jpg,jpeg,gif,ico,webp,pdf,xlsx,xls,whl,gz,zip,pyc,class,jar,so,dylib,dll,exe}]
253
+ charset = unset
254
+ end_of_line = unset
255
+ insert_final_newline = unset
256
+ trim_trailing_whitespace = unset
257
+ indent_style = unset
258
+ indent_size = unset
@@ -0,0 +1,6 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: github-actions
4
+ directory: /
5
+ schedule:
6
+ interval: monthly
@@ -0,0 +1,32 @@
1
+ name: Publish package
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+
7
+ permissions:
8
+ contents: read
9
+ id-token: write
10
+
11
+ jobs:
12
+ publish:
13
+ runs-on: ubuntu-latest
14
+ environment:
15
+ name: pypi
16
+ url: https://pypi.org/project/oxy-py-sdk/
17
+ steps:
18
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
19
+ with:
20
+ persist-credentials: false
21
+ - uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
22
+ with:
23
+ version: '0.12.7'
24
+ python-version: '3.15'
25
+ - name: Build
26
+ env:
27
+ RELEASE_TAG: ${{ github.event.release.tag_name }}
28
+ run: |
29
+ test "$RELEASE_TAG" = "v$(uv version --short)"
30
+ uv build
31
+ - name: Publish to PyPI
32
+ run: uv publish --trusted-publishing always
@@ -0,0 +1,59 @@
1
+ ### Project ###
2
+ logs/
3
+ settings.yaml
4
+
5
+ ### Python ###
6
+ .venv/
7
+ .ruff_cache/
8
+ .pytest_cache/
9
+ __pycache__/
10
+ dist/
11
+
12
+ ### Apache Maven ###
13
+ target/
14
+ !tests/oxy/main/**/target/
15
+ !tests/oxy/test/**/target/
16
+ !.mvn/wrapper/maven-wrapper.jar
17
+
18
+ ### Gradle ###
19
+ .gradle/
20
+
21
+ ### Eclipse ###
22
+ .settings/
23
+ .project
24
+ .classpath
25
+
26
+ ### IntelliJ IDEA ###
27
+ .idea/
28
+ *.iml
29
+ *.ipr
30
+ *.iws
31
+ .idea
32
+ out
33
+ test-output
34
+ atlassian-ide-plugin.xml
35
+
36
+ ### VS Code ###
37
+ .vscode/
38
+
39
+ ### NetBeans ###
40
+ /nbproject/private/
41
+ /nbbuild/
42
+ /dist/
43
+ /nbdist/
44
+ /.nb-gradle/
45
+ build/
46
+ !tests/oxy/main/**/build/
47
+ !tests/oxy/test/**/build/
48
+
49
+ ### MacOS ###
50
+ .DS_Store
51
+
52
+ ### Others ###
53
+ *.jar
54
+ *.sw?
55
+ *~
56
+ .#*
57
+ .*.md.html
58
+ .flattened-pom.xml
59
+ *.egg-info/
@@ -0,0 +1 @@
1
+ 3.15
@@ -0,0 +1,14 @@
1
+ # Changelog
2
+
3
+ ## 1.0.0 - 2026-11-12
4
+
5
+ - 首个正式版本,发行包名为 `oxy-py-sdk`,Python 导入包名为 `oxy`。
6
+ - 支持 Python 3.15 及以上版本,提供类型标记 `py.typed`。
7
+ - 提供日志、集合、日期时间、UUID、路径及 MD5/SHA256 等基础工具。
8
+ - 提供 `codec` 可选依赖,支持 DES、RSA 加解密及签名。
9
+ - 提供 `data` 可选依赖,支持 DataFrame 拆分及 Excel 文件缓存,包含 pandas、openpyxl。
10
+ - 提供 `http` 可选依赖,支持异步 HTTP 请求、请求装饰器及响应处理。
11
+ - 提供 `setting` 可选依赖,支持 YAML 配置读写;搭配 `codec` 支持配置文件加解密。
12
+ - 支持组合安装可选依赖,或通过 `oxy-py-sdk[all]` 安装全部功能依赖。
13
+ - 使用 GitHub Release 触发构建,通过 Trusted Publishing 发布到 PyPI。
14
+ - 补充安装示例、发布说明、项目元数据及 MIT 许可证声明。
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 wangjz
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,135 @@
1
+ Metadata-Version: 2.5
2
+ Name: oxy-py-sdk
3
+ Version: 1.0.0
4
+ Summary: Python utilities for HTTP, configuration, cryptography, and data processing
5
+ Project-URL: Homepage, https://github.com/oxy-projects/oxy-py-sdk
6
+ Project-URL: Repository, https://github.com/oxy-projects/oxy-py-sdk
7
+ Project-URL: Issues, https://github.com/oxy-projects/oxy-py-sdk/issues
8
+ Project-URL: Changelog, https://github.com/oxy-projects/oxy-py-sdk/blob/main/CHANGELOG.md
9
+ Author-email: wangjz <wangjz_vip@163.com>
10
+ License-Expression: MIT
11
+ License-File: LICENSE
12
+ Keywords: configuration,cryptography,http,utilities
13
+ Classifier: Operating System :: OS Independent
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3 :: Only
16
+ Classifier: Programming Language :: Python :: 3.15
17
+ Classifier: Typing :: Typed
18
+ Requires-Python: >=3.15
19
+ Provides-Extra: all
20
+ Requires-Dist: colorama>=0.4.6; extra == 'all'
21
+ Requires-Dist: cryptography>=49.0.0; extra == 'all'
22
+ Requires-Dist: httpx[http2]>=0.28.1; extra == 'all'
23
+ Requires-Dist: openpyxl>=3.1.5; extra == 'all'
24
+ Requires-Dist: pandas>=3.0.3; extra == 'all'
25
+ Requires-Dist: pycryptodome>=3.23.0; extra == 'all'
26
+ Requires-Dist: pydantic>=2.13.4; extra == 'all'
27
+ Requires-Dist: pyyaml>=6.0.3; extra == 'all'
28
+ Provides-Extra: codec
29
+ Requires-Dist: cryptography>=49.0.0; extra == 'codec'
30
+ Requires-Dist: pycryptodome>=3.23.0; extra == 'codec'
31
+ Provides-Extra: data
32
+ Requires-Dist: openpyxl>=3.1.5; extra == 'data'
33
+ Requires-Dist: pandas>=3.0.3; extra == 'data'
34
+ Provides-Extra: http
35
+ Requires-Dist: httpx[http2]>=0.28.1; extra == 'http'
36
+ Requires-Dist: pydantic>=2.13.4; extra == 'http'
37
+ Provides-Extra: setting
38
+ Requires-Dist: pyyaml>=6.0.3; extra == 'setting'
39
+ Description-Content-Type: text/markdown
40
+
41
+ # oxy-py-sdk
42
+
43
+ Python 通用工具库,提供 HTTP 请求、配置管理、加解密、日志和数据处理工具。
44
+ 发行包名为 `oxy-py-sdk`,Python 导入包名为 `oxy`。支持 Python 3.15 及以上版本。
45
+
46
+ ## 按需安装
47
+
48
+ 基础包包含日志、集合、通用语言工具及 MD5/SHA256,无第三方运行时依赖。
49
+ 未安装 colorama 时日志使用无颜色输出;安装 `[all]` 会同时安装 colorama,启用彩色日志。
50
+ 其他功能按需安装:
51
+
52
+ ```bash
53
+ pip install oxy-py-sdk
54
+ pip install "oxy-py-sdk[codec]" # DES、RSA、签名等加解密
55
+ pip install "oxy-py-sdk[data]" # DataFrame、Excel 读写及缓存
56
+ pip install "oxy-py-sdk[http]" # HTTP 请求
57
+ pip install "oxy-py-sdk[setting]" # YAML 配置读写
58
+ pip install "oxy-py-sdk[http,setting]" # 自由组合
59
+ pip install "oxy-py-sdk[setting,codec]" # 配置文件加解密
60
+ pip install "oxy-py-sdk[all]" # 全部功能依赖,含彩色日志
61
+ ```
62
+
63
+ | 分组 | 依赖 | 模块 |
64
+ | --- | --- | --- |
65
+ | codec | pycryptodome、cryptography | `oxy.utils.codec` |
66
+ | data | pandas、openpyxl | `oxy.utils.data`、`oxy.utils.data.cache` |
67
+ | http | httpx(含 HTTP/2)、pydantic | `oxy.utils.http` |
68
+ | setting | pyyaml | `oxy.utils.setting` |
69
+
70
+ `setting` 的字典读取和转换不需要 YAML 依赖;配置文件加解密需要同时安装 `setting` 和 `codec`。
71
+ MD5/SHA256 使用标准库,无需安装 `codec`。DES 和 MD5 主要用于兼容现有协议。
72
+
73
+ ## 使用示例
74
+
75
+ 基础工具:
76
+
77
+ ```python
78
+ from oxy.utils.lang import gen_uuid_str
79
+ from oxy.utils.lang.collection import distinct
80
+
81
+ print(gen_uuid_str())
82
+ print(distinct([1, 1, 2])) # [1, 2]
83
+ ```
84
+
85
+ 安装 `oxy-py-sdk[http]` 后:
86
+
87
+ ```python
88
+ import asyncio
89
+ from oxy.utils.http import api
90
+
91
+ @api.get("https://httpbin.org/get")
92
+ async def fetch():
93
+ return {"q": "python"}
94
+
95
+ result = asyncio.run(fetch())
96
+ ```
97
+
98
+ 安装 `oxy-py-sdk[setting]` 后:
99
+
100
+ ```python
101
+ from pathlib import Path
102
+ from oxy.utils.setting import dump_yaml, load_yaml
103
+
104
+ dump_yaml({"project": {"name": "demo"}}, Path("settings.yaml"))
105
+ settings = load_yaml(Path("settings.yaml"))
106
+ ```
107
+
108
+ ## 开发与验证
109
+
110
+ ```bash
111
+ uv sync --locked --all-extras
112
+ uv run --locked --all-extras pytest -q
113
+ uv build
114
+ uvx twine check --strict dist/*
115
+ ```
116
+
117
+ 测试不需要真实外部服务,HTTP 请求使用模拟传输。
118
+
119
+ 只安装指定功能:
120
+
121
+ ```bash
122
+ uv sync --locked --extra http --extra setting
123
+ ```
124
+
125
+ 修改依赖后运行 `uv lock` 并提交 `pyproject.toml` 与 `uv.lock`。
126
+
127
+ ## 发布
128
+
129
+ 完整配置及操作步骤见 [发布说明](RELEASING.md),版本记录见 [CHANGELOG](CHANGELOG.md)。
130
+ 发布 GitHub Release 后自动构建并发布到 PyPI。
131
+ 版本来源为 `pyproject.toml`,Release 标签必须是 `v` 加版本号,例如 `v1.0.0`。
132
+
133
+ ## 许可证
134
+
135
+ [MIT](LICENSE),Copyright (c) 2026 wangjz。
@@ -0,0 +1,95 @@
1
+ # oxy-py-sdk
2
+
3
+ Python 通用工具库,提供 HTTP 请求、配置管理、加解密、日志和数据处理工具。
4
+ 发行包名为 `oxy-py-sdk`,Python 导入包名为 `oxy`。支持 Python 3.15 及以上版本。
5
+
6
+ ## 按需安装
7
+
8
+ 基础包包含日志、集合、通用语言工具及 MD5/SHA256,无第三方运行时依赖。
9
+ 未安装 colorama 时日志使用无颜色输出;安装 `[all]` 会同时安装 colorama,启用彩色日志。
10
+ 其他功能按需安装:
11
+
12
+ ```bash
13
+ pip install oxy-py-sdk
14
+ pip install "oxy-py-sdk[codec]" # DES、RSA、签名等加解密
15
+ pip install "oxy-py-sdk[data]" # DataFrame、Excel 读写及缓存
16
+ pip install "oxy-py-sdk[http]" # HTTP 请求
17
+ pip install "oxy-py-sdk[setting]" # YAML 配置读写
18
+ pip install "oxy-py-sdk[http,setting]" # 自由组合
19
+ pip install "oxy-py-sdk[setting,codec]" # 配置文件加解密
20
+ pip install "oxy-py-sdk[all]" # 全部功能依赖,含彩色日志
21
+ ```
22
+
23
+ | 分组 | 依赖 | 模块 |
24
+ | --- | --- | --- |
25
+ | codec | pycryptodome、cryptography | `oxy.utils.codec` |
26
+ | data | pandas、openpyxl | `oxy.utils.data`、`oxy.utils.data.cache` |
27
+ | http | httpx(含 HTTP/2)、pydantic | `oxy.utils.http` |
28
+ | setting | pyyaml | `oxy.utils.setting` |
29
+
30
+ `setting` 的字典读取和转换不需要 YAML 依赖;配置文件加解密需要同时安装 `setting` 和 `codec`。
31
+ MD5/SHA256 使用标准库,无需安装 `codec`。DES 和 MD5 主要用于兼容现有协议。
32
+
33
+ ## 使用示例
34
+
35
+ 基础工具:
36
+
37
+ ```python
38
+ from oxy.utils.lang import gen_uuid_str
39
+ from oxy.utils.lang.collection import distinct
40
+
41
+ print(gen_uuid_str())
42
+ print(distinct([1, 1, 2])) # [1, 2]
43
+ ```
44
+
45
+ 安装 `oxy-py-sdk[http]` 后:
46
+
47
+ ```python
48
+ import asyncio
49
+ from oxy.utils.http import api
50
+
51
+ @api.get("https://httpbin.org/get")
52
+ async def fetch():
53
+ return {"q": "python"}
54
+
55
+ result = asyncio.run(fetch())
56
+ ```
57
+
58
+ 安装 `oxy-py-sdk[setting]` 后:
59
+
60
+ ```python
61
+ from pathlib import Path
62
+ from oxy.utils.setting import dump_yaml, load_yaml
63
+
64
+ dump_yaml({"project": {"name": "demo"}}, Path("settings.yaml"))
65
+ settings = load_yaml(Path("settings.yaml"))
66
+ ```
67
+
68
+ ## 开发与验证
69
+
70
+ ```bash
71
+ uv sync --locked --all-extras
72
+ uv run --locked --all-extras pytest -q
73
+ uv build
74
+ uvx twine check --strict dist/*
75
+ ```
76
+
77
+ 测试不需要真实外部服务,HTTP 请求使用模拟传输。
78
+
79
+ 只安装指定功能:
80
+
81
+ ```bash
82
+ uv sync --locked --extra http --extra setting
83
+ ```
84
+
85
+ 修改依赖后运行 `uv lock` 并提交 `pyproject.toml` 与 `uv.lock`。
86
+
87
+ ## 发布
88
+
89
+ 完整配置及操作步骤见 [发布说明](RELEASING.md),版本记录见 [CHANGELOG](CHANGELOG.md)。
90
+ 发布 GitHub Release 后自动构建并发布到 PyPI。
91
+ 版本来源为 `pyproject.toml`,Release 标签必须是 `v` 加版本号,例如 `v1.0.0`。
92
+
93
+ ## 许可证
94
+
95
+ [MIT](LICENSE),Copyright (c) 2026 wangjz。
@@ -0,0 +1,68 @@
1
+ [build-system]
2
+ requires = ["hatchling>=1.27,<2"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "oxy-py-sdk"
7
+ version = "1.0.0"
8
+ description = "Python utilities for HTTP, configuration, cryptography, and data processing"
9
+ readme = "README.md"
10
+ license = "MIT"
11
+ license-files = ["LICENSE"]
12
+ keywords = ["http", "configuration", "cryptography", "utilities"]
13
+ classifiers = [
14
+ "Programming Language :: Python :: 3",
15
+ "Programming Language :: Python :: 3 :: Only",
16
+ "Programming Language :: Python :: 3.15",
17
+ "Operating System :: OS Independent",
18
+ "Typing :: Typed",
19
+ ]
20
+ requires-python = ">=3.15"
21
+ authors = [
22
+ { name = "wangjz", email = "wangjz_vip@163.com" }
23
+ ]
24
+ # 基础工具仅使用标准库;功能依赖按需安装。
25
+ dependencies = []
26
+
27
+ [project.optional-dependencies]
28
+ codec = [
29
+ # 密码学:DES 等对称算法用 pycryptodome;RSA/签名用 cryptography。
30
+ "pycryptodome>=3.23.0",
31
+ "cryptography>=49.0.0",
32
+ ]
33
+ data = [
34
+ "pandas>=3.0.3",
35
+ "openpyxl>=3.1.5",
36
+ ]
37
+ http = [
38
+ # HTTP请求库。
39
+ "httpx[http2]>=0.28.1",
40
+ # 类型约束,数据校验。
41
+ "pydantic>=2.13.4",
42
+ ]
43
+ setting = [
44
+ # YAML 解析库。
45
+ "pyyaml>=6.0.3",
46
+ ]
47
+ # 全部
48
+ all = [
49
+ # 终端颜色输出库。可以让命令行输出带颜色,比如错误显示红色、成功显示绿色。
50
+ "colorama>=0.4.6",
51
+ "oxy-py-sdk[codec,data,http,setting]",
52
+ ]
53
+
54
+ [project.urls]
55
+ Homepage = "https://github.com/oxy-projects/oxy-py-sdk"
56
+ Repository = "https://github.com/oxy-projects/oxy-py-sdk"
57
+ Issues = "https://github.com/oxy-projects/oxy-py-sdk/issues"
58
+ Changelog = "https://github.com/oxy-projects/oxy-py-sdk/blob/main/CHANGELOG.md"
59
+
60
+ [dependency-groups]
61
+ dev = [
62
+ "pandas-stubs>=3.0.5.260730",
63
+ "pytest>=8.0",
64
+ "respx>=0.21",
65
+ ]
66
+
67
+ [tool.hatch.build.targets.wheel]
68
+ packages = ["src/oxy"]
File without changes
File without changes
File without changes
File without changes