HLMagix toolset including calculator, models and utilities
Project description
HLMagix
一个功能丰富的 Python 工具集,包含命令行计算器、业务模型和通用工具库。
组件
- 命令行计算器: 提供强大的计算功能 (
hlmagix.hlcalculator) - 业务模型: 数据结构和业务逻辑 (
hlmagix.models) - 工具库: 通用数学和字符串操作 (
hlmagix.utils)
功能特性
-
基础算术运算:
- 加法 (+)
- 减法 (-)
- 乘法 (*)
- 除法 (/)
- 幂运算 (^)
-
科学计算:
- 平方根 (sqrt)
- 对数 (log)
- 三角函数 (sin, cos, tan)
- 阶乘
-
数学常数:
- π (pi)
- e
- τ (tau)
安装
使用 pip:
pip install hlmagix
使用 Poetry:
poetry add hlmagix
使用方法
命令行计算器
hlcal calc 5 + 3 # 加法: 8.0
hlcal calc 10 - 4 # 减法: 6.0
hlcal calc 3 '*' 4 # 乘法: 12.0 (注意: * 需要引号)
hlcal calc 15 / 3 # 除法: 5.0
hlcal calc 2 ^ 3 # 幂运算: 8.0
# 科学计算
hlcal calc 16 sqrt # 平方根: 4.0
hlcal calc 100 log 10 # 对数: 2.0
hlcal calc 0.5 sin # 正弦: 0.479
# 数学常数
hlcal const pi # π: 3.141592653589793
hlcal const e # e: 2.718281828459045
使用模型和工具库
# 使用工具函数
from hlmagix.utils.math_utils import calculate_factorial
from hlmagix.utils.string_utils import format_number
result = calculate_factorial(5)
formatted = format_number(result)
# 使用模型
from hlmagix.models.product import Product
from hlmagix.models.user import User
product = Product(name="Example", price=100)
user = User(name="John Doe")
# 或者使用导入包
import hlmagix
result = hlmagix.utils.math_utils.calculate_factorial(5)
product = hlmagix.models.product.Product(name="Example", price=100)
项目结构
hlmagix/
├── __init__.py # 包初始化,导出所有子模块
├── hlcalculator/ # 命令行计算器实现
│ ├── __init__.py
│ ├── cli.py # 命令行接口
│ ├── calculator.py
│ └── parser.py
├── models/ # 业务模型
│ ├── __init__.py
│ ├── product.py
│ └── user.py
└── utils/ # 工具函数
├── __init__.py
├── math_utils.py
└── string_utils.py
开发指南
环境要求
- Python 3.12 或更高版本
- Poetry 依赖管理工具
设置开发环境
- 克隆仓库
git clone https://github.com/hailv/hlmagix.git
cd hlmagix
- 安装依赖
poetry install
- 激活虚拟环境
poetry shell
代码质量工具
项目使用多个代码质量工具:
- black: 代码格式化
- flake8: 代码风格检查
- mypy: 静态类型检查
- isort: 导入排序
运行所有检查:
poetry run black .
poetry run flake8 .
poetry run mypy .
poetry run isort .
许可证
本项目基于 MIT 许可证 - 详见 LICENSE 文件
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
hlmagix-0.4.1.tar.gz
(10.4 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
hlmagix-0.4.1-py3-none-any.whl
(12.6 kB
view details)
File details
Details for the file hlmagix-0.4.1.tar.gz.
File metadata
- Download URL: hlmagix-0.4.1.tar.gz
- Upload date:
- Size: 10.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.5 CPython/3.12.9 Darwin/24.4.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6feb5239bd65730b01c8658ea64618717638d13ef2e11c937da0a1b64bf55c9a
|
|
| MD5 |
55d431c0181df2c71bb00fd14983c01e
|
|
| BLAKE2b-256 |
c87c0086e5b4d35b9c51436b47c433b770d44fbc48e8fb667a482b029f556a03
|
File details
Details for the file hlmagix-0.4.1-py3-none-any.whl.
File metadata
- Download URL: hlmagix-0.4.1-py3-none-any.whl
- Upload date:
- Size: 12.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.5 CPython/3.12.9 Darwin/24.4.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6bcd89dd688df1163e493906b5add69ffebb47638cc1fdd987413daf654894ab
|
|
| MD5 |
264c83f8cd65f8a953e79e9a1ad709f7
|
|
| BLAKE2b-256 |
c967b8dcbd51a6896abc543842670df47e67245d6bbfb01839a1c7b9a86b4e52
|