Metadata-Version: 2.4
Name: train-notifier
Version: 1.0.1
Summary: 训练任务邮件通知工具，支持模板和系统信息自动附带
Author-email: hjz <1912285210@qq.com>
License: MIT
Project-URL: Homepage, https://github.com/hjz/train-notifier
Keywords: notifier,email,training,machine-learning
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Software Development :: Libraries
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: apprise>=1.0.0
Requires-Dist: python-dotenv>=0.19.0
Dynamic: license-file

# train-notifier

训练任务邮件通知工具，支持模板和系统信息自动附带。

## 安装

```bash
pip install train-notifier
```

## 快速使用

### 1. 创建 `.env` 文件

```env
SMTP_SERVER=smtp.qq.com
SMTP_PORT=465
SMTP_USER=你的邮箱@qq.com
SMTP_PASS=你的授权码
RECV_EMAIL=收件邮箱@qq.com
```

### 2. 代码调用

```python
from notifier import Notifier

n = Notifier()

# 自定义通知
n.notify(title="标题", body="内容")

# 训练完成（无参数）
n.train_done()

# 训练出错
n.train_error(message="CUDA out of memory")

# Epoch 进度
n.epoch_done(epoch=3, total=10, loss=0.0234)

# 任务完成
n.task_done(task_name="数据预处理")

# 自定义提醒
n.alert(message="GPU 温度过高！")
```

## 函数列表

| 函数 | 参数 | 说明 |
|------|------|------|
| `notify(title, body)` | 标题, 内容 | 自定义通知 |
| `train_done()` | 无 | 训练完成 |
| `train_error(message)` | 错误信息 | 训练出错 |
| `epoch_done(epoch, total, loss)` | 轮数, 总轮数, 损失值 | Epoch 完成 |
| `task_done(task_name)` | 任务名称 | 任务完成 |
| `alert(message)` | 提醒内容 | 自定义提醒 |

## 邮件样式

每封邮件包含：
- 紫色渐变头部
- 称呼：尊敬的训练师
- 内容区（左侧色条高亮）
- 系统信息（时间、主机、系统、Python 版本）

## 许可证

MIT
