staran 0.1.0__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.
- ._staran-0.1.0.dist-info +0 -0
- ._tools +0 -0
- staran-0.1.0.dist-info/._METADATA +0 -0
- staran-0.1.0.dist-info/._PKG-INFO +0 -0
- staran-0.1.0.dist-info/._SOURCES.txt +0 -0
- staran-0.1.0.dist-info/._WHEEL +0 -0
- staran-0.1.0.dist-info/._licenses +0 -0
- staran-0.1.0.dist-info/._requires.txt +0 -0
- staran-0.1.0.dist-info/._top_level.txt +0 -0
- staran-0.1.0.dist-info/METADATA +26 -0
- staran-0.1.0.dist-info/RECORD +26 -0
- staran-0.1.0.dist-info/WHEEL +5 -0
- staran-0.1.0.dist-info/licenses/._LICENSE +0 -0
- staran-0.1.0.dist-info/licenses/LICENSE +25 -0
- staran-0.1.0.dist-info/top_level.txt +1 -0
- tools/.___init__.py +0 -0
- tools/._date +0 -0
- tools/__init__.py +70 -0
- tools/date/.___init__.py +0 -0
- tools/date/._build_simple.py +0 -0
- tools/date/._date.py +0 -0
- tools/date/._platform_utils.py +0 -0
- tools/date/__init__.py +60 -0
- tools/date/build_simple.py +109 -0
- tools/date/date.py +857 -0
- tools/date/platform_utils.py +189 -0
._staran-0.1.0.dist-info
ADDED
Binary file
|
._tools
ADDED
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,26 @@
|
|
1
|
+
Metadata-Version: 2.4
|
2
|
+
Name: staran
|
3
|
+
Version: 0.1.0
|
4
|
+
Summary: A short description of your package
|
5
|
+
Home-page: https://github.com/starlxa/staran
|
6
|
+
Author: StarAn
|
7
|
+
Author-email: starlxa@icloud.com
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
10
|
+
Requires-Python: >=3.7
|
11
|
+
Description-Content-Type: text/markdown
|
12
|
+
License-File: LICENSE
|
13
|
+
Requires-Dist: numpy>=1.20
|
14
|
+
Requires-Dist: pandas
|
15
|
+
Dynamic: author
|
16
|
+
Dynamic: author-email
|
17
|
+
Dynamic: classifier
|
18
|
+
Dynamic: description
|
19
|
+
Dynamic: description-content-type
|
20
|
+
Dynamic: home-page
|
21
|
+
Dynamic: license-file
|
22
|
+
Dynamic: requires-dist
|
23
|
+
Dynamic: requires-python
|
24
|
+
Dynamic: summary
|
25
|
+
|
26
|
+
## STARAN TOOL
|
@@ -0,0 +1,26 @@
|
|
1
|
+
._staran-0.1.0.dist-info,sha256=3_uwfdZqkY0vpvvPcxyU7-uCuMfSkGWarTVY5AY-mtg,4096
|
2
|
+
._tools,sha256=3_uwfdZqkY0vpvvPcxyU7-uCuMfSkGWarTVY5AY-mtg,4096
|
3
|
+
staran-0.1.0.dist-info/licenses/._LICENSE,sha256=3_uwfdZqkY0vpvvPcxyU7-uCuMfSkGWarTVY5AY-mtg,4096
|
4
|
+
staran-0.1.0.dist-info/licenses/LICENSE,sha256=2EmsBIyDCono4iVXNpv5_px9qt2b7hfPq1WuyGVMNP4,1361
|
5
|
+
tools/.___init__.py,sha256=3_uwfdZqkY0vpvvPcxyU7-uCuMfSkGWarTVY5AY-mtg,4096
|
6
|
+
tools/._date,sha256=3_uwfdZqkY0vpvvPcxyU7-uCuMfSkGWarTVY5AY-mtg,4096
|
7
|
+
tools/__init__.py,sha256=EfuYgERy0MGLzOrniACgZFc4r_ODDcMl9FAvl0h5b_8,1451
|
8
|
+
tools/date/.___init__.py,sha256=3_uwfdZqkY0vpvvPcxyU7-uCuMfSkGWarTVY5AY-mtg,4096
|
9
|
+
tools/date/._build_simple.py,sha256=3_uwfdZqkY0vpvvPcxyU7-uCuMfSkGWarTVY5AY-mtg,4096
|
10
|
+
tools/date/._date.py,sha256=3_uwfdZqkY0vpvvPcxyU7-uCuMfSkGWarTVY5AY-mtg,4096
|
11
|
+
tools/date/._platform_utils.py,sha256=3_uwfdZqkY0vpvvPcxyU7-uCuMfSkGWarTVY5AY-mtg,4096
|
12
|
+
tools/date/__init__.py,sha256=pC-SxWTrimjy2cSzwm-zkcV2b3Kg3zqWkJrNaehFXjA,1370
|
13
|
+
tools/date/build_simple.py,sha256=ImbpceY3DRY4mAodJtN8RazmVAlhZ5_Lly-dujIa_qs,3006
|
14
|
+
tools/date/date.py,sha256=-T_8NSUyEb5Ww3wHeM6h9BvWP7djzZk3NdryYqpz4uE,28552
|
15
|
+
tools/date/platform_utils.py,sha256=FVQ_YT4J_EG80pwHFnJn1Ijgc-VYBZJMQq9tT41WS0w,6911
|
16
|
+
staran-0.1.0.dist-info/._METADATA,sha256=3_uwfdZqkY0vpvvPcxyU7-uCuMfSkGWarTVY5AY-mtg,4096
|
17
|
+
staran-0.1.0.dist-info/._PKG-INFO,sha256=3_uwfdZqkY0vpvvPcxyU7-uCuMfSkGWarTVY5AY-mtg,4096
|
18
|
+
staran-0.1.0.dist-info/._SOURCES.txt,sha256=3_uwfdZqkY0vpvvPcxyU7-uCuMfSkGWarTVY5AY-mtg,4096
|
19
|
+
staran-0.1.0.dist-info/._WHEEL,sha256=3_uwfdZqkY0vpvvPcxyU7-uCuMfSkGWarTVY5AY-mtg,4096
|
20
|
+
staran-0.1.0.dist-info/._licenses,sha256=3_uwfdZqkY0vpvvPcxyU7-uCuMfSkGWarTVY5AY-mtg,4096
|
21
|
+
staran-0.1.0.dist-info/._requires.txt,sha256=3_uwfdZqkY0vpvvPcxyU7-uCuMfSkGWarTVY5AY-mtg,4096
|
22
|
+
staran-0.1.0.dist-info/._top_level.txt,sha256=3_uwfdZqkY0vpvvPcxyU7-uCuMfSkGWarTVY5AY-mtg,4096
|
23
|
+
staran-0.1.0.dist-info/METADATA,sha256=hy7Zw4GbAqRX2nOMjSI5bxOCzDIyXASZ-TkeIAjGMOQ,656
|
24
|
+
staran-0.1.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
25
|
+
staran-0.1.0.dist-info/top_level.txt,sha256=Ib4ZA2MPBpiT0tC-0qt5RcP9g42gLddRbx9PiYGa-Fc,6
|
26
|
+
staran-0.1.0.dist-info/RECORD,,
|
Binary file
|
@@ -0,0 +1,25 @@
|
|
1
|
+
Copyright (c) 2025 Lu XingAn
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
of this software and associated documentation files (the "Software"), to use,
|
5
|
+
copy, modify, and distribute the Software for **non-commercial** purposes only,
|
6
|
+
subject to the following conditions:
|
7
|
+
|
8
|
+
1. **Attribution** must be given to the original author. Any use or distribution
|
9
|
+
must include proper credit to the original author, including name and a link
|
10
|
+
to the original project repository (if available).
|
11
|
+
|
12
|
+
2. **Non-Commercial Use Only**: The Software may not be used, copied, modified,
|
13
|
+
or distributed for commercial purposes. Commercial use includes, but is not
|
14
|
+
limited to, any use for commercial advantage, monetary gain, or in a product
|
15
|
+
or service that is sold or offered for a fee.
|
16
|
+
|
17
|
+
3. **No Warranty**: The Software is provided "as is", without warranty of any
|
18
|
+
kind, express or implied, including but not limited to the warranties of
|
19
|
+
merchantability, fitness for a particular purpose and noninfringement. In no
|
20
|
+
event shall the authors or copyright holders be liable for any claim, damages
|
21
|
+
or other liability, whether in an action of contract, tort or otherwise,
|
22
|
+
arising from, out of or in connection with the Software or the use or other
|
23
|
+
dealings in the Software.
|
24
|
+
|
25
|
+
By using this software, you agree to the terms above.
|
@@ -0,0 +1 @@
|
|
1
|
+
tools
|
tools/.___init__.py
ADDED
Binary file
|
tools/._date
ADDED
Binary file
|
tools/__init__.py
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
#!/usr/bin/env python3
|
2
|
+
# -*- coding: utf-8 -*-
|
3
|
+
|
4
|
+
"""
|
5
|
+
Staran Tools - 高性能工具集合
|
6
|
+
包含日期处理等各种实用工具
|
7
|
+
"""
|
8
|
+
|
9
|
+
# 导入date模块的主要类和函数
|
10
|
+
from .date import (
|
11
|
+
Date,
|
12
|
+
get_today,
|
13
|
+
date_to_timestamp,
|
14
|
+
days_between,
|
15
|
+
is_leap_year_c,
|
16
|
+
has_c_extension,
|
17
|
+
get_platform_info,
|
18
|
+
PlatformDateUtils,
|
19
|
+
create_date,
|
20
|
+
today,
|
21
|
+
from_string,
|
22
|
+
from_timestamp
|
23
|
+
)
|
24
|
+
|
25
|
+
# 为了向后兼容,也可以通过time模块访问
|
26
|
+
from . import date as date_module
|
27
|
+
|
28
|
+
# 主要导出
|
29
|
+
__all__ = [
|
30
|
+
# 核心类
|
31
|
+
'Date',
|
32
|
+
'PlatformDateUtils',
|
33
|
+
|
34
|
+
# 核心函数
|
35
|
+
'get_today',
|
36
|
+
'date_to_timestamp',
|
37
|
+
'days_between',
|
38
|
+
'is_leap_year_c',
|
39
|
+
'has_c_extension',
|
40
|
+
'get_platform_info',
|
41
|
+
|
42
|
+
# 便捷函数
|
43
|
+
'create_date',
|
44
|
+
'today',
|
45
|
+
'from_string',
|
46
|
+
'from_timestamp',
|
47
|
+
|
48
|
+
# 子模块
|
49
|
+
'date_module'
|
50
|
+
]
|
51
|
+
|
52
|
+
# 模块信息
|
53
|
+
__version__ = '1.0.0'
|
54
|
+
__author__ = 'Staran Team'
|
55
|
+
__description__ = 'Staran high-performance tools collection'
|
56
|
+
|
57
|
+
# 模块级便捷函数
|
58
|
+
def get_module_info():
|
59
|
+
"""获取tools模块信息"""
|
60
|
+
return {
|
61
|
+
'version': __version__,
|
62
|
+
'author': __author__,
|
63
|
+
'description': __description__,
|
64
|
+
'available_modules': ['date'],
|
65
|
+
'date_c_extension': has_c_extension()
|
66
|
+
}
|
67
|
+
|
68
|
+
# 显示加载信息
|
69
|
+
print(f"🚀 Staran Tools v{__version__} 已加载")
|
70
|
+
print(f" 📅 Date模块: {'C扩展' if has_c_extension() else 'Python实现'}")
|
tools/date/.___init__.py
ADDED
Binary file
|
Binary file
|
tools/date/._date.py
ADDED
Binary file
|
Binary file
|
tools/date/__init__.py
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
#!/usr/bin/env python3
|
2
|
+
# -*- coding: utf-8 -*-
|
3
|
+
|
4
|
+
"""
|
5
|
+
Date模块 - 高性能日期处理工具
|
6
|
+
支持C扩展加速和跨平台兼容
|
7
|
+
"""
|
8
|
+
|
9
|
+
from .date import Date
|
10
|
+
from .platform_utils import (
|
11
|
+
get_today,
|
12
|
+
date_to_timestamp,
|
13
|
+
days_between,
|
14
|
+
is_leap_year_c,
|
15
|
+
has_c_extension,
|
16
|
+
get_platform_info,
|
17
|
+
PlatformDateUtils
|
18
|
+
)
|
19
|
+
|
20
|
+
# 导出主要类和函数
|
21
|
+
__all__ = [
|
22
|
+
'Date',
|
23
|
+
'get_today',
|
24
|
+
'date_to_timestamp',
|
25
|
+
'days_between',
|
26
|
+
'is_leap_year_c',
|
27
|
+
'has_c_extension',
|
28
|
+
'get_platform_info',
|
29
|
+
'PlatformDateUtils'
|
30
|
+
]
|
31
|
+
|
32
|
+
# 模块信息
|
33
|
+
__version__ = '1.0.0'
|
34
|
+
__author__ = 'Staran Team'
|
35
|
+
__description__ = 'High-performance date processing with C extension support'
|
36
|
+
|
37
|
+
# 便捷访问
|
38
|
+
def create_date(*args, **kwargs):
|
39
|
+
"""便捷的日期创建函数"""
|
40
|
+
return Date(*args, **kwargs)
|
41
|
+
|
42
|
+
def today():
|
43
|
+
"""快速获取今日日期"""
|
44
|
+
return Date()
|
45
|
+
|
46
|
+
def from_string(date_string):
|
47
|
+
"""从字符串创建日期"""
|
48
|
+
return Date(date_string)
|
49
|
+
|
50
|
+
def from_timestamp(timestamp):
|
51
|
+
"""从时间戳创建日期(需要先实现该功能)"""
|
52
|
+
import datetime
|
53
|
+
dt = datetime.datetime.fromtimestamp(timestamp)
|
54
|
+
return Date(dt.year, dt.month, dt.day)
|
55
|
+
|
56
|
+
# 检查C扩展状态并显示信息
|
57
|
+
if has_c_extension():
|
58
|
+
print("✅ Date模块已加载,C扩展可用")
|
59
|
+
else:
|
60
|
+
print("⚠️ Date模块已加载,使用Python备用实现")
|
@@ -0,0 +1,109 @@
|
|
1
|
+
#!/usr/bin/env python3
|
2
|
+
# -*- coding: utf-8 -*-
|
3
|
+
|
4
|
+
"""
|
5
|
+
简化的C扩展编译脚本
|
6
|
+
使用Python的setuptools来处理复杂的链接问题
|
7
|
+
"""
|
8
|
+
|
9
|
+
from setuptools import setup, Extension
|
10
|
+
import platform
|
11
|
+
import os
|
12
|
+
import sys
|
13
|
+
|
14
|
+
def get_extension_name():
|
15
|
+
"""获取平台特定的扩展名"""
|
16
|
+
system = platform.system().lower()
|
17
|
+
if system == 'darwin':
|
18
|
+
return 'date_utils_macos'
|
19
|
+
elif system == 'linux':
|
20
|
+
return 'date_utils_linux'
|
21
|
+
elif system == 'windows':
|
22
|
+
return 'date_utils_windows'
|
23
|
+
else:
|
24
|
+
return 'date_utils'
|
25
|
+
|
26
|
+
def main():
|
27
|
+
print(f"🔨 Python setuptools 编译器")
|
28
|
+
print(f"平台: {platform.system()} {platform.machine()}")
|
29
|
+
print(f"Python: {platform.python_version()}")
|
30
|
+
|
31
|
+
extension_name = get_extension_name()
|
32
|
+
print(f"目标模块: {extension_name}")
|
33
|
+
|
34
|
+
# 定义扩展
|
35
|
+
extension = Extension(
|
36
|
+
extension_name,
|
37
|
+
sources=['date_utils.c'],
|
38
|
+
extra_compile_args=['-O3', '-std=c99'] if platform.system() != 'Windows' else ['/O2'],
|
39
|
+
)
|
40
|
+
|
41
|
+
# 编译
|
42
|
+
setup(
|
43
|
+
name=extension_name,
|
44
|
+
version='1.0.0',
|
45
|
+
ext_modules=[extension],
|
46
|
+
zip_safe=False,
|
47
|
+
script_args=['build_ext', '--inplace']
|
48
|
+
)
|
49
|
+
|
50
|
+
# 检查编译结果
|
51
|
+
expected_files = []
|
52
|
+
if platform.system() == 'Windows':
|
53
|
+
expected_files.append(f'{extension_name}.pyd')
|
54
|
+
else:
|
55
|
+
expected_files.extend([
|
56
|
+
f'{extension_name}.so',
|
57
|
+
f'{extension_name}.cpython-*.so'
|
58
|
+
])
|
59
|
+
|
60
|
+
print(f"\n🔍 检查编译结果...")
|
61
|
+
found_file = None
|
62
|
+
for pattern in expected_files:
|
63
|
+
if '*' in pattern:
|
64
|
+
import glob
|
65
|
+
matches = glob.glob(pattern)
|
66
|
+
if matches:
|
67
|
+
found_file = matches[0]
|
68
|
+
break
|
69
|
+
elif os.path.exists(pattern):
|
70
|
+
found_file = pattern
|
71
|
+
break
|
72
|
+
|
73
|
+
if found_file:
|
74
|
+
print(f"✅ 编译成功: {found_file}")
|
75
|
+
|
76
|
+
# 快速测试
|
77
|
+
print(f"🧪 快速测试...")
|
78
|
+
try:
|
79
|
+
# 临时添加当前目录到路径
|
80
|
+
if '.' not in sys.path:
|
81
|
+
sys.path.insert(0, '.')
|
82
|
+
|
83
|
+
module = __import__(extension_name)
|
84
|
+
print(f"✅ 模块导入成功")
|
85
|
+
|
86
|
+
# 测试基本功能
|
87
|
+
today = module.get_today()
|
88
|
+
print(f"当前日期: {today}")
|
89
|
+
|
90
|
+
timestamp = module.date_to_timestamp(2024, 6, 15)
|
91
|
+
print(f"时间戳测试: {timestamp}")
|
92
|
+
|
93
|
+
platform_info = module.get_platform_info()
|
94
|
+
print(f"平台信息: {platform_info}")
|
95
|
+
|
96
|
+
print(f"🎉 所有测试通过!")
|
97
|
+
|
98
|
+
except Exception as e:
|
99
|
+
print(f"❌ 测试失败: {e}")
|
100
|
+
return False
|
101
|
+
else:
|
102
|
+
print(f"❌ 编译失败:找不到输出文件")
|
103
|
+
return False
|
104
|
+
|
105
|
+
return True
|
106
|
+
|
107
|
+
if __name__ == '__main__':
|
108
|
+
success = main()
|
109
|
+
sys.exit(0 if success else 1)
|