25d895d 🐛 fix(gitea_workflow): clean up temp repos after job steps 2bc3b11 🐛 fix(gitea_workflow): clean up temporary repo dirs in workflows 98c3f30 📝 docs(agent_rules): allow plan execution on current branch 16c7230 📝 docs(prompts): define custom verify layering 8efc4dd 🐛 fix(skills): quote commit-message description bc8498f 🐛 fix(ci): install tomli for gitea tests 55cda3b 🐛 fix(tests): report missing toml parser clearly c0729c7 🐛 fix(playbook): import Optional for cli compatibility 63e24bf 📦 deps(skills): sync thirdparty skills d2f9356 🐛 fix(ci): isolate gitea workflow repos 588b81d 🐛 fix(ci): inline gitea workflow bootstrap e0b1c3a ♻️ refactor(skills): standardize first-party skill contracts 2c5050d ♻️ refactor(skills): rename repo skills source dir f049dfb 📦 deps(skills): drop duplicate first-party superpowers skills 234b335 ✨ feat(workflow): add superpowers planning and execution state tracking c1702a6 📝 docs(markdown): format tracked markdown and drop stale templates 2325409 📝 docs(markdown): clarify optional markdownlint usage 214c44e 🔧 chore(markdown): add markdownlint baseline and lint fixes a22b324 📝 docs(templates): add execution and memory-bank prompt templates 223a797 📝 docs(templates): update README for Claude Code and current features 4ac8672 📝 docs: simplify README + platform-agnostic tools + auto-create local rules 2431c9d 📝 docs: add claude_md config and use cross-platform paths d64b248 📝 docs: fix README.md inaccuracies and add Claude Code info c8d6bf2 🐛 fix(playbook): use relative paths in CLAUDE.md when not at project root 6518f0f ✨ feat(playbook): auto-create CLAUDE.md with path discovery 6ec9a45 ✨ feat(skills): add skill_link symlink support + platform-agnostic prompt 9f8b6b5 📝 docs: update README and config example for Claude Code support 79cff6c 📝 docs(skills): add Claude Code platform support 452c6f5 ✨ feat(playbook): auto-inject AGENTS.md into CLAUDE.md e1dbf3c 🐛 fix(skills): remove dual-path from commit-message skill f3a7259 🔧 chore(ci): use prepare_repo.sh in both workflows da08212 🔧 chore(ci): extract prepare_repo.sh and clean up workflows 7ade85e 🗑️ remove(tsl): drop syntax_book/, data/ source and build script f94dba0 ♻️ refactor(skills): update playbook.py and tests for thirdparty/ layout b3df412 ♻️ refactor(skills): separate thirdparty skills into thirdparty/ subdirectory 64950e7 📦 deps(skills): sync thirdparty skills a2e3cb0 ✨ feat(playbook): add no_backup deploy controls 8609d59 🐛 fix(docs): repair reference catalog source links 956da11 🐛 fix(playbook): publish hidden ci test fixes 3f67754 📦 deps(skills): sync thirdparty skills 08ca87b 📦 deps(skills): add karpathy thirdparty sync 96b705b 📝 docs(tsl): rebuild canonical syntax and routing manual 3ed5052 📦 deps(skills): sync thirdparty skills 60108dd 📦 deps(skills): sync thirdparty skills da85d4e 🐛 fix(thirdparty): prune nested project snapshots a2a697e 📦 deps(skills): sync thirdparty skills 9df610a 🐛 fix(thirdparty): exclude duplicated superpowers skills 33dd5bb 🐛 fix(thirdparty): preserve optional manifest fields 91b0ea7 🐛 fix(thirdparty): preserve manifest during snapshot update 2e26f98 🔧 chore(thirdparty): generalize skills sync pipeline 5b9c1e3 📦 deps(skills): sync superpowers 2f2d34a 📝 docs(readme): normalize subtree command spacing 62db7db 🐛 fix(ci): serialize superpowers update and sync 3463223 🐛 fix(ci): use literal superpowers sync paths 48f6de8 📦 deps(skills): sync superpowers 4b23529 🔧 chore(ci): merge superpowers update and sync workflow a56d75b 📦 deps(skills): sync superpowers 84bcefa 🔧 chore(ci): use ci[bot] commit author name 00a07e5 📦 deps(skills): sync superpowers 7b84daf 🐛 fix(templates): enforce main loop progress tracking 51373d7 🔧 chore(ci): automate superpowers sync workflow eaaa39c 🐛 fix(ci): prevent stale superpowers sync from restoring skills block 79755c6 📦 deps(skills): sync superpowers 836d878 📦 deps(skills): sync superpowers 8216c9f 📦 deps(skills): sync superpowers 9439505 🐛 fix(playbook): address reported repo issues git-subtree-dir: docs/standards/playbook git-subtree-split: 25d895d8b3f56624ccfe99ad7289e9eb49e0f316
90 lines
3.3 KiB
Markdown
90 lines
3.3 KiB
Markdown
# 天软 pyTSL 接口使用说明
|
||
|
||
文档类型:模块摘要
|
||
是否可直接用于生成代码:仅部分
|
||
是否含已验证可执行示例:否
|
||
是否含已验证反例:否
|
||
遇到不确定时跳转到:项目级部署文档、官方 pyTSL 详细接口文档、[tsl_python_interop.md](tsl_python_interop.md)、[index.md](index.md)
|
||
|
||
本页用于确认 pyTSL 的接入方向和最小链路,不替代项目级部署文档或完整接口手册。
|
||
|
||
- 如果登录方式、凭证来源、环境变量、部署入口、连接上下文或返回结构没有确认,不继续生成接入代码,直接回项目级部署文档或官方 pyTSL 详细接口文档。
|
||
|
||
## 定位
|
||
|
||
- 官方 Python SDK,面向取数/执行/批量/异步与数据转换。
|
||
|
||
## 结构索引
|
||
|
||
- 安装与配置
|
||
- pyTSL 接口说明(Client / AsyncClient / async_util / Batch / Task / Const / TSResultValue)
|
||
- pyTSLPy 兼容说明
|
||
- 示例与数据类型转换
|
||
- 附录与常见问题
|
||
|
||
## 安装方式(摘要)
|
||
|
||
- `pip install tspytsl`(在线安装)
|
||
- 离线安装与手动部署
|
||
|
||
## 同步 / 异步怎么选
|
||
|
||
- 同步:任务短、交互简单、立即取结果时优先用 `pyTSL.Client`。
|
||
- 异步:任务长、需要并发或批量调度时再看 `pyTSL.AsyncClient` 与 `async_util`。
|
||
- 如果只是先打通最小链路,先用同步客户端,不要一开始就上异步。
|
||
|
||
## 核心类与模块
|
||
|
||
- `pyTSL.Client`:同步客户端
|
||
- `pyTSL.AsyncClient`:异步客户端
|
||
- `pyTSL.async_util`:异步工具函数
|
||
- `TSBatch` / `Task`:批量与任务
|
||
- `TSResultValue`:统一返回结果封装
|
||
- `pyTSL.Const`:常量与字段
|
||
|
||
## 关键方法(常用)
|
||
|
||
- `login` / `logout`
|
||
- `exec` / `call` / `query`
|
||
- `download_list` / `download` / `upload` / `remove`
|
||
- `DatetimeToDouble` / `DoubleToDatetime`
|
||
- `EncodeStream` / `DecodeStream`
|
||
- `DataFrameToTSArray`
|
||
|
||
## 最小成功路径
|
||
|
||
1. 先回项目级部署文档确认登录方式、凭证来源、环境变量和部署入口。
|
||
2. 安装 `tspytsl`。
|
||
3. 创建 `pyTSL.Client(...)`。
|
||
4. 调 `login()` 登录。
|
||
5. 用 `query(...)`、`exec(...)` 或 `call(...)` 执行任务。
|
||
6. 从返回结果里读取你真正需要的内容;常见起手是 `result.dataframe()`。
|
||
7. 完成后显式 `logout()`。
|
||
|
||
## 返回结果与失败处理
|
||
|
||
- 常见返回会落在 `TSResultValue` 这一层;真正用之前,先确认你要的是表格、标量还是其他结构。
|
||
- 最小起手路径可以先看 `result.dataframe()` 是否符合预期,再扩展到别的读取方式。
|
||
- 登录、查询和退出应当成对出现;不要把长期未退出的连接当默认用法。
|
||
- 如果失败,先检查安装、登录上下文、查询语句和返回结构,再决定是否切到异步客户端。
|
||
- 如果还不能确认登录方式、凭证来源或返回结构,不继续扩展接入代码,先回项目级部署文档和官方接口文档。
|
||
|
||
## 示例(Python)
|
||
|
||
示例里的 `"user"` / `"password"` 只表示调用外形,不代表项目里的真实登录方式或凭证来源。
|
||
|
||
代码块身份:配置片段 / 概念骨架
|
||
代码块说明:可参考最小链路,不是已验证可执行示例。
|
||
|
||
```python
|
||
import pyTSL
|
||
|
||
c = pyTSL.Client("user", "password")
|
||
c.login()
|
||
|
||
result = c.query("select close from market where stock = 'SZ000001' end")
|
||
print(result.dataframe())
|
||
|
||
c.logout()
|
||
```
|