Metadata-Version: 2.3
Name: seerapi-models
Version: 1.0.2
Summary: SeerAPI 数据模型/ORM 定义
Keywords: seerapi,models,orm
Author: Nattsu39
Author-email: Nattsu39 <Nattsu39@outlook.com>
License: MIT License
         
         Copyright (c) 2025 SeerAPI
         
         Permission is hereby granted, free of charge, to any person obtaining a copy
         of this software and associated documentation files (the "Software"), to deal
         in the Software without restriction, including without limitation the rights
         to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
         copies of the Software, and to permit persons to whom the Software is
         furnished to do so, subject to the following conditions:
         
         The above copyright notice and this permission notice shall be included in all
         copies or substantial portions of the Software.
         
         THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
         IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
         FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
         AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
         LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
         OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
         SOFTWARE.
Classifier: Operating System :: OS Independent
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Requires-Dist: sqlmodel>=0.0.27
Requires-Python: >=3.10
Project-URL: Homepage, https://github.com/SeerAPI/seerapi-models
Project-URL: Repository, https://github.com/SeerAPI/seerapi-models
Description-Content-Type: text/markdown

# seerapi-models

SeerAPI 数据模型/ORM 定义，用于前后端开发。

## 安装
使用 uv：

```bash
uv add seerapi-models
```
或者使用 pip：

```bash
pip install seerapi-models
```
也可以使用其他包管理器，如 poetry 等。

## 使用

```python
from seerapi_models import Item, ItemORM, ItemCategory, ResourceRef

category_ref = ResourceRef.from_model(ItemCategory, id=1) # 定义物品分类字段引用
item = Item(
    id=1,
    name="Item 1",
    max=100,
    category=catgeory_ref
)

print(item.name)

assert isinstance(item.to_orm(), ItemORM) # 转换为 ORM 模型
```

## 开发环境部署

### 使用 uv 部署

1. **安装 uv**
   ```bash
   # macOS/Linux
   curl -LsSf https://astral.sh/uv/install.sh | sh
   
   # Windows
   powershell -c "irm https://astral.sh/uv/install.ps1 | iex"
   ```

2. **克隆项目**
   ```bash
   git clone https://github.com/SeerAPI/seerapi-models.git
   cd seerapi-models
   ```

3. **安装依赖**
   ```bash
   # 同步项目依赖
   uv sync
   ```

4. **运行开发环境**
   ```bash
   # 在项目虚拟环境中运行 Python
   uv run python
   
   # 运行测试
   uv run pytest
   
   # 运行代码检查
   uv run ruff check
   uv run ruff format
   ```

### 开发容器 (推荐)

项目提供了 Dev Container 配置，支持一键部署开发环境：

1. 使用 VS Code 打开项目
2. 安装 Dev Containers 扩展
3. 按 `Ctrl+Shift+P` 打开命令面板
4. 选择 "Dev Containers: Reopen in Container"

容器会自动安装：
- Python 3.10
- uv 包管理器
- Ruff 代码检查工具
- 相关 VS Code 扩展

### 环境要求

- Python >= 3.10
- uv >= 0.9.0 (推荐使用最新版)

## 许可证

本项目基于 [MIT License](LICENSE) 开源。
