tiebameow 0.2.8__py3-none-any.whl

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,142 @@
1
+ Metadata-Version: 2.4
2
+ Name: tiebameow
3
+ Version: 0.2.8
4
+ Summary: Shared library for TiebaMeow services
5
+ License-Expression: MIT
6
+ License-File: LICENSE
7
+ Keywords: tieba
8
+ Classifier: License :: OSI Approved :: MIT License
9
+ Classifier: Programming Language :: Python
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Programming Language :: Python :: 3.12
12
+ Classifier: Programming Language :: Python :: 3.13
13
+ Classifier: Programming Language :: Python :: 3.14
14
+ Requires-Python: >=3.12
15
+ Requires-Dist: aiolimiter>=1.2.1
16
+ Requires-Dist: aiotieba>=4.6.1
17
+ Requires-Dist: httpx>=0.28.1
18
+ Requires-Dist: loguru>=0.7.3
19
+ Requires-Dist: pydantic>=2.12.5
20
+ Requires-Dist: pyparsing>=3.3.1
21
+ Requires-Dist: tenacity>=9.1.2
22
+ Requires-Dist: tzdata>=2025.2
23
+ Provides-Extra: orm
24
+ Requires-Dist: sqlalchemy>=2.0.44; extra == 'orm'
25
+ Provides-Extra: renderer
26
+ Requires-Dist: jinja2>=3.1.5; extra == 'renderer'
27
+ Requires-Dist: playwright>=1.49.1; extra == 'renderer'
28
+ Description-Content-Type: text/markdown
29
+
30
+ # tiebameow
31
+
32
+ [![License](https://img.shields.io/github/license/TiebaMeow/tiebameow)](https://github.com/TiebaMeow/tiebameow/blob/main/LICENSE)
33
+ [![PyPI](https://img.shields.io/pypi/v/tiebameow)](https://pypi.org/project/tiebameow/)
34
+ [![Python](https://img.shields.io/pypi/pyversions/tiebameow)](https://pypi.org/project/tiebameow/)
35
+ [![CI](https://github.com/TiebaMeow/tiebameow/actions/workflows/CI.yml/badge.svg)](https://github.com/TiebaMeow/tiebameow/actions/workflows/CI.yml)
36
+ [![codecov](https://codecov.io/gh/TiebaMeow/tiebameow/graph/badge.svg)](https://codecov.io/gh/TiebaMeow/tiebameow)
37
+
38
+ Tiebameow 项目通用模块
39
+
40
+ ## 简介
41
+
42
+ `tiebameow` 是在 Tiebameow 项目内使用的通用模块,提供了通用的数据模型、序列化/反序列化工具、日志模块以及辅助函数。
43
+
44
+ ## 目录
45
+
46
+ - `client`: 包含增强的 `aiotieba.Client` 与 `httpx` 客户端。
47
+ - `models`: 定义了通用数据交换模型和 ORM 数据模型。
48
+ - `parser`: 提供解析和处理 `aiotieba` 数据和审查规则的解析器。
49
+ - `renderer`: 提供将 DTO 内容或简单文本渲染为图片的功能。
50
+ - `schemas`: 定义了各种数据片段与审查规则的 Pydantic 模型。
51
+ - `serializer`: 提供数据交换模型的序列化和反序列化方法。
52
+ - `utils`: 包含通用日志模块和一些辅助函数和工具类。
53
+
54
+ ## 安装
55
+
56
+ 推荐使用 `uv` 进行环境管理和依赖安装。
57
+
58
+ 仅安装基础功能:
59
+
60
+ ```bash
61
+ uv add tiebameow
62
+ ```
63
+
64
+ 如需使用数据库模型,请安装 `orm` 额外依赖:
65
+
66
+ ```bash
67
+ uv add tiebameow[orm]
68
+ ```
69
+
70
+ 如需使用渲染功能,请安装 `renderer` 额外依赖和 `Playwright` 所需浏览器:
71
+
72
+ ```bash
73
+ uv add tiebameow[renderer]
74
+ uv run playwright install chromium-headless-shell
75
+ ```
76
+
77
+ ## 基本用法
78
+
79
+ 更多用法请参阅源码。
80
+
81
+ ### Client
82
+
83
+ #### Tieba Client
84
+
85
+ ```python
86
+ from tiebameow.client import Client
87
+ async with Client() as client:
88
+ user_info = await client.get_user_info("some_username")
89
+ ```
90
+
91
+ #### HTTP Client
92
+
93
+ ```python
94
+ from tiebameow.client import HTTPXClient
95
+ response = await HTTPXClient.get("https://example.com")
96
+ ```
97
+
98
+ ### Parser
99
+
100
+ #### 数据转换器
101
+
102
+ 将 `aiotieba` 对象转换为通用数据交换模型:
103
+
104
+ ```python
105
+ from tiebameow.parser import convert_aiotieba_thread
106
+ from tiebameow.client import Client
107
+ async with Client() as client:
108
+ threads = await client.get_threads("some_tieba")
109
+ for thread in threads:
110
+ converted_thread = convert_aiotieba_thread(thread)
111
+ ```
112
+
113
+ #### 规则引擎解析器
114
+
115
+ 以 DSL 或 CNL 模式解析规则和动作:
116
+
117
+ ```python
118
+ from tiebameow.parser import RuleEngineParser
119
+ parser = RuleEngineParser()
120
+ rule_node = parser.parse_rule("(title contains 'A' AND title contains 'B') OR NOT title contains 'C'")
121
+ actions = parser.parse_actions("DO: delete(reason='spam content'), ban(days=1)")
122
+ ```
123
+
124
+ ### Renderer
125
+
126
+ ```python
127
+ from tiebameow.renderer import Renderer
128
+ async with Renderer() as renderer:
129
+ image_bytes = await renderer.text_to_image("Hello, World!")
130
+ ```
131
+
132
+ ## 开发指南
133
+
134
+ 欢迎贡献代码,请确保遵循项目的编码规范,并在提交前运行 pre-commit hooks:
135
+
136
+ ```bash
137
+ uv sync --dev
138
+ pre-commit install
139
+ pre-commit run --all-files
140
+ ```
141
+
142
+ 有关详细信息,请参阅 `CONTRIBUTING.md` 文件。
@@ -0,0 +1,36 @@
1
+ tiebameow/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ tiebameow/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
+ tiebameow/client/__init__.py,sha256=oDIpFubIaQLXEL-XV3x16qh8o_BVkF6SAazLl0IUFlg,107
4
+ tiebameow/client/http_client.py,sha256=0QD-KaRjKVCO_F2l9My-nkiZQFoHTALbWYy2O7ifink,3594
5
+ tiebameow/client/tieba_client.py,sha256=zlkCRp2H-kXD8OOCO3qWgZ8XOwlivzXZYo7uHM_q8A0,17240
6
+ tiebameow/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
+ tiebameow/models/dto.py,sha256=LhrsDJSiqq6j4huNJGHtrIU9N662olIiXP9qzKTd0Ko,10075
8
+ tiebameow/models/orm.py,sha256=MGco1lStB9TZ73FPu3sC9iDI_8EiIrw5rUvn1L72PLw,20207
9
+ tiebameow/parser/__init__.py,sha256=LSkPkz7RKGOpiKpNj5LLrMaVxmhw0ALWGj5aubwcvWk,1319
10
+ tiebameow/parser/parser.py,sha256=m52VsZoZMknOcDIFt-pV5b76kTzUS781JIwQO5zAK8A,11607
11
+ tiebameow/parser/rule_parser.py,sha256=HReDjC_C8CFyYQZWYdkl7rvQ9lgPoypBWKc9q3vNbvM,37122
12
+ tiebameow/renderer/__init__.py,sha256=p_EtWNsiTetGGgtGQaHgcEqwdUBqFe8wmt6q1K9hGm8,166
13
+ tiebameow/renderer/config.py,sha256=45oVjrcGJSL28vkjH-w7670xelAbYQRkH0up9G71U3c,484
14
+ tiebameow/renderer/playwright_core.py,sha256=MuGv6MidkEYFZLneicY0z98NFpAfBhpCRxFfK7IG8xY,4915
15
+ tiebameow/renderer/renderer.py,sha256=madO9rZcUEtRE2m3L1ul0oJNVm8GQ7zoPVtyztMaHOE,17776
16
+ tiebameow/renderer/style.py,sha256=oGUYC9tTPZ6hJ9K9SD7Uvq79H3uqnJNPK_FuPWRNea4,743
17
+ tiebameow/renderer/static/fonts/NotoSansSC-Regular.woff2,sha256=KsZkKouZc8g1eQ_5wzOWuGkIcSYzGGsHYZJhyu0hFDg,4182468
18
+ tiebameow/renderer/templates/base.html,sha256=O34oGzyZR3nBUgFhf8Oh7THTg0BH8BM1xK9vaP3-vVw,6109
19
+ tiebameow/renderer/templates/macros.html,sha256=-npkG2U7ZARhkksFdqrL5ffAm3S6hQ54wkdRJAH3a-M,3114
20
+ tiebameow/renderer/templates/text.html,sha256=zrryzgnY_B7TrYqsMkRDEpSDmDqcBHUF5WnUMOOQNyo,2283
21
+ tiebameow/renderer/templates/text_simple.html,sha256=iWisu1XdIP2cSynTXHGXzbUxfOTsoUmdsIeXdJrRJUk,1995
22
+ tiebameow/renderer/templates/thread.html,sha256=os3-qlBTbIgwtLQFcC94zZgmE4-95JtBuO4ndTw_YwI,251
23
+ tiebameow/renderer/templates/thread_detail.html,sha256=Io4cRr40gav_4irXqNLn11S7QVFFJMA3auK5mDbonbE,481
24
+ tiebameow/renderer/templates/thread_info.html,sha256=BS_j-XUxcMYzmw1IIQ6p86HN6nUgbs0vL0HvbC17vU4,7628
25
+ tiebameow/schemas/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
26
+ tiebameow/schemas/fragments.py,sha256=lLJZ88rj2N8Fy166sHF5wJoSuG1H_Y9Ordke1426cH0,4244
27
+ tiebameow/schemas/rules.py,sha256=zg0Rr6OoL1ByF70JziFvKDSp9sxjHAU9M1qoAs1D8Ac,6515
28
+ tiebameow/serializer/__init__.py,sha256=HzNJRqUBbMaw5eenPQze90_crEba-DyKV8UMAfYGUSk,259
29
+ tiebameow/serializer/serializer.py,sha256=45jXTC6qhSWcG2JpxcWHpvD8Sf3ZNndHOPrBt_klECs,3184
30
+ tiebameow/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
31
+ tiebameow/utils/logger.py,sha256=FIWreeOyRYtOhtinb1iahWNenzzkLreo2rR3cE97kgk,4283
32
+ tiebameow/utils/time_utils.py,sha256=b71lsrw-o5LBVGtg9WpAdOvnL7CY1ugjq513fgGHg4A,325
33
+ tiebameow-0.2.8.dist-info/METADATA,sha256=4op3F8_HFy-nqkugVYENivCLJJZhWvlyWQzIq74ZVe8,4197
34
+ tiebameow-0.2.8.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
35
+ tiebameow-0.2.8.dist-info/licenses/LICENSE,sha256=bq5BsmRGHKrtjWJpDXgnQx1IpFBigzsr-SvKOZRy78Y,1079
36
+ tiebameow-0.2.8.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.28.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 TiebaMeow Contributors
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.