Metadata-Version: 2.1
Name: mathema-mcp
Version: 1.5.0
Summary: Mathema MCP Python bindings (prebuilt _mcp + dict-style Mcp*)
Requires-Python: >=3.9
Provides-Extra: data
Requires-Dist: numpy>=1.19; extra == "data"
Requires-Dist: pandas>=1.3; extra == "data"
Description-Content-Type: text/markdown

# mathema-mcp

Mathema MCP 的 Python 绑定（SWIG `mcp.py` + 原生 `_mcp`）。用户按自己的 **操作系统 + Python 版本** 只下载 **一只** 对应 wheel，不会把 Win/Linux、3.9/3.13 全拉下来。

## 安装

内部索引（HTTP，与现有 `mcp_release` 同一台机器）：

```bash
pip install mathema-mcp \
  --index-url http://172.20.0.15/mcp_release/pypi/simple \
  --trusted-host 172.20.0.15
```

或直接装本地 / 已下载的 wheel：

```bash
pip install path/to/mathema_mcp-1.5.0-cp39-cp39-win_amd64.whl
```

## 使用

主入口是 **dict 传参**（与 mcpexcel 例子相同），不是 SWIG 位置参数：

```python
from mcp.tools import McpCalendar, McpVersion
from mcp.tool.tools_main import McpYieldCurve
from mcp.utils.enums import DayCounter, Frequency, InterpolatedVariable, InterpolationMethod

print(McpVersion())
cal = McpCalendar()
yc = McpYieldCurve({
    "ReferenceDate": "2024-12-13",
    "Tenors": ["1M", "1Y"],
    "ZeroRates": [0.03, 0.035],
    "Calendar": cal,
    "DayCounter": DayCounter.Act365Fixed,
    "Frequency": Frequency.Continuous,
    "Variable": InterpolatedVariable.SIMPLERATES,
    "InterpolationMethod": InterpolationMethod.LINEARINTERPOLATION,
})
```

`mcp.wrapper.Mcp*` 是底层类；业务请走 `mcp.tools` / `mcp.tool.tools_main`。
dict 造对象 **不需要** numpy / pandas。`FixedLegs` / `McpPayoff` / `McpZeroRate` 等表格 API 才要：`pip install mathema-mcp[data]`。不含 Excel / PyXLL。

## 支持的 wheel

| 平台 | Python | 标签 |
|------|--------|------|
| Windows x64 | 3.9 / 3.13 | `win_amd64` |
| Linux x64（glibc ≥ 2.28） | 3.9 / 3.13 | `manylinux_2_28_x86_64` |

其它 Python 小版本（3.10/3.11/3.12）没有对应扩展，pip 会提示无匹配发行包。

## 运行时依赖

- **Windows**：第三方（curl / OpenSSL / yaml-cpp / fftw / zlib）已静态链入 `_mcp.pyd`。当前 Release 仍链接 CUDA，wheel 会附带 `cudart` / `curand`。
- **Linux**（`MATHEMA_LINUX_STATIC_THIRDPARTY`）：yaml-cpp、curl、OpenSSL、zlib、FFTW、OpenBLAS 均静链进 `_mcp.so`。目标机不再需要这些系统库。若绑定编了 CUDA，仍需 CUDA runtime（`libcudart` / `libcurand`），或后续打进 wheel。

## 打包（开发机）

在仓库根目录，先按现有流程编出 `_mcp`，再：

```bash
python python-package/pack_wheel.py
python python-package/pack_wheel.py --smoke
python python-package/pack_wheel.py --upload
```

不要对 `python-package/` 执行 `pip install -e .`（这里没有可现场编译的扩展）。
