better-commons 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.
- better_commons-0.1.0/.github/workflows/uv-publish.yml +26 -0
- better_commons-0.1.0/.gitignore +16 -0
- better_commons-0.1.0/.python-version +1 -0
- better_commons-0.1.0/AGENTS.md +46 -0
- better_commons-0.1.0/LICENSE +674 -0
- better_commons-0.1.0/Makefile +30 -0
- better_commons-0.1.0/PKG-INFO +132 -0
- better_commons-0.1.0/README.md +117 -0
- better_commons-0.1.0/config/conf-template.xml +34 -0
- better_commons-0.1.0/docs/docs.md +3 -0
- better_commons-0.1.0/lint.sh +5 -0
- better_commons-0.1.0/pyproject.toml +124 -0
- better_commons-0.1.0/scripts/scripts.md +3 -0
- better_commons-0.1.0/src/commons/__init__.py +18 -0
- better_commons-0.1.0/src/commons/conf.py +325 -0
- better_commons-0.1.0/src/commons/demo.py +31 -0
- better_commons-0.1.0/src/commons/file_util.py +8 -0
- better_commons-0.1.0/src/commons/json_codec.py +51 -0
- better_commons-0.1.0/src/commons/llm_cache.py +152 -0
- better_commons-0.1.0/src/commons/llm_client.py +565 -0
- better_commons-0.1.0/src/commons/llm_json_parser.py +173 -0
- better_commons-0.1.0/src/commons/logging_config.py +252 -0
- better_commons-0.1.0/src/commons/py.typed +0 -0
- better_commons-0.1.0/src/commons/strings.py +46 -0
- better_commons-0.1.0/src/commons/timer.py +148 -0
- better_commons-0.1.0/src/commons/wrapper.py +39 -0
- better_commons-0.1.0/uv.lock +176 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
name: Publish Python Package
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- 'v*.*.*' # 当推送形如 v1.0.0 的标签时触发
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
deploy:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
environment: release
|
|
12
|
+
permissions:
|
|
13
|
+
id-token: write # 用于可信发布,至关重要
|
|
14
|
+
contents: read
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@v4
|
|
17
|
+
- name: Set up Python
|
|
18
|
+
uses: actions/setup-python@v5
|
|
19
|
+
with:
|
|
20
|
+
python-version: '3.x'
|
|
21
|
+
- name: Install uv
|
|
22
|
+
uses: astral-sh/setup-uv@v3
|
|
23
|
+
- name: Build package
|
|
24
|
+
run: uv build
|
|
25
|
+
- name: Publish package to PyPI
|
|
26
|
+
run: uv publish
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.13
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Python开发指南
|
|
2
|
+
|
|
3
|
+
## 命令
|
|
4
|
+
- `uv add`:安装依赖项
|
|
5
|
+
- `uv run pytest tests/unit/test_handlers.py::test_create -v`:运行指定的单个测试用例
|
|
6
|
+
- `uv run ruff check --fix .`:使用 Ruff 进行代码检查并自动修复
|
|
7
|
+
|
|
8
|
+
## 规则
|
|
9
|
+
- 所有函数均须添加类型提示(Type Hints)。
|
|
10
|
+
- 保留原有的轻量调试入口(if __name__ == "__main__":里面的代码),不用删除。
|
|
11
|
+
- 功能变化,需要在`RELEASE.md`中的`## [TO BE RELEASED]`记录,没有这个小标题就创建,便于记录新版本发布时的功能变化,只记录与docs,config,src目录有改动的变化。
|
|
12
|
+
|
|
13
|
+
## 代码风格与规范 (Code Style)
|
|
14
|
+
|
|
15
|
+
- 格式化: 遵循Black默认风格 (行长度 80)
|
|
16
|
+
- 命名规范: 遵循 PEP 8
|
|
17
|
+
- 类型注解: 所有公共函数和类必须包含类型注解 (Type Hints)
|
|
18
|
+
- 文档字符串: 使用Google风格的 docstring;
|
|
19
|
+
|
|
20
|
+
## 模块docstring设置
|
|
21
|
+
|
|
22
|
+
每个模块文件的开头要给出docstring,包含以下内容:
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
"""
|
|
26
|
+
=========================================================
|
|
27
|
+
一句话说明模块主要功能
|
|
28
|
+
=========================================================
|
|
29
|
+
|
|
30
|
+
模块基本描述
|
|
31
|
+
|
|
32
|
+
快速上手
|
|
33
|
+
--------
|
|
34
|
+
如有请给出示例,如果是简单的类,则不需要给出该部分内容
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
基础概念
|
|
38
|
+
--------
|
|
39
|
+
如有请给出说明,特别简单的情况下,可以不给出该部分内容
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
修改历史
|
|
43
|
+
--------
|
|
44
|
+
日期(格式:yyyy-MM-dd): 修改说明,每一次修改一行
|
|
45
|
+
"""
|
|
46
|
+
```
|