staran 0.1.0__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-0.1.0/._LICENSE ADDED
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
staran-0.1.0/._tools ADDED
Binary file
staran-0.1.0/LICENSE ADDED
@@ -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.
staran-0.1.0/PKG-INFO ADDED
@@ -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
staran-0.1.0/README.md ADDED
@@ -0,0 +1 @@
1
+ ## STARAN TOOL
staran-0.1.0/setup.cfg ADDED
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
staran-0.1.0/setup.py ADDED
@@ -0,0 +1,22 @@
1
+ from setuptools import setup, find_packages
2
+
3
+ setup(
4
+ name='staran',
5
+ version='0.1.0',
6
+ description='A short description of your package',
7
+ long_description=open('README.md', encoding='utf-8').read(),
8
+ long_description_content_type='text/markdown',
9
+ author='StarAn',
10
+ author_email='starlxa@icloud.com',
11
+ url='https://github.com/starlxa/staran',
12
+ packages=find_packages(),
13
+ install_requires=[
14
+ 'numpy>=1.20',
15
+ 'pandas'
16
+ ],
17
+ classifiers=[
18
+ 'Programming Language :: Python :: 3',
19
+ 'License :: OSI Approved :: MIT License',
20
+ ],
21
+ python_requires='>=3.7',
22
+ )
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,18 @@
1
+ LICENSE
2
+ README.md
3
+ setup.py
4
+ staran.egg-info/._PKG-INFO
5
+ staran.egg-info/._SOURCES.txt
6
+ staran.egg-info/._dependency_links.txt
7
+ staran.egg-info/._requires.txt
8
+ staran.egg-info/._top_level.txt
9
+ staran.egg-info/PKG-INFO
10
+ staran.egg-info/SOURCES.txt
11
+ staran.egg-info/dependency_links.txt
12
+ staran.egg-info/requires.txt
13
+ staran.egg-info/top_level.txt
14
+ tools/__init__.py
15
+ tools/date/__init__.py
16
+ tools/date/build_simple.py
17
+ tools/date/date.py
18
+ tools/date/platform_utils.py
@@ -0,0 +1,2 @@
1
+ numpy>=1.20
2
+ pandas
@@ -0,0 +1 @@
1
+ tools
Binary file
Binary file
@@ -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实现'}")
Binary file
Binary file
@@ -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)