Metadata-Version: 2.4
Name: acong-tech-vault-sdk
Version: 0.1.0.dev20260422143608
Summary: vault SDK — Python 消费方通过它读 credentials / resources / projects，避免 subprocess
Author-email: acong-tech <yarnbgpt@gmail.com>
License: MIT
Requires-Python: >=3.12
Provides-Extra: dev
Requires-Dist: pytest>=8.3; extra == 'dev'
Description-Content-Type: text/markdown

# acong-tech-vault-sdk

Python SDK for [vault](https://github.com/acong-tech/vault) —— 读 credentials / resources / projects 不走 subprocess。

## 安装

```bash
pip install acong-tech-vault-sdk
# 或
uv add acong-tech-vault-sdk
```

## 使用

```python
import os
os.environ.setdefault("VAULT_DATA_DIR", "/path/to/vault/data")

from vault_sdk import cred, resource, project, find_credential

# 取 credential
c = cred("aliyun-power-app-ak")
print(c["credentials"]["access_key_id"])

# 取 resource
sign = resource("aliyun", "sms-sign", "杭州阿空智能科技")

# 取 project 的所有依赖
p = project("xiangqin")
print(p["uses"]["credentials"])  # ["aliyun-main", "aliyun-power-app-ak", ...]

# v1 兼容：按旧 platform 名查
c = find_credential("aliyun.power-app")
```

## 环境变量

- `VAULT_DATA_DIR`：必需。vault 的 `data/` 目录（或其子集）的路径。

  生产环境推荐把本项目需要的 credentials/resources/projects 文件推到独立目录，设 `VAULT_DATA_DIR=/opt/xiangqin/vault-data`。
  开发环境软链 `ln -s /Users/yarnb/vault/data ~/.vault/data` 即可。

## 心智模型

详见 vault 项目 `decisions/2026-04-22-2300-v2-schema-*.md`。5 概念分层：

```
Platform ─┬─ Account ── Credential
          └─ Resource
Project ─── uses {credentials, resources}
```

## License

MIT
