ChatLark 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.
chatlark-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 ChatArch
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,112 @@
1
+ Metadata-Version: 2.4
2
+ Name: ChatLark
3
+ Version: 0.1.0
4
+ Summary: ChatArch Feishu/Lark bot helpers extracted from ChatTool.
5
+ Author-email: ChatArch <noreply@chatarch.org>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/ChatArch/ChatLark
8
+ Project-URL: Repository, https://github.com/ChatArch/ChatLark
9
+ Keywords: chatlark,chatarch,cli
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Operating System :: OS Independent
12
+ Requires-Python: >=3.10
13
+ Description-Content-Type: text/markdown
14
+ License-File: LICENSE
15
+ Requires-Dist: click>=8.0
16
+ Requires-Dist: chatstyle<0.2.0,>=0.1.0
17
+ Requires-Dist: chatenv<0.3.0,>=0.2.0
18
+ Requires-Dist: lark-oapi==1.5.3
19
+ Requires-Dist: flask>=2.0
20
+ Provides-Extra: dev
21
+ Requires-Dist: build; extra == "dev"
22
+ Requires-Dist: pytest; extra == "dev"
23
+ Requires-Dist: twine; extra == "dev"
24
+ Provides-Extra: llm
25
+ Requires-Dist: chattool<8.0.0,>=7.1.0; extra == "llm"
26
+ Dynamic: license-file
27
+
28
+ <div align="center">
29
+ <a href="https://pypi.python.org/pypi/ChatLark">
30
+ <img src="https://img.shields.io/pypi/v/ChatLark.svg" alt="PyPI version" />
31
+ </a>
32
+ <a href="https://github.com/ChatArch/ChatLark/actions/workflows/ci.yml">
33
+ <img src="https://github.com/ChatArch/ChatLark/actions/workflows/ci.yml/badge.svg" alt="Tests" />
34
+ </a>
35
+ </div>
36
+
37
+ <div align="center">
38
+
39
+ [English](README.en.md) | [简体中文](README.md)
40
+ </div>
41
+
42
+ # ChatLark
43
+
44
+ ChatArch 的 Feishu/Lark bot helper 包,承接从 ChatTool 拆出的轻量机器人、消息发送、事件服务和消息内容构造能力。更广泛的 Feishu/Lark OpenAPI 操作仍优先使用官方 `lark-cli`。
45
+
46
+ ## 快速开始
47
+
48
+ ```bash
49
+ pip install -e ".[dev]"
50
+ chatlark --help
51
+ chatlark --version
52
+ chatlark send --help
53
+ chatlark serve --help
54
+ python -m pytest -q
55
+ python -m build
56
+ ```
57
+
58
+ ## CLI
59
+
60
+ ```bash
61
+ chatlark info
62
+ chatlark send USER_ID "Hello"
63
+ chatlark send "Hello" # 使用 FEISHU_DEFAULT_RECEIVER_ID
64
+ chatlark send -t chat_id "Hello team" # 使用 FEISHU_DEFAULT_CHAT_ID
65
+ chatlark serve echo
66
+ chatlark serve webhook
67
+ ```
68
+
69
+ AI 对话命令保留为可选边界,避免 ChatLark 基础包依赖 ChatTool 形成循环:
70
+
71
+ ```bash
72
+ pip install "chatlark[llm]"
73
+ chatlark chat
74
+ chatlark serve ai --system "你是工作助手"
75
+ ```
76
+
77
+ ## Python API
78
+
79
+ ```python
80
+ from chatlark import LarkBot, ChatSession
81
+
82
+ bot = LarkBot()
83
+ session = ChatSession(system="你是助手")
84
+
85
+ @bot.on_message
86
+ def chat(ctx):
87
+ ctx.reply(session.chat(ctx.sender_id, ctx.text))
88
+
89
+ bot.start()
90
+ ```
91
+
92
+ ## 配置
93
+
94
+ ChatLark 复用 ChatEnv 的 Feishu 配置字段:
95
+
96
+ - `FEISHU_APP_ID`
97
+ - `FEISHU_APP_SECRET`
98
+ - `FEISHU_API_BASE`
99
+ - `FEISHU_DEFAULT_RECEIVER_ID`
100
+ - `FEISHU_DEFAULT_CHAT_ID`
101
+
102
+ 可通过环境变量直接提供,也可以通过 `-e/--env` 指定 ChatEnv Feishu profile 或 `.env` 文件。
103
+
104
+ ## 边界
105
+
106
+ - ChatLark:bot helper、消息发送、事件服务、消息上下文、消息内容构造。
107
+ - lark-cli:广泛 Feishu/Lark OpenAPI 操作和用户授权流程。
108
+ - ChatTool:迁移完成后只应保留有意设计的兼容入口或依赖连接,不再重复持有 Lark business logic。
109
+
110
+ ## 开发说明
111
+
112
+ 扩展前先阅读 `DEVELOP.md` 和 `AGENTS.md`。发布走 PyPI Trusted Publisher/OIDC workflow,不使用本地 token 上传正式版本。
@@ -0,0 +1,85 @@
1
+ <div align="center">
2
+ <a href="https://pypi.python.org/pypi/ChatLark">
3
+ <img src="https://img.shields.io/pypi/v/ChatLark.svg" alt="PyPI version" />
4
+ </a>
5
+ <a href="https://github.com/ChatArch/ChatLark/actions/workflows/ci.yml">
6
+ <img src="https://github.com/ChatArch/ChatLark/actions/workflows/ci.yml/badge.svg" alt="Tests" />
7
+ </a>
8
+ </div>
9
+
10
+ <div align="center">
11
+
12
+ [English](README.en.md) | [简体中文](README.md)
13
+ </div>
14
+
15
+ # ChatLark
16
+
17
+ ChatArch 的 Feishu/Lark bot helper 包,承接从 ChatTool 拆出的轻量机器人、消息发送、事件服务和消息内容构造能力。更广泛的 Feishu/Lark OpenAPI 操作仍优先使用官方 `lark-cli`。
18
+
19
+ ## 快速开始
20
+
21
+ ```bash
22
+ pip install -e ".[dev]"
23
+ chatlark --help
24
+ chatlark --version
25
+ chatlark send --help
26
+ chatlark serve --help
27
+ python -m pytest -q
28
+ python -m build
29
+ ```
30
+
31
+ ## CLI
32
+
33
+ ```bash
34
+ chatlark info
35
+ chatlark send USER_ID "Hello"
36
+ chatlark send "Hello" # 使用 FEISHU_DEFAULT_RECEIVER_ID
37
+ chatlark send -t chat_id "Hello team" # 使用 FEISHU_DEFAULT_CHAT_ID
38
+ chatlark serve echo
39
+ chatlark serve webhook
40
+ ```
41
+
42
+ AI 对话命令保留为可选边界,避免 ChatLark 基础包依赖 ChatTool 形成循环:
43
+
44
+ ```bash
45
+ pip install "chatlark[llm]"
46
+ chatlark chat
47
+ chatlark serve ai --system "你是工作助手"
48
+ ```
49
+
50
+ ## Python API
51
+
52
+ ```python
53
+ from chatlark import LarkBot, ChatSession
54
+
55
+ bot = LarkBot()
56
+ session = ChatSession(system="你是助手")
57
+
58
+ @bot.on_message
59
+ def chat(ctx):
60
+ ctx.reply(session.chat(ctx.sender_id, ctx.text))
61
+
62
+ bot.start()
63
+ ```
64
+
65
+ ## 配置
66
+
67
+ ChatLark 复用 ChatEnv 的 Feishu 配置字段:
68
+
69
+ - `FEISHU_APP_ID`
70
+ - `FEISHU_APP_SECRET`
71
+ - `FEISHU_API_BASE`
72
+ - `FEISHU_DEFAULT_RECEIVER_ID`
73
+ - `FEISHU_DEFAULT_CHAT_ID`
74
+
75
+ 可通过环境变量直接提供,也可以通过 `-e/--env` 指定 ChatEnv Feishu profile 或 `.env` 文件。
76
+
77
+ ## 边界
78
+
79
+ - ChatLark:bot helper、消息发送、事件服务、消息上下文、消息内容构造。
80
+ - lark-cli:广泛 Feishu/Lark OpenAPI 操作和用户授权流程。
81
+ - ChatTool:迁移完成后只应保留有意设计的兼容入口或依赖连接,不再重复持有 Lark business logic。
82
+
83
+ ## 开发说明
84
+
85
+ 扩展前先阅读 `DEVELOP.md` 和 `AGENTS.md`。发布走 PyPI Trusted Publisher/OIDC workflow,不使用本地 token 上传正式版本。
@@ -0,0 +1,44 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "ChatLark"
7
+ dynamic = ["version"]
8
+ description = "ChatArch Feishu/Lark bot helpers extracted from ChatTool."
9
+ readme = "README.md"
10
+ requires-python = ">=3.10"
11
+ license = "MIT"
12
+ dependencies = [
13
+ "click>=8.0",
14
+ "chatstyle>=0.1.0,<0.2.0",
15
+ "chatenv>=0.2.0,<0.3.0",
16
+ "lark-oapi==1.5.3",
17
+ "flask>=2.0",
18
+ ]
19
+ authors = [{name = "ChatArch", email = "noreply@chatarch.org"}]
20
+ keywords = ["chatlark", "chatarch", "cli"]
21
+ classifiers = [
22
+ "Programming Language :: Python :: 3",
23
+ "Operating System :: OS Independent",
24
+ ]
25
+
26
+ [project.urls]
27
+ Homepage = "https://github.com/ChatArch/ChatLark"
28
+ Repository = "https://github.com/ChatArch/ChatLark"
29
+
30
+ [project.scripts]
31
+ chatlark = "chatlark.cli:main"
32
+
33
+ [project.optional-dependencies]
34
+ dev = ["build", "pytest", "twine"]
35
+ llm = ["chattool>=7.1.0,<8.0.0"]
36
+
37
+ [tool.setuptools.dynamic]
38
+ version = {attr = "chatlark.__version__"}
39
+
40
+ [tool.setuptools.packages.find]
41
+ where = ["src"]
42
+
43
+ [tool.setuptools]
44
+ include-package-data = true
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,112 @@
1
+ Metadata-Version: 2.4
2
+ Name: ChatLark
3
+ Version: 0.1.0
4
+ Summary: ChatArch Feishu/Lark bot helpers extracted from ChatTool.
5
+ Author-email: ChatArch <noreply@chatarch.org>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/ChatArch/ChatLark
8
+ Project-URL: Repository, https://github.com/ChatArch/ChatLark
9
+ Keywords: chatlark,chatarch,cli
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Operating System :: OS Independent
12
+ Requires-Python: >=3.10
13
+ Description-Content-Type: text/markdown
14
+ License-File: LICENSE
15
+ Requires-Dist: click>=8.0
16
+ Requires-Dist: chatstyle<0.2.0,>=0.1.0
17
+ Requires-Dist: chatenv<0.3.0,>=0.2.0
18
+ Requires-Dist: lark-oapi==1.5.3
19
+ Requires-Dist: flask>=2.0
20
+ Provides-Extra: dev
21
+ Requires-Dist: build; extra == "dev"
22
+ Requires-Dist: pytest; extra == "dev"
23
+ Requires-Dist: twine; extra == "dev"
24
+ Provides-Extra: llm
25
+ Requires-Dist: chattool<8.0.0,>=7.1.0; extra == "llm"
26
+ Dynamic: license-file
27
+
28
+ <div align="center">
29
+ <a href="https://pypi.python.org/pypi/ChatLark">
30
+ <img src="https://img.shields.io/pypi/v/ChatLark.svg" alt="PyPI version" />
31
+ </a>
32
+ <a href="https://github.com/ChatArch/ChatLark/actions/workflows/ci.yml">
33
+ <img src="https://github.com/ChatArch/ChatLark/actions/workflows/ci.yml/badge.svg" alt="Tests" />
34
+ </a>
35
+ </div>
36
+
37
+ <div align="center">
38
+
39
+ [English](README.en.md) | [简体中文](README.md)
40
+ </div>
41
+
42
+ # ChatLark
43
+
44
+ ChatArch 的 Feishu/Lark bot helper 包,承接从 ChatTool 拆出的轻量机器人、消息发送、事件服务和消息内容构造能力。更广泛的 Feishu/Lark OpenAPI 操作仍优先使用官方 `lark-cli`。
45
+
46
+ ## 快速开始
47
+
48
+ ```bash
49
+ pip install -e ".[dev]"
50
+ chatlark --help
51
+ chatlark --version
52
+ chatlark send --help
53
+ chatlark serve --help
54
+ python -m pytest -q
55
+ python -m build
56
+ ```
57
+
58
+ ## CLI
59
+
60
+ ```bash
61
+ chatlark info
62
+ chatlark send USER_ID "Hello"
63
+ chatlark send "Hello" # 使用 FEISHU_DEFAULT_RECEIVER_ID
64
+ chatlark send -t chat_id "Hello team" # 使用 FEISHU_DEFAULT_CHAT_ID
65
+ chatlark serve echo
66
+ chatlark serve webhook
67
+ ```
68
+
69
+ AI 对话命令保留为可选边界,避免 ChatLark 基础包依赖 ChatTool 形成循环:
70
+
71
+ ```bash
72
+ pip install "chatlark[llm]"
73
+ chatlark chat
74
+ chatlark serve ai --system "你是工作助手"
75
+ ```
76
+
77
+ ## Python API
78
+
79
+ ```python
80
+ from chatlark import LarkBot, ChatSession
81
+
82
+ bot = LarkBot()
83
+ session = ChatSession(system="你是助手")
84
+
85
+ @bot.on_message
86
+ def chat(ctx):
87
+ ctx.reply(session.chat(ctx.sender_id, ctx.text))
88
+
89
+ bot.start()
90
+ ```
91
+
92
+ ## 配置
93
+
94
+ ChatLark 复用 ChatEnv 的 Feishu 配置字段:
95
+
96
+ - `FEISHU_APP_ID`
97
+ - `FEISHU_APP_SECRET`
98
+ - `FEISHU_API_BASE`
99
+ - `FEISHU_DEFAULT_RECEIVER_ID`
100
+ - `FEISHU_DEFAULT_CHAT_ID`
101
+
102
+ 可通过环境变量直接提供,也可以通过 `-e/--env` 指定 ChatEnv Feishu profile 或 `.env` 文件。
103
+
104
+ ## 边界
105
+
106
+ - ChatLark:bot helper、消息发送、事件服务、消息上下文、消息内容构造。
107
+ - lark-cli:广泛 Feishu/Lark OpenAPI 操作和用户授权流程。
108
+ - ChatTool:迁移完成后只应保留有意设计的兼容入口或依赖连接,不再重复持有 Lark business logic。
109
+
110
+ ## 开发说明
111
+
112
+ 扩展前先阅读 `DEVELOP.md` 和 `AGENTS.md`。发布走 PyPI Trusted Publisher/OIDC workflow,不使用本地 token 上传正式版本。
@@ -0,0 +1,22 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ src/ChatLark.egg-info/PKG-INFO
5
+ src/ChatLark.egg-info/SOURCES.txt
6
+ src/ChatLark.egg-info/dependency_links.txt
7
+ src/ChatLark.egg-info/entry_points.txt
8
+ src/ChatLark.egg-info/requires.txt
9
+ src/ChatLark.egg-info/top_level.txt
10
+ src/chatlark/__init__.py
11
+ src/chatlark/bot.py
12
+ src/chatlark/cli.py
13
+ src/chatlark/config.py
14
+ src/chatlark/context.py
15
+ src/chatlark/docx_blocks.py
16
+ src/chatlark/elements.py
17
+ src/chatlark/markdown_blocks.py
18
+ src/chatlark/serve.py
19
+ src/chatlark/session.py
20
+ tests/test_api.py
21
+ tests/test_cli.py
22
+ tests/test_version.py
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ chatlark = chatlark.cli:main
@@ -0,0 +1,13 @@
1
+ click>=8.0
2
+ chatstyle<0.2.0,>=0.1.0
3
+ chatenv<0.3.0,>=0.2.0
4
+ lark-oapi==1.5.3
5
+ flask>=2.0
6
+
7
+ [dev]
8
+ build
9
+ pytest
10
+ twine
11
+
12
+ [llm]
13
+ chattool<8.0.0,>=7.1.0
@@ -0,0 +1 @@
1
+ chatlark
@@ -0,0 +1,34 @@
1
+ import importlib
2
+
3
+
4
+ _LAZY_ATTRS = {
5
+ "LarkBot": ("chatlark.bot", "LarkBot"),
6
+ "MessageContext": ("chatlark.context", "MessageContext"),
7
+ "DocxBlockType": ("chatlark.docx_blocks", "DocxBlockType"),
8
+ "parse_markdown_blocks": ("chatlark.markdown_blocks", "parse_markdown_blocks"),
9
+ "ChatSession": ("chatlark.session", "ChatSession"),
10
+ }
11
+
12
+
13
+ def __getattr__(name: str):
14
+ if name == "__version__":
15
+ return "0.1.0"
16
+ target = _LAZY_ATTRS.get(name)
17
+ if target is None:
18
+ raise AttributeError(name)
19
+ module_name, attr_name = target
20
+ value = getattr(importlib.import_module(module_name), attr_name)
21
+ globals()[name] = value
22
+ return value
23
+
24
+
25
+ __version__ = "0.1.0"
26
+
27
+ __all__ = [
28
+ "__version__",
29
+ "LarkBot",
30
+ "MessageContext",
31
+ "ChatSession",
32
+ "DocxBlockType",
33
+ "parse_markdown_blocks",
34
+ ]