Skip to main content

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 部署

  1. 安装 uv

    # macOS/Linux
    curl -LsSf https://astral.sh/uv/install.sh | sh
    
    # Windows
    powershell -c "irm https://astral.sh/uv/install.ps1 | iex"
    
  2. 克隆项目

    git clone https://github.com/SeerAPI/seerapi-models.git
    cd seerapi-models
    
  3. 安装依赖

    # 同步项目依赖
    uv sync
    
  4. 运行开发环境

    # 在项目虚拟环境中运行 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 开源。

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

seerapi_models-105.1.0.tar.gz (29.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

seerapi_models-105.1.0-py3-none-any.whl (45.8 kB view details)

Uploaded Python 3

File details

Details for the file seerapi_models-105.1.0.tar.gz.

File metadata

  • Download URL: seerapi_models-105.1.0.tar.gz
  • Upload date:
  • Size: 29.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","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

Hashes for seerapi_models-105.1.0.tar.gz
Algorithm Hash digest
SHA256 7e9b6d4f0dc2b3e87d98d7c5badf046c8bb7fe2993e6890c48b8edfc9cce8eb9
MD5 e0933f052f4c7e1bc4e870f01fdb4a4e
BLAKE2b-256 1bc11803deec5feae0bf8e81469f2f0cc67c8dd4631b995f573786880cdc2891

See more details on using hashes here.

File details

Details for the file seerapi_models-105.1.0-py3-none-any.whl.

File metadata

  • Download URL: seerapi_models-105.1.0-py3-none-any.whl
  • Upload date:
  • Size: 45.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","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

Hashes for seerapi_models-105.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 76296211fd614731ef1dec3f8121568e8b3d4f1cccbaf2c9b70fc42a8509847c
MD5 a1872d6b60d33e0736331c17dfa25a2b
BLAKE2b-256 6e1c72040c62a8d40283bf8c2ace579ff6abcce36c018571b48570f2d691f3c1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page