seerapi-models
SeerAPI 数据模型/ORM 定义,用于前后端开发。
安装
使用 uv:
uv add seerapi-models
或者使用 pip:
pip install seerapi-models
也可以使用其他包管理器,如 poetry 等。
使用
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 模型
开发环境部署
本包是 SeerAPI monorepo 的一部分。推荐从 monorepo 根目录进行开发。
使用 uv 部署
-
安装 uv
# macOS/Linux curl -LsSf https://astral.sh/uv/install.sh | sh # Windows powershell -c "irm https://astral.sh/uv/install.ps1 | iex"
-
克隆 monorepo
git clone https://github.com/SeerAPI/seerapi.git cd seerapi
-
安装依赖
# 同步所有工作区依赖 uv sync
-
运行开发环境
# 仅在本包环境中运行 uv run --package seerapi-models python # 运行测试 uv run --package seerapi-models pytest # 运行代码检查 uv run ruff check . uv run ruff format .
开发容器 (推荐)
项目提供了 Dev Container 配置,支持一键部署开发环境:
- 使用 VS Code 打开 monorepo 根目录
- 安装 Dev Containers 扩展
- 按
Ctrl+Shift+P打开命令面板 - 选择 "Dev Containers: Reopen in Container"
容器会自动安装:
- Python 3.10
- uv 包管理器
- pnpm 包管理器
- Ruff 代码检查工具
- 相关 VS Code 扩展
环境要求
- Python >= 3.10
- uv(推荐使用最新版)
许可证
本项目基于 MIT License 开源。
Metadata
Release files for seerapi-models 106.10.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| seerapi_models-106.10.1.tar.gz | 34.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| seerapi_models-106.10.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 91.7 kB
Release files / seerapi_models-106.10.1.tar.gz
| Download URL | seerapi_models-106.10.1.tar.gz |
|---|---|
| Size | 34.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ec56579a3da333140205338b7a21916c304d407cf3e859843bb6a147b8a1de53
|
|
BLAKE2b-256 checksum How to use checksums |
617e12435a3f0ecb282e3e4f6a4f4a9eb59d14c15d9887a35bb37c0a6166b1b0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.18 {"installer":{"name":"uv","version":"0.12.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / seerapi_models-106.10.1-py3-none-any.whl
| Download URL | seerapi_models-106.10.1-py3-none-any.whl |
|---|---|
| Size | 57.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1a2936f337229a8bb3b984678a09fff82165f7d8e36a9697c52f49eade63d62d
|
|
BLAKE2b-256 checksum How to use checksums |
450ba91579d60b51ec1764e841b7891386291fd85fc245f631e3145dbf10fe95
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.18 {"installer":{"name":"uv","version":"0.12.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|