duyi-utils-joker 0.1.3__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.
@@ -0,0 +1,7 @@
1
+ ## 工程描述
2
+
3
+ 这是一个Python示例工程,旨在通过这个工程学习Python工程化的一些技术。我是一个Python小白,刚刚学习完Python的语言部分,对Python的工程化完全不懂,所以我希望通过这个工程来理解Python的整个工程化。
4
+
5
+ ## 沟通规范
6
+
7
+ **非常重要:当用户提问时,不能修改任何东西,不能新增任何东西,不能删除任何东西,仅回答用户问题即可**
@@ -0,0 +1,43 @@
1
+ Metadata-Version: 2.4
2
+ Name: duyi-utils-joker
3
+ Version: 0.1.3
4
+ Summary: 一个用于学习 Python 公共库构建和发布的示例工程
5
+ Requires-Python: >=3.14
6
+ Requires-Dist: markdown>=3.5
7
+ Requires-Dist: python-dateutil>=2.8
8
+ Description-Content-Type: text/markdown
9
+
10
+ # duyi-utils
11
+
12
+ 一个用于学习 Python 公共库构建和发布的示例工程。
13
+
14
+ ## 功能
15
+
16
+ - **日期工具** — 日期格式化、日期差值计算(依赖 `python-dateutil`)
17
+ - **Markdown 工具** — Markdown 转 HTML、去除 Markdown 标记(依赖 `Markdown`)
18
+ - **问候工具** — 简单的个性化问候
19
+
20
+ ## 安装
21
+
22
+ ```bash
23
+ pip install duyi-utils
24
+ ```
25
+
26
+ ## 使用
27
+
28
+ ```python
29
+ from duyi_utils import format_date, days_until, to_html, strip_markdown
30
+ from datetime import date
31
+
32
+ # 日期工具
33
+ format_date(date(2026, 6, 1)) # => "2026年06月01日"
34
+ days_until("2026-10-01") # => 剩余天数
35
+
36
+ # Markdown 工具
37
+ to_html("**Hello**") # => "<p><strong>Hello</strong></p>"
38
+ strip_markdown("**Hello**") # => "<strong>Hello</strong>"
39
+
40
+ # 问候工具
41
+ from duyi_utils.greeter import greet
42
+ greet("小明") # => "你好, 小明!"
43
+ ```
@@ -0,0 +1,34 @@
1
+ # duyi-utils
2
+
3
+ 一个用于学习 Python 公共库构建和发布的示例工程。
4
+
5
+ ## 功能
6
+
7
+ - **日期工具** — 日期格式化、日期差值计算(依赖 `python-dateutil`)
8
+ - **Markdown 工具** — Markdown 转 HTML、去除 Markdown 标记(依赖 `Markdown`)
9
+ - **问候工具** — 简单的个性化问候
10
+
11
+ ## 安装
12
+
13
+ ```bash
14
+ pip install duyi-utils
15
+ ```
16
+
17
+ ## 使用
18
+
19
+ ```python
20
+ from duyi_utils import format_date, days_until, to_html, strip_markdown
21
+ from datetime import date
22
+
23
+ # 日期工具
24
+ format_date(date(2026, 6, 1)) # => "2026年06月01日"
25
+ days_until("2026-10-01") # => 剩余天数
26
+
27
+ # Markdown 工具
28
+ to_html("**Hello**") # => "<p><strong>Hello</strong></p>"
29
+ strip_markdown("**Hello**") # => "<strong>Hello</strong>"
30
+
31
+ # 问候工具
32
+ from duyi_utils.greeter import greet
33
+ greet("小明") # => "你好, 小明!"
34
+ ```
@@ -0,0 +1,22 @@
1
+ # pyproject.toml
2
+
3
+ [build-system] # 构建系统配置,指定构建工具和依赖
4
+ requires = ["hatchling"] # 依赖的后端构建工具
5
+ build-backend = "hatchling.build" # 使用哪个工具的哪个模块来构建项目
6
+
7
+ [project] # 工程描述
8
+ name = "duyi-utils-joker" # 发行版名称
9
+ version = "0.1.3" # 版本号,遵循语义化版本控制
10
+ description = "一个用于学习 Python 公共库构建和发布的示例工程" # 项目简介
11
+ requires-python = ">=3.14" # 指定支持的 Python 版本
12
+ readme = "README.md" # 指定项目的 README 文件路径
13
+ dependencies = [
14
+ "python-dateutil>=2.8", # 依赖的第三方库,指定版本要求
15
+ "Markdown>=3.5", # 另一个依赖
16
+ ]
17
+
18
+ [tool.hatch.build.targets.sdist] # 配置源代码分发包
19
+ # 配置留空,表示它会默认包含所有项目文件
20
+
21
+ [tool.hatch.build.targets.wheel] # 配置 wheel 包
22
+ packages = ["src/duyi_utils"] # 配置 wheel 包的构建目标,指定包含的包路径
@@ -0,0 +1,4 @@
1
+ from duyi_utils.markdown import to_html, strip_markdown
2
+ from duyi_utils.date import format_date, days_until
3
+
4
+ __all__ = ["to_html", "strip_markdown", "format_date", "days_until"]
@@ -0,0 +1,13 @@
1
+ from datetime import date
2
+
3
+ from dateutil.parser import parse
4
+
5
+
6
+ def format_date(d: date) -> str:
7
+ return d.strftime("%Y年%m月%d日")
8
+
9
+
10
+ def days_until(target: str) -> int:
11
+ target_date = parse(target).date()
12
+ delta = target_date - date.today()
13
+ return delta.days
@@ -0,0 +1,3 @@
1
+ def greet(name: str) -> str:
2
+ print("greet function called")
3
+ return f"你好, {name}!"
@@ -0,0 +1,10 @@
1
+ import markdown
2
+
3
+
4
+ def to_html(text: str) -> str:
5
+ return markdown.markdown(text)
6
+
7
+
8
+ def strip_markdown(text: str) -> str:
9
+ html = markdown.markdown(text)
10
+ return html.removeprefix("<p>").removesuffix("</p>\n")