HLMagix toolset including calculator, models and utilities
Project description
HLMagix
一个功能丰富的 Python 工具集,包含命令行计算器、业务模型和通用工具库。
组件
- 命令行计算器: 提供强大的计算功能 (
hlcalculator包) - 业务模型: 数据结构和业务逻辑 (
models包) - 工具库: 通用数学和字符串操作 (
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 utils.math_utils import calculate_factorial
from utils.string_utils import format_number
result = calculate_factorial(5)
formatted = format_number(result)
# 使用模型
from models.product import Product
from models.user import User
product = Product(name="Example", price=100)
user = User(name="John Doe")
项目结构
hlmagix/
├── 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.3.0.tar.gz
(10.2 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.3.0-py3-none-any.whl
(12.1 kB
view details)
File details
Details for the file hlmagix-0.3.0.tar.gz.
File metadata
- Download URL: hlmagix-0.3.0.tar.gz
- Upload date:
- Size: 10.2 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 |
5166d2230b531ebc77ac62dee9d43d0e9bedb4ec6b1acb5d84764683f993e79b
|
|
| MD5 |
0e3e3afa26e72d626ea55cb4adf2266a
|
|
| BLAKE2b-256 |
3b8ced3e67e358206805b71bd2088888bc513a0698dad1e2db1cad361e76fef4
|
File details
Details for the file hlmagix-0.3.0-py3-none-any.whl.
File metadata
- Download URL: hlmagix-0.3.0-py3-none-any.whl
- Upload date:
- Size: 12.1 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 |
50ee1dd8334b873c17e6597f920e2963e567aa4b6974ffb0e784b31d173daaa6
|
|
| MD5 |
0382b86b983484961496265f55d1f513
|
|
| BLAKE2b-256 |
80af94ff0d43b219dc7c6b09ce1f294c0e231725e5ba32c41c1bfe0aec9e7771
|