Metadata-Version: 2.5
Name: yuppie-powerbi
Version: 0.1.0
Summary: Power BI REST API client library (service principal + OAuth2 client_credentials)
Project-URL: Homepage, https://github.com/yuppie1949/yuppie-mcp-powerbi
Project-URL: Repository, https://github.com/yuppie1949/yuppie-mcp-powerbi
Author-email: yuppie <yidaowanli@gmail.com>
License-Expression: MIT
Keywords: dax,power-bi,powerbi,rest-api
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Python: >=3.10
Requires-Dist: httpx>=0.27.0
Requires-Dist: python-dotenv>=1.0.0
Provides-Extra: dev
Requires-Dist: mypy>=1.10.0; extra == 'dev'
Requires-Dist: pytest-asyncio>=0.23.0; extra == 'dev'
Requires-Dist: pytest>=8.0.0; extra == 'dev'
Requires-Dist: ruff>=0.4.0; extra == 'dev'
Description-Content-Type: text/markdown

# yuppie-powerbi

Power BI REST API 客户端库（基于服务主体 + OAuth2 client_credentials），**无 MCP 依赖**。

从 `yuppie-mcp-powerbi` 仓库拆出的纯 Python 库：如果你只想在自己的项目里调用 Power BI REST API / 执行 DAX 查询，不想引入 MCP 及其版本约束，直接用这个包。

## 安装

```bash
uv add yuppie-powerbi        # 或 pip install yuppie-powerbi
```

## 快速开始

```python
from yuppie_powerbi import PowerBIClient, PowerBIConfig

config = (
    PowerBIConfig.from_env()
)  # 读 PB_TENANT_ID/PB_CLIENT_ID/PB_CLIENT_SECRET/PB_DATASET_ID 等环境变量
client = PowerBIClient(config)

result = await client.execute_dax(config.dataset_id, "EVALUATE VALUES('SITE'[SITE])")
print(result)
```

## 模块结构

- `yuppie_powerbi` — 包根直接暴露 `PowerBIClient` 与 `PowerBIConfig`
- `yuppie_powerbi.config` — `PowerBIConfig` 环境配置（服务主体凭据，`from_env()` 校验必填项）
- `yuppie_powerbi.client` — `PowerBIClient` 异步客户端：token 获取（自动刷新缓存）、`execute_dax()`、`get_group_reports()`
- 无 mcp / pydantic 依赖（deps 仅 python-dotenv、httpx）

## 与 MCP Server 的关系

同一仓库的 `packages/yuppie-mcp-powerbi` 是本库的 MCP 壳（把 DAX 查询等封装为 MCP 工具），PyPI 分发（`uvx yuppie-mcp-powerbi`），依赖本包。两者版本独立演进。

## 依赖

Python ≥ 3.10；python-dotenv、httpx
