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.
- duyi_utils_joker-0.1.3/Agents.md +7 -0
- duyi_utils_joker-0.1.3/PKG-INFO +43 -0
- duyi_utils_joker-0.1.3/README.md +34 -0
- duyi_utils_joker-0.1.3/pyproject.toml +22 -0
- duyi_utils_joker-0.1.3/src/duyi_utils/__init__.py +4 -0
- duyi_utils_joker-0.1.3/src/duyi_utils/date/__init__.py +13 -0
- duyi_utils_joker-0.1.3/src/duyi_utils/greeter.py +3 -0
- duyi_utils_joker-0.1.3/src/duyi_utils/markdown/__init__.py +10 -0
|
@@ -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,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
|