- pydantic 模型覆盖 entities/links/actions/functions/rules/constraints
- 跨引用校验:link.from/to 实体存在、rule.via 链路连得通且终点与 to 一致
- YAML 1.2 口径 loader:on/off/yes/no 不再被当成布尔(否则 on: Line 解析成 {True: Line})
- of 支持标量类型或实体名;属性支持 accepted: boolean 简写
- 19 条测试,其中 test_readme_example_loads 直接解析 README 里的 YAML
- dev 组补 types-pyyaml,mypy strict 通过
67 lines
1.6 KiB
TOML
67 lines
1.6 KiB
TOML
[project]
|
||
name = "adapter-python-pg"
|
||
version = "0.1.0"
|
||
description = "基于 ontology 数据基座的 PostgreSQL 中间层适配器(FastAPI 项目以 pip 包引用)"
|
||
readme = "README.md"
|
||
requires-python = ">=3.11"
|
||
license = { text = "Proprietary" }
|
||
dependencies = [
|
||
"psycopg[binary,pool]>=3.2",
|
||
"pydantic>=2.9",
|
||
"pydantic-settings>=2.6",
|
||
"pyyaml>=6.0.2",
|
||
"cel-python>=0.2",
|
||
]
|
||
|
||
[project.optional-dependencies]
|
||
# FastAPI 只是可选依赖:核心包不 import 它,宿主项目才需要
|
||
api = ["fastapi>=0.115"]
|
||
|
||
# 开发依赖走 PEP 735 依赖组:uv sync 默认安装,不需要 --extra dev
|
||
[dependency-groups]
|
||
dev = [
|
||
"pytest>=8.0",
|
||
"pytest-asyncio>=0.24",
|
||
"testcontainers[postgres]>=4.8",
|
||
"ruff>=0.8",
|
||
"mypy>=1.13",
|
||
"types-pyyaml>=6.0.12",
|
||
]
|
||
|
||
[build-system]
|
||
requires = ["hatchling"]
|
||
build-backend = "hatchling.build"
|
||
|
||
[tool.hatch.build.targets.wheel]
|
||
packages = ["src/adapter_python_pg"]
|
||
|
||
[tool.uv]
|
||
package = true
|
||
|
||
[tool.ruff]
|
||
line-length = 100
|
||
target-version = "py311"
|
||
src = ["src", "tests"]
|
||
|
||
[tool.ruff.lint]
|
||
select = ["E", "F", "I", "UP", "B", "SIM", "RUF"]
|
||
# E501: 行宽交给 formatter
|
||
# RUF001/002/003: 中文文档与注释里的全角标点是刻意的,不视为歧义字符
|
||
ignore = ["E501", "RUF001", "RUF002", "RUF003"]
|
||
|
||
[tool.pytest.ini_options]
|
||
testpaths = ["tests"]
|
||
pythonpath = ["src"]
|
||
asyncio_mode = "auto"
|
||
asyncio_default_fixture_loop_scope = "function"
|
||
markers = [
|
||
"integration: 需要真实 PostgreSQL 的测试(testcontainers)",
|
||
]
|
||
|
||
[tool.mypy]
|
||
python_version = "3.11"
|
||
files = ["src"]
|
||
strict = true
|
||
warn_unused_ignores = true
|
||
disallow_untyped_defs = true
|