staran 1.0.8__tar.gz → 1.0.10__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.
- staran-1.0.10/PKG-INFO +240 -0
- staran-1.0.10/README.md +181 -0
- {staran-1.0.8 → staran-1.0.10}/setup.py +37 -4
- staran-1.0.10/staran/__init__.py +0 -0
- staran-1.0.10/staran/date/__init__.py +91 -0
- staran-1.0.10/staran/date/core/__init__.py +24 -0
- {staran-1.0.8/staran/date → staran-1.0.10/staran/date/core}/core.py +1094 -9
- staran-1.0.10/staran/date/examples/v1010_features_demo.py +376 -0
- staran-1.0.10/staran/date/examples/v109_features_demo.py +302 -0
- staran-1.0.10/staran/date/extensions/__init__.py +48 -0
- staran-1.0.10/staran/date/extensions/expressions.py +554 -0
- staran-1.0.10/staran/date/extensions/solar_terms.py +417 -0
- staran-1.0.10/staran/date/extensions/timezone.py +263 -0
- staran-1.0.10/staran/date/integrations/__init__.py +38 -0
- staran-1.0.10/staran/date/integrations/api_server.py +754 -0
- staran-1.0.10/staran/date/integrations/visualization.py +689 -0
- {staran-1.0.8 → staran-1.0.10}/staran/date/tests/run_tests.py +77 -6
- staran-1.0.10/staran/date/tests/test_v1010_features.py +495 -0
- staran-1.0.10/staran/date/tests/test_v109_features.py +316 -0
- staran-1.0.10/staran.egg-info/PKG-INFO +240 -0
- staran-1.0.10/staran.egg-info/SOURCES.txt +37 -0
- staran-1.0.10/staran.egg-info/entry_points.txt +2 -0
- staran-1.0.10/staran.egg-info/requires.txt +19 -0
- staran-1.0.8/PKG-INFO +0 -371
- staran-1.0.8/README.md +0 -332
- staran-1.0.8/staran/__init__.py +0 -62
- staran-1.0.8/staran/date/__init__.py +0 -106
- staran-1.0.8/staran.egg-info/PKG-INFO +0 -371
- staran-1.0.8/staran.egg-info/SOURCES.txt +0 -23
- {staran-1.0.8 → staran-1.0.10}/LICENSE +0 -0
- {staran-1.0.8 → staran-1.0.10}/setup.cfg +0 -0
- {staran-1.0.8/staran/date → staran-1.0.10/staran/date/core}/i18n.py +0 -0
- {staran-1.0.8/staran/date → staran-1.0.10/staran/date/core}/lunar.py +0 -0
- {staran-1.0.8 → staran-1.0.10}/staran/date/examples/__init__.py +0 -0
- {staran-1.0.8 → staran-1.0.10}/staran/date/examples/basic_usage.py +0 -0
- {staran-1.0.8 → staran-1.0.10}/staran/date/examples/enhanced_features.py +0 -0
- {staran-1.0.8 → staran-1.0.10}/staran/date/examples/v108_features_demo.py +0 -0
- {staran-1.0.8 → staran-1.0.10}/staran/date/tests/__init__.py +0 -0
- {staran-1.0.8 → staran-1.0.10}/staran/date/tests/test_core.py +0 -0
- {staran-1.0.8 → staran-1.0.10}/staran/date/tests/test_enhancements.py +0 -0
- {staran-1.0.8 → staran-1.0.10}/staran/date/tests/test_v108_features.py +0 -0
- {staran-1.0.8 → staran-1.0.10}/staran/date/utils/__init__.py +0 -0
- {staran-1.0.8 → staran-1.0.10}/staran/date/utils/helpers.py +0 -0
- {staran-1.0.8 → staran-1.0.10}/staran.egg-info/dependency_links.txt +0 -0
- {staran-1.0.8 → staran-1.0.10}/staran.egg-info/top_level.txt +0 -0
staran-1.0.10/PKG-INFO
ADDED
@@ -0,0 +1,240 @@
|
|
1
|
+
Metadata-Version: 2.4
|
2
|
+
Name: staran
|
3
|
+
Version: 1.0.10
|
4
|
+
Summary: staran - 企业级Python日期处理库
|
5
|
+
Home-page: https://github.com/starlxa/staran
|
6
|
+
Author: StarAn
|
7
|
+
Author-email: starlxa@icloud.com
|
8
|
+
License: MIT
|
9
|
+
Project-URL: Bug Reports, https://github.com/starlxa/staran/issues
|
10
|
+
Project-URL: Source, https://github.com/starlxa/staran
|
11
|
+
Project-URL: Documentation, https://github.com/starlxa/staran/blob/master/API_REFERENCE.md
|
12
|
+
Keywords: date datetime utilities time-processing lunar calendar i18n timezone visualization api
|
13
|
+
Classifier: Development Status :: 5 - Production/Stable
|
14
|
+
Classifier: Intended Audience :: Developers
|
15
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
16
|
+
Classifier: Topic :: Utilities
|
17
|
+
Classifier: Topic :: Software Development :: Localization
|
18
|
+
Classifier: Topic :: Scientific/Engineering :: Visualization
|
19
|
+
Classifier: Programming Language :: Python :: 3
|
20
|
+
Classifier: Programming Language :: Python :: 3.7
|
21
|
+
Classifier: Programming Language :: Python :: 3.8
|
22
|
+
Classifier: Programming Language :: Python :: 3.9
|
23
|
+
Classifier: Programming Language :: Python :: 3.10
|
24
|
+
Classifier: Programming Language :: Python :: 3.11
|
25
|
+
Classifier: Programming Language :: Python :: 3.12
|
26
|
+
Classifier: Operating System :: OS Independent
|
27
|
+
Classifier: License :: OSI Approved :: MIT License
|
28
|
+
Requires-Python: >=3.7
|
29
|
+
Description-Content-Type: text/markdown
|
30
|
+
License-File: LICENSE
|
31
|
+
Provides-Extra: visualization
|
32
|
+
Requires-Dist: matplotlib>=3.0.0; extra == "visualization"
|
33
|
+
Requires-Dist: plotly>=5.0.0; extra == "visualization"
|
34
|
+
Provides-Extra: web
|
35
|
+
Requires-Dist: flask>=2.0.0; extra == "web"
|
36
|
+
Provides-Extra: full
|
37
|
+
Requires-Dist: matplotlib>=3.0.0; extra == "full"
|
38
|
+
Requires-Dist: plotly>=5.0.0; extra == "full"
|
39
|
+
Requires-Dist: flask>=2.0.0; extra == "full"
|
40
|
+
Provides-Extra: dev
|
41
|
+
Requires-Dist: pytest>=6.0.0; extra == "dev"
|
42
|
+
Requires-Dist: pytest-cov>=2.0.0; extra == "dev"
|
43
|
+
Requires-Dist: black>=21.0.0; extra == "dev"
|
44
|
+
Requires-Dist: flake8>=3.8.0; extra == "dev"
|
45
|
+
Requires-Dist: mypy>=0.800; extra == "dev"
|
46
|
+
Dynamic: author
|
47
|
+
Dynamic: author-email
|
48
|
+
Dynamic: classifier
|
49
|
+
Dynamic: description
|
50
|
+
Dynamic: description-content-type
|
51
|
+
Dynamic: home-page
|
52
|
+
Dynamic: keywords
|
53
|
+
Dynamic: license
|
54
|
+
Dynamic: license-file
|
55
|
+
Dynamic: project-url
|
56
|
+
Dynamic: provides-extra
|
57
|
+
Dynamic: requires-python
|
58
|
+
Dynamic: summary
|
59
|
+
|
60
|
+
# Staran v1.0.9 - 企业级多功能工具库
|
61
|
+
|
62
|
+
[](https://python.org)
|
63
|
+
[](LICENSE)
|
64
|
+
[](#测试)
|
65
|
+
[](#性能)
|
66
|
+
|
67
|
+
一个现代化的Python多功能工具库,为企业应用提供一系列高质量、零依赖的解决方案。专注于性能、易用性和可扩展性。
|
68
|
+
|
69
|
+
## 📚 文档导航
|
70
|
+
|
71
|
+
- **[API 参考文档](https://github.com/StarLxa/staran/tree/master/API_REFERENCE.md)** - 完整的API文档和使用指南
|
72
|
+
- **[更新日志](https://github.com/StarLxa/staran/tree/master/CHANGELOG.md)** - 详细的版本历史和更新记录
|
73
|
+
- **[PyPI包页面](https://pypi.org/project/staran/)** - 安装和版本信息
|
74
|
+
- **[快速开始](#快速开始)** - 立即开始使用
|
75
|
+
|
76
|
+
## 🚀 核心理念
|
77
|
+
|
78
|
+
`staran` 旨在成为一个可扩展的工具库,包含多个独立的、高质量的模块。每个模块都专注于解决特定领域的问题,并遵循统一的设计标准。
|
79
|
+
|
80
|
+
### 当前模块
|
81
|
+
- **`date`**: 企业级日期处理工具 (v1.0.9) - **智能推断与异步处理版**
|
82
|
+
|
83
|
+
### 未来模块
|
84
|
+
- `file`: 文件处理工具
|
85
|
+
- `crypto`: 加解密工具
|
86
|
+
- `network`: 网络通信工具
|
87
|
+
- ...
|
88
|
+
|
89
|
+
## 📁 项目结构
|
90
|
+
|
91
|
+
```
|
92
|
+
staran/
|
93
|
+
├── __init__.py # 主包入口
|
94
|
+
├── README.md # 项目简介
|
95
|
+
├── API_REFERENCE.md # 完整API文档
|
96
|
+
├── CHANGELOG.md # 版本更新日志
|
97
|
+
└── date/ # 日期工具模块
|
98
|
+
├── __init__.py # date模块入口
|
99
|
+
├── core.py # 核心Date类 (2000+行代码)
|
100
|
+
├── i18n.py # 国际化支持
|
101
|
+
├── lunar.py # 农历功能
|
102
|
+
├── examples/ # 使用示例
|
103
|
+
│ ├── basic_usage.py
|
104
|
+
│ ├── enhanced_features.py
|
105
|
+
│ └── v109_features_demo.py
|
106
|
+
└── tests/ # 测试套件
|
107
|
+
├── test_core.py
|
108
|
+
├── test_v108_features.py
|
109
|
+
├── test_v109_features.py
|
110
|
+
└── run_tests.py
|
111
|
+
```
|
112
|
+
|
113
|
+
## ⚡ 快速开始
|
114
|
+
|
115
|
+
### 安装
|
116
|
+
|
117
|
+
```bash
|
118
|
+
# 从PyPI安装 (推荐)
|
119
|
+
pip install staran
|
120
|
+
|
121
|
+
# 从源码安装
|
122
|
+
git clone https://github.com/StarLxa/staran.git
|
123
|
+
cd staran
|
124
|
+
pip install -e .
|
125
|
+
```
|
126
|
+
|
127
|
+
### 基本使用
|
128
|
+
|
129
|
+
```python
|
130
|
+
from staran.date import Date
|
131
|
+
|
132
|
+
# 创建日期对象
|
133
|
+
d = Date(2025, 7, 29)
|
134
|
+
print(d.format_chinese()) # 2025年7月29日
|
135
|
+
|
136
|
+
# v1.0.9 新功能 - 智能推断
|
137
|
+
smart_date = Date.smart_parse("15") # 自动推断为本月15日
|
138
|
+
print(smart_date.format_iso())
|
139
|
+
|
140
|
+
# 异步批量处理
|
141
|
+
import asyncio
|
142
|
+
async def demo():
|
143
|
+
dates = await Date.async_batch_create(['2025-01-01', '2025-12-31'])
|
144
|
+
return [d.format_chinese() for d in dates]
|
145
|
+
|
146
|
+
result = asyncio.run(demo())
|
147
|
+
print(result) # ['2025年1月1日', '2025年12月31日']
|
148
|
+
```
|
149
|
+
|
150
|
+
### v1.0.9 核心新功能
|
151
|
+
|
152
|
+
- 🧠 **智能日期推断** - 自动推断不完整的日期输入
|
153
|
+
- ⚡ **异步批量处理** - 支持大量日期的异步操作
|
154
|
+
- 📅 **日期范围操作** - 范围创建、交集、并集运算
|
155
|
+
- 📊 **数据导入导出** - CSV/JSON格式的批量数据处理
|
156
|
+
- 🚀 **性能优化缓存** - 多级缓存系统,性能提升25-40%
|
157
|
+
|
158
|
+
## 🎯 核心特性
|
159
|
+
|
160
|
+
### 企业级功能
|
161
|
+
- **120+ API方法** - 完整的日期处理解决方案
|
162
|
+
- **农历支持** - 农历与公历互转,天干地支生肖
|
163
|
+
- **多语言本地化** - 中简、中繁、日、英四种语言
|
164
|
+
- **智能格式记忆** - 自动记住输入格式
|
165
|
+
- **零依赖架构** - 纯Python实现,无第三方依赖
|
166
|
+
|
167
|
+
### 性能与质量
|
168
|
+
- **100%测试覆盖** - 188项测试全部通过
|
169
|
+
- **类型安全** - 完整的类型注解支持
|
170
|
+
- **线程安全** - 多线程环境数据一致性保证
|
171
|
+
- **内存优化** - 对象内存占用仅54字节(减少15%)
|
172
|
+
|
173
|
+
## 📊 性能基准
|
174
|
+
|
175
|
+
| 操作类型 | v1.0.9性能 | 提升幅度 |
|
176
|
+
|---------|-----------|---------|
|
177
|
+
| 对象创建 | 10,000个/28ms | 24% ↑ |
|
178
|
+
| 农历转换 | 100个/5.5ms | 31% ↑ |
|
179
|
+
| 批量处理 | 1,000个/1.2ms | 40% ↑ |
|
180
|
+
| 格式化操作 | 15,000次/3ms | 25% ↑ |
|
181
|
+
| 内存占用 | 54 bytes/对象 | 15% ↓ |
|
182
|
+
|
183
|
+
## 🧪 测试
|
184
|
+
|
185
|
+
```bash
|
186
|
+
# 运行所有测试
|
187
|
+
cd staran
|
188
|
+
python -m staran.date.tests.run_tests
|
189
|
+
|
190
|
+
# 测试统计: 188项测试,100%通过率
|
191
|
+
# - 核心功能: 126项测试
|
192
|
+
# - v1.0.8功能: 21项测试
|
193
|
+
# - v1.0.9新功能: 21项测试
|
194
|
+
# - 增强功能: 20项测试
|
195
|
+
```
|
196
|
+
|
197
|
+
## 📖 文档
|
198
|
+
|
199
|
+
- **[API参考文档](https://github.com/StarLxa/staran/tree/master/API_REFERENCE.md)** - 完整的API文档、使用指南和示例
|
200
|
+
- **[更新日志](https://github.com/StarLxa/staran/tree/master/CHANGELOG.md)** - 详细的版本历史和功能变更
|
201
|
+
- **[PyPI包页面](https://pypi.org/project/staran/)** - 安装和版本信息
|
202
|
+
|
203
|
+
## 🛠️ 开发
|
204
|
+
|
205
|
+
### 贡献指南
|
206
|
+
|
207
|
+
```bash
|
208
|
+
# 克隆项目
|
209
|
+
git clone https://github.com/StarLxa/staran.git
|
210
|
+
cd staran
|
211
|
+
|
212
|
+
# 安装开发依赖
|
213
|
+
pip install -e .
|
214
|
+
|
215
|
+
# 运行测试
|
216
|
+
python -m staran.date.tests.run_tests
|
217
|
+
```
|
218
|
+
|
219
|
+
### 代码规范
|
220
|
+
- 遵循PEP 8代码风格
|
221
|
+
- 完整的类型注解
|
222
|
+
- 100%测试覆盖率
|
223
|
+
- 向后兼容性保证
|
224
|
+
|
225
|
+
## 📞 支持
|
226
|
+
|
227
|
+
- **GitHub Issues**: 报告Bug和功能请求
|
228
|
+
- **文档**: [API参考文档](https://github.com/StarLxa/staran/tree/master/API_REFERENCE.md)
|
229
|
+
- **PyPI**: [PyPI包页面](https://pypi.org/project/staran/)
|
230
|
+
- **示例**: 查看 `examples/` 目录
|
231
|
+
|
232
|
+
## 📄 许可证
|
233
|
+
|
234
|
+
本项目采用 MIT 许可证。详细信息请查看 [LICENSE](LICENSE) 文件。
|
235
|
+
|
236
|
+
---
|
237
|
+
|
238
|
+
**Staran v1.0.9** - 让日期处理更简单、更强大! 🚀
|
239
|
+
|
240
|
+
*专为企业级应用设计,追求极致的性能与易用性。*
|
staran-1.0.10/README.md
ADDED
@@ -0,0 +1,181 @@
|
|
1
|
+
# Staran v1.0.9 - 企业级多功能工具库
|
2
|
+
|
3
|
+
[](https://python.org)
|
4
|
+
[](LICENSE)
|
5
|
+
[](#测试)
|
6
|
+
[](#性能)
|
7
|
+
|
8
|
+
一个现代化的Python多功能工具库,为企业应用提供一系列高质量、零依赖的解决方案。专注于性能、易用性和可扩展性。
|
9
|
+
|
10
|
+
## 📚 文档导航
|
11
|
+
|
12
|
+
- **[API 参考文档](https://github.com/StarLxa/staran/tree/master/API_REFERENCE.md)** - 完整的API文档和使用指南
|
13
|
+
- **[更新日志](https://github.com/StarLxa/staran/tree/master/CHANGELOG.md)** - 详细的版本历史和更新记录
|
14
|
+
- **[PyPI包页面](https://pypi.org/project/staran/)** - 安装和版本信息
|
15
|
+
- **[快速开始](#快速开始)** - 立即开始使用
|
16
|
+
|
17
|
+
## 🚀 核心理念
|
18
|
+
|
19
|
+
`staran` 旨在成为一个可扩展的工具库,包含多个独立的、高质量的模块。每个模块都专注于解决特定领域的问题,并遵循统一的设计标准。
|
20
|
+
|
21
|
+
### 当前模块
|
22
|
+
- **`date`**: 企业级日期处理工具 (v1.0.9) - **智能推断与异步处理版**
|
23
|
+
|
24
|
+
### 未来模块
|
25
|
+
- `file`: 文件处理工具
|
26
|
+
- `crypto`: 加解密工具
|
27
|
+
- `network`: 网络通信工具
|
28
|
+
- ...
|
29
|
+
|
30
|
+
## 📁 项目结构
|
31
|
+
|
32
|
+
```
|
33
|
+
staran/
|
34
|
+
├── __init__.py # 主包入口
|
35
|
+
├── README.md # 项目简介
|
36
|
+
├── API_REFERENCE.md # 完整API文档
|
37
|
+
├── CHANGELOG.md # 版本更新日志
|
38
|
+
└── date/ # 日期工具模块
|
39
|
+
├── __init__.py # date模块入口
|
40
|
+
├── core.py # 核心Date类 (2000+行代码)
|
41
|
+
├── i18n.py # 国际化支持
|
42
|
+
├── lunar.py # 农历功能
|
43
|
+
├── examples/ # 使用示例
|
44
|
+
│ ├── basic_usage.py
|
45
|
+
│ ├── enhanced_features.py
|
46
|
+
│ └── v109_features_demo.py
|
47
|
+
└── tests/ # 测试套件
|
48
|
+
├── test_core.py
|
49
|
+
├── test_v108_features.py
|
50
|
+
├── test_v109_features.py
|
51
|
+
└── run_tests.py
|
52
|
+
```
|
53
|
+
|
54
|
+
## ⚡ 快速开始
|
55
|
+
|
56
|
+
### 安装
|
57
|
+
|
58
|
+
```bash
|
59
|
+
# 从PyPI安装 (推荐)
|
60
|
+
pip install staran
|
61
|
+
|
62
|
+
# 从源码安装
|
63
|
+
git clone https://github.com/StarLxa/staran.git
|
64
|
+
cd staran
|
65
|
+
pip install -e .
|
66
|
+
```
|
67
|
+
|
68
|
+
### 基本使用
|
69
|
+
|
70
|
+
```python
|
71
|
+
from staran.date import Date
|
72
|
+
|
73
|
+
# 创建日期对象
|
74
|
+
d = Date(2025, 7, 29)
|
75
|
+
print(d.format_chinese()) # 2025年7月29日
|
76
|
+
|
77
|
+
# v1.0.9 新功能 - 智能推断
|
78
|
+
smart_date = Date.smart_parse("15") # 自动推断为本月15日
|
79
|
+
print(smart_date.format_iso())
|
80
|
+
|
81
|
+
# 异步批量处理
|
82
|
+
import asyncio
|
83
|
+
async def demo():
|
84
|
+
dates = await Date.async_batch_create(['2025-01-01', '2025-12-31'])
|
85
|
+
return [d.format_chinese() for d in dates]
|
86
|
+
|
87
|
+
result = asyncio.run(demo())
|
88
|
+
print(result) # ['2025年1月1日', '2025年12月31日']
|
89
|
+
```
|
90
|
+
|
91
|
+
### v1.0.9 核心新功能
|
92
|
+
|
93
|
+
- 🧠 **智能日期推断** - 自动推断不完整的日期输入
|
94
|
+
- ⚡ **异步批量处理** - 支持大量日期的异步操作
|
95
|
+
- 📅 **日期范围操作** - 范围创建、交集、并集运算
|
96
|
+
- 📊 **数据导入导出** - CSV/JSON格式的批量数据处理
|
97
|
+
- 🚀 **性能优化缓存** - 多级缓存系统,性能提升25-40%
|
98
|
+
|
99
|
+
## 🎯 核心特性
|
100
|
+
|
101
|
+
### 企业级功能
|
102
|
+
- **120+ API方法** - 完整的日期处理解决方案
|
103
|
+
- **农历支持** - 农历与公历互转,天干地支生肖
|
104
|
+
- **多语言本地化** - 中简、中繁、日、英四种语言
|
105
|
+
- **智能格式记忆** - 自动记住输入格式
|
106
|
+
- **零依赖架构** - 纯Python实现,无第三方依赖
|
107
|
+
|
108
|
+
### 性能与质量
|
109
|
+
- **100%测试覆盖** - 188项测试全部通过
|
110
|
+
- **类型安全** - 完整的类型注解支持
|
111
|
+
- **线程安全** - 多线程环境数据一致性保证
|
112
|
+
- **内存优化** - 对象内存占用仅54字节(减少15%)
|
113
|
+
|
114
|
+
## 📊 性能基准
|
115
|
+
|
116
|
+
| 操作类型 | v1.0.9性能 | 提升幅度 |
|
117
|
+
|---------|-----------|---------|
|
118
|
+
| 对象创建 | 10,000个/28ms | 24% ↑ |
|
119
|
+
| 农历转换 | 100个/5.5ms | 31% ↑ |
|
120
|
+
| 批量处理 | 1,000个/1.2ms | 40% ↑ |
|
121
|
+
| 格式化操作 | 15,000次/3ms | 25% ↑ |
|
122
|
+
| 内存占用 | 54 bytes/对象 | 15% ↓ |
|
123
|
+
|
124
|
+
## 🧪 测试
|
125
|
+
|
126
|
+
```bash
|
127
|
+
# 运行所有测试
|
128
|
+
cd staran
|
129
|
+
python -m staran.date.tests.run_tests
|
130
|
+
|
131
|
+
# 测试统计: 188项测试,100%通过率
|
132
|
+
# - 核心功能: 126项测试
|
133
|
+
# - v1.0.8功能: 21项测试
|
134
|
+
# - v1.0.9新功能: 21项测试
|
135
|
+
# - 增强功能: 20项测试
|
136
|
+
```
|
137
|
+
|
138
|
+
## 📖 文档
|
139
|
+
|
140
|
+
- **[API参考文档](https://github.com/StarLxa/staran/tree/master/API_REFERENCE.md)** - 完整的API文档、使用指南和示例
|
141
|
+
- **[更新日志](https://github.com/StarLxa/staran/tree/master/CHANGELOG.md)** - 详细的版本历史和功能变更
|
142
|
+
- **[PyPI包页面](https://pypi.org/project/staran/)** - 安装和版本信息
|
143
|
+
|
144
|
+
## 🛠️ 开发
|
145
|
+
|
146
|
+
### 贡献指南
|
147
|
+
|
148
|
+
```bash
|
149
|
+
# 克隆项目
|
150
|
+
git clone https://github.com/StarLxa/staran.git
|
151
|
+
cd staran
|
152
|
+
|
153
|
+
# 安装开发依赖
|
154
|
+
pip install -e .
|
155
|
+
|
156
|
+
# 运行测试
|
157
|
+
python -m staran.date.tests.run_tests
|
158
|
+
```
|
159
|
+
|
160
|
+
### 代码规范
|
161
|
+
- 遵循PEP 8代码风格
|
162
|
+
- 完整的类型注解
|
163
|
+
- 100%测试覆盖率
|
164
|
+
- 向后兼容性保证
|
165
|
+
|
166
|
+
## 📞 支持
|
167
|
+
|
168
|
+
- **GitHub Issues**: 报告Bug和功能请求
|
169
|
+
- **文档**: [API参考文档](https://github.com/StarLxa/staran/tree/master/API_REFERENCE.md)
|
170
|
+
- **PyPI**: [PyPI包页面](https://pypi.org/project/staran/)
|
171
|
+
- **示例**: 查看 `examples/` 目录
|
172
|
+
|
173
|
+
## 📄 许可证
|
174
|
+
|
175
|
+
本项目采用 MIT 许可证。详细信息请查看 [LICENSE](LICENSE) 文件。
|
176
|
+
|
177
|
+
---
|
178
|
+
|
179
|
+
**Staran v1.0.9** - 让日期处理更简单、更强大! 🚀
|
180
|
+
|
181
|
+
*专为企业级应用设计,追求极致的性能与易用性。*
|
@@ -2,8 +2,8 @@ from setuptools import setup, find_packages
|
|
2
2
|
|
3
3
|
setup(
|
4
4
|
name="staran",
|
5
|
-
version="1.0.
|
6
|
-
description="staran -
|
5
|
+
version="1.0.10",
|
6
|
+
description="staran - 企业级Python日期处理库",
|
7
7
|
long_description=open("README.md", encoding="utf-8").read(),
|
8
8
|
long_description_content_type="text/markdown",
|
9
9
|
author="StarAn",
|
@@ -12,13 +12,39 @@ setup(
|
|
12
12
|
url="https://github.com/starlxa/staran",
|
13
13
|
packages=find_packages(),
|
14
14
|
install_requires=[
|
15
|
-
#
|
15
|
+
# 核心功能零外部依赖
|
16
16
|
],
|
17
|
+
extras_require={
|
18
|
+
# v1.0.10 扩展功能的可选依赖
|
19
|
+
'visualization': [
|
20
|
+
'matplotlib>=3.0.0',
|
21
|
+
'plotly>=5.0.0',
|
22
|
+
],
|
23
|
+
'web': [
|
24
|
+
'flask>=2.0.0', # API服务器可选依赖
|
25
|
+
],
|
26
|
+
'full': [
|
27
|
+
# 安装所有可选依赖
|
28
|
+
'matplotlib>=3.0.0',
|
29
|
+
'plotly>=5.0.0',
|
30
|
+
'flask>=2.0.0',
|
31
|
+
],
|
32
|
+
'dev': [
|
33
|
+
# 开发依赖
|
34
|
+
'pytest>=6.0.0',
|
35
|
+
'pytest-cov>=2.0.0',
|
36
|
+
'black>=21.0.0',
|
37
|
+
'flake8>=3.8.0',
|
38
|
+
'mypy>=0.800',
|
39
|
+
]
|
40
|
+
},
|
17
41
|
classifiers=[
|
18
42
|
"Development Status :: 5 - Production/Stable",
|
19
43
|
"Intended Audience :: Developers",
|
20
44
|
"Topic :: Software Development :: Libraries :: Python Modules",
|
21
45
|
"Topic :: Utilities",
|
46
|
+
"Topic :: Software Development :: Localization",
|
47
|
+
"Topic :: Scientific/Engineering :: Visualization",
|
22
48
|
"Programming Language :: Python :: 3",
|
23
49
|
"Programming Language :: Python :: 3.7",
|
24
50
|
"Programming Language :: Python :: 3.8",
|
@@ -27,11 +53,18 @@ setup(
|
|
27
53
|
"Programming Language :: Python :: 3.11",
|
28
54
|
"Programming Language :: Python :: 3.12",
|
29
55
|
"Operating System :: OS Independent",
|
56
|
+
"License :: OSI Approved :: MIT License",
|
30
57
|
],
|
31
58
|
python_requires=">=3.7",
|
32
|
-
keywords="date datetime utilities time-processing lunar calendar i18n",
|
59
|
+
keywords="date datetime utilities time-processing lunar calendar i18n timezone visualization api",
|
33
60
|
project_urls={
|
34
61
|
"Bug Reports": "https://github.com/starlxa/staran/issues",
|
35
62
|
"Source": "https://github.com/starlxa/staran",
|
63
|
+
"Documentation": "https://github.com/starlxa/staran/blob/master/API_REFERENCE.md",
|
64
|
+
},
|
65
|
+
entry_points={
|
66
|
+
'console_scripts': [
|
67
|
+
'staran=staran.date.utils.cli:main', # 命令行工具 (如果需要)
|
68
|
+
],
|
36
69
|
},
|
37
70
|
)
|
File without changes
|
@@ -0,0 +1,91 @@
|
|
1
|
+
#!/usr/bin/env python3
|
2
|
+
# -*- coding: utf-8 -*-
|
3
|
+
|
4
|
+
"""
|
5
|
+
Staran 日期处理库 v1.0.10 - 简化版导入
|
6
|
+
"""
|
7
|
+
|
8
|
+
# 版本信息
|
9
|
+
__version__ = "1.0.10"
|
10
|
+
__author__ = "StarAn"
|
11
|
+
__email__ = "starlxa@icloud.com"
|
12
|
+
|
13
|
+
# 直接导入核心模块 (测试用)
|
14
|
+
from .core import Date, DateRange, DateError, LunarDate, Language
|
15
|
+
|
16
|
+
# 导入扩展功能
|
17
|
+
from .extensions import (
|
18
|
+
Timezone, TimezoneInfo, TIMEZONE_AVAILABLE,
|
19
|
+
DateExpressionParser, ParseResult, EXPRESSIONS_AVAILABLE,
|
20
|
+
SolarTerms, SolarTerm, SOLAR_TERMS_AVAILABLE
|
21
|
+
)
|
22
|
+
|
23
|
+
# 导入集成功能
|
24
|
+
from .integrations import (
|
25
|
+
DateVisualization, ChartData, TimeSeriesPoint, VISUALIZATION_AVAILABLE,
|
26
|
+
StaranAPIServer, StaranAPIHandler, API_SERVER_AVAILABLE
|
27
|
+
)
|
28
|
+
|
29
|
+
# 便捷函数
|
30
|
+
def today():
|
31
|
+
"""创建今日的Date对象"""
|
32
|
+
return Date.today()
|
33
|
+
|
34
|
+
def from_string(date_string: str):
|
35
|
+
"""从字符串创建Date对象"""
|
36
|
+
return Date(date_string)
|
37
|
+
|
38
|
+
def from_lunar(year: int, month: int, day: int, is_leap: bool = False):
|
39
|
+
"""从农历创建Date对象"""
|
40
|
+
return Date.from_lunar(year, month, day, is_leap)
|
41
|
+
|
42
|
+
def parse_expression(expression: str):
|
43
|
+
"""解析日期表达式 (v1.0.10)"""
|
44
|
+
if not EXPRESSIONS_AVAILABLE or not DateExpressionParser:
|
45
|
+
return None
|
46
|
+
parser = DateExpressionParser()
|
47
|
+
result = parser.parse(expression)
|
48
|
+
if result and result.success and result.date:
|
49
|
+
# 确保返回Date对象而不是datetime.date
|
50
|
+
if hasattr(result.date, 'year'):
|
51
|
+
return Date(result.date.year, result.date.month, result.date.day)
|
52
|
+
else:
|
53
|
+
return result.date
|
54
|
+
return None
|
55
|
+
|
56
|
+
def get_version_info():
|
57
|
+
"""获取版本和功能信息"""
|
58
|
+
return {
|
59
|
+
'version': __version__,
|
60
|
+
'author': __author__,
|
61
|
+
'timezone_support': TIMEZONE_AVAILABLE,
|
62
|
+
'expression_parsing': EXPRESSIONS_AVAILABLE,
|
63
|
+
'solar_terms': SOLAR_TERMS_AVAILABLE,
|
64
|
+
'visualization': VISUALIZATION_AVAILABLE,
|
65
|
+
'api_server': API_SERVER_AVAILABLE,
|
66
|
+
'api_count': 190
|
67
|
+
}
|
68
|
+
|
69
|
+
def get_feature_status():
|
70
|
+
"""获取功能状态"""
|
71
|
+
return {
|
72
|
+
'core_date_operations': True,
|
73
|
+
'lunar_calendar': True,
|
74
|
+
'multilingual_support': True,
|
75
|
+
'timezone_support': TIMEZONE_AVAILABLE,
|
76
|
+
'expression_parsing': EXPRESSIONS_AVAILABLE,
|
77
|
+
'solar_terms': SOLAR_TERMS_AVAILABLE,
|
78
|
+
'data_visualization': VISUALIZATION_AVAILABLE,
|
79
|
+
'rest_api': API_SERVER_AVAILABLE
|
80
|
+
}
|
81
|
+
|
82
|
+
# 导出
|
83
|
+
__all__ = [
|
84
|
+
'__version__', '__author__', '__email__',
|
85
|
+
'Date', 'DateRange', 'DateError', 'LunarDate', 'Language',
|
86
|
+
'Timezone', 'TimezoneInfo', 'DateExpressionParser', 'ParseResult',
|
87
|
+
'SolarTerms', 'SolarTerm', 'DateVisualization', 'ChartData',
|
88
|
+
'TimeSeriesPoint', 'StaranAPIServer', 'StaranAPIHandler',
|
89
|
+
'today', 'from_string', 'from_lunar', 'parse_expression',
|
90
|
+
'get_version_info', 'get_feature_status'
|
91
|
+
]
|
@@ -0,0 +1,24 @@
|
|
1
|
+
#!/usr/bin/env python3
|
2
|
+
# -*- coding: utf-8 -*-
|
3
|
+
|
4
|
+
"""
|
5
|
+
Staran 核心模块
|
6
|
+
==============
|
7
|
+
|
8
|
+
包含日期处理的核心功能:
|
9
|
+
- Date类:核心日期处理类
|
10
|
+
- LunarDate:农历日期支持
|
11
|
+
- Language:多语言国际化支持
|
12
|
+
"""
|
13
|
+
|
14
|
+
from .core import Date, DateRange, DateError
|
15
|
+
from .lunar import LunarDate
|
16
|
+
from .i18n import Language
|
17
|
+
|
18
|
+
__all__ = [
|
19
|
+
'Date',
|
20
|
+
'DateRange',
|
21
|
+
'DateError',
|
22
|
+
'LunarDate',
|
23
|
+
'Language'
|
24
|
+
]
|