SeerAPI 数据模型/ORM 定义
Project description
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 模型
开发环境部署
使用 uv 部署
-
安装 uv
# macOS/Linux curl -LsSf https://astral.sh/uv/install.sh | sh # Windows powershell -c "irm https://astral.sh/uv/install.ps1 | iex"
-
克隆项目
git clone https://github.com/SeerAPI/seerapi-models.git cd seerapi-models
-
安装依赖
# 同步项目依赖 uv sync
-
运行开发环境
# 在项目虚拟环境中运行 Python uv run python # 运行测试 uv run pytest # 运行代码检查 uv run ruff check uv run ruff format
开发容器 (推荐)
项目提供了 Dev Container 配置,支持一键部署开发环境:
- 使用 VS Code 打开项目
- 安装 Dev Containers 扩展
- 按
Ctrl+Shift+P打开命令面板 - 选择 "Dev Containers: Reopen in Container"
容器会自动安装:
- Python 3.10
- uv 包管理器
- Ruff 代码检查工具
- 相关 VS Code 扩展
环境要求
- Python >= 3.10
- uv >= 0.9.0 (推荐使用最新版)
许可证
本项目基于 MIT License 开源。
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
seerapi_models-103.2.1.tar.gz
(27.0 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
File details
Details for the file seerapi_models-103.2.1.tar.gz.
File metadata
- Download URL: seerapi_models-103.2.1.tar.gz
- Upload date:
- Size: 27.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.10.8 {"installer":{"name":"uv","version":"0.10.8","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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c4ecf2275d3984dd94fd47ad91f7126f61dc7d82bf4e0bb57358005df7b7cbbd
|
|
| MD5 |
8d123febd77f8585e06888d50e0b4e27
|
|
| BLAKE2b-256 |
3495a896ec812793d6bb3c4b0a19b40b3872b927208a49586bf9b6115f2006dc
|
File details
Details for the file seerapi_models-103.2.1-py3-none-any.whl.
File metadata
- Download URL: seerapi_models-103.2.1-py3-none-any.whl
- Upload date:
- Size: 40.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.10.8 {"installer":{"name":"uv","version":"0.10.8","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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ab923c3fe606f78914f3d5160924093cfe54fa5a88d502171c0a97e5a7a5a639
|
|
| MD5 |
47c438b3ead887872f4c8c7f53352882
|
|
| BLAKE2b-256 |
87d60be9491d23e325ccc1162b1ae876bf638af4f48e8498dde913fa6584d3eb
|