qatlas-cli 0.24.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. qatlas_cli-0.24.0/.github/workflows/release.yml +65 -0
  2. qatlas_cli-0.24.0/.gitignore +19 -0
  3. qatlas_cli-0.24.0/CHANGELOG.md +51 -0
  4. qatlas_cli-0.24.0/PKG-INFO +142 -0
  5. qatlas_cli-0.24.0/README.md +121 -0
  6. qatlas_cli-0.24.0/pyproject.toml +61 -0
  7. qatlas_cli-0.24.0/src/qatlas/__init__.py +48 -0
  8. qatlas_cli-0.24.0/src/qatlas/cli.py +228 -0
  9. qatlas_cli-0.24.0/src/qatlas/client/__init__.py +1 -0
  10. qatlas_cli-0.24.0/src/qatlas/client/_common.py +247 -0
  11. qatlas_cli-0.24.0/src/qatlas/client/auth.py +791 -0
  12. qatlas_cli-0.24.0/src/qatlas/client/config.py +276 -0
  13. qatlas_cli-0.24.0/src/qatlas/client/contrib.py +180 -0
  14. qatlas_cli-0.24.0/src/qatlas/client/mineru.py +1345 -0
  15. qatlas_cli-0.24.0/src/qatlas/client/paper.py +750 -0
  16. qatlas_cli-0.24.0/src/qatlas/client/plugins/__init__.py +16 -0
  17. qatlas_cli-0.24.0/src/qatlas/client/plugins/base.py +40 -0
  18. qatlas_cli-0.24.0/src/qatlas/client/plugins/registry.py +67 -0
  19. qatlas_cli-0.24.0/src/qatlas/client/upload.py +331 -0
  20. qatlas_cli-0.24.0/src/qatlas/config.py +299 -0
  21. qatlas_cli-0.24.0/src/qatlas/config_yaml.py +136 -0
  22. qatlas_cli-0.24.0/src/qatlas/parser/__init__.py +16 -0
  23. qatlas_cli-0.24.0/src/qatlas/parser/__main__.py +99 -0
  24. qatlas_cli-0.24.0/src/qatlas/parser/arxiv_fetcher.py +242 -0
  25. qatlas_cli-0.24.0/src/qatlas/parser/keyring.py +135 -0
  26. qatlas_cli-0.24.0/src/qatlas/parser/mineru_client.py +529 -0
  27. qatlas_cli-0.24.0/src/qatlas/paths.py +70 -0
  28. qatlas_cli-0.24.0/src/qatlas/py.typed +0 -0
  29. qatlas_cli-0.24.0/tests/__init__.py +1 -0
  30. qatlas_cli-0.24.0/tests/client/__init__.py +0 -0
  31. qatlas_cli-0.24.0/tests/client/test_config_cmd.py +296 -0
  32. qatlas_cli-0.24.0/tests/client/test_mineru_cli.py +603 -0
  33. qatlas_cli-0.24.0/tests/client/test_paper_cli.py +571 -0
  34. qatlas_cli-0.24.0/tests/client/test_upload_cli.py +286 -0
  35. qatlas_cli-0.24.0/tests/conftest.py +75 -0
  36. qatlas_cli-0.24.0/tests/parser/__init__.py +0 -0
  37. qatlas_cli-0.24.0/tests/parser/test_arxiv_fetcher.py +217 -0
  38. qatlas_cli-0.24.0/tests/parser/test_mineru_client.py +353 -0
  39. qatlas_cli-0.24.0/tests/test_cli.py +128 -0
  40. qatlas_cli-0.24.0/tests/test_client_auth.py +634 -0
  41. qatlas_cli-0.24.0/tests/test_client_common.py +272 -0
  42. qatlas_cli-0.24.0/tests/test_config_yaml.py +209 -0
  43. qatlas_cli-0.24.0/tests/test_paths.py +138 -0
  44. qatlas_cli-0.24.0/uv.lock +515 -0
@@ -0,0 +1,65 @@
1
+ # Release pipeline: tag push (v*) → build sdist/wheel → PyPI.
2
+ #
3
+ # PyPI publication uses Trusted Publishing via OIDC — no API token is
4
+ # stored anywhere. PyPI verifies the GitHub OIDC token against a
5
+ # per-project Trusted Publisher config that must match:
6
+ #
7
+ # PyPI project name: qatlas-cli
8
+ # Owner: IAI-USTC-Quantum
9
+ # Repository name: qatlas-cli
10
+ # Workflow filename: release.yml
11
+ # Environment name: pypi
12
+ #
13
+ # One-time setup: configure the publisher at
14
+ # https://pypi.org/manage/project/qatlas-cli/settings/publishing/
15
+ # and create a GitHub Environment named `pypi` in repo Settings
16
+ # (no secrets / approval reviewers needed — the name itself is the
17
+ # match key for the OIDC token).
18
+ #
19
+ # `skip-existing: true` makes re-runs against an already-published
20
+ # version a no-op.
21
+
22
+ name: release
23
+
24
+ on:
25
+ push:
26
+ tags: ["v*"]
27
+ workflow_dispatch:
28
+
29
+ jobs:
30
+ pypi-publish:
31
+ runs-on: ubuntu-latest
32
+ environment:
33
+ name: pypi
34
+ url: https://pypi.org/p/qatlas-cli/
35
+ permissions:
36
+ contents: read # checkout the tagged ref
37
+ id-token: write # required for OIDC trusted publishing
38
+
39
+ steps:
40
+ - uses: actions/checkout@v4
41
+
42
+ - uses: actions/setup-python@v5
43
+ with:
44
+ python-version: "3.11"
45
+
46
+ - name: Verify tag matches pyproject version
47
+ if: startsWith(github.ref, 'refs/tags/')
48
+ run: |
49
+ TAG="${GITHUB_REF_NAME#v}"
50
+ PYPROJECT_VERSION="$(python -c 'import tomllib; print(tomllib.load(open("pyproject.toml", "rb"))["project"]["version"])')"
51
+ if [ "$TAG" != "$PYPROJECT_VERSION" ]; then
52
+ echo "tag v$TAG does not match pyproject version $PYPROJECT_VERSION" >&2
53
+ exit 1
54
+ fi
55
+
56
+ - name: Build Python distributions
57
+ run: |
58
+ python -m pip install build
59
+ python -m build
60
+
61
+ - name: Publish to PyPI
62
+ uses: pypa/gh-action-pypi-publish@release/v1
63
+ with:
64
+ # Silent no-op on re-runs against already-published versions.
65
+ skip-existing: true
@@ -0,0 +1,19 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *.egg-info/
5
+ .pytest_cache/
6
+ .ruff_cache/
7
+ .mypy_cache/
8
+ build/
9
+ dist/
10
+
11
+ # Virtualenvs
12
+ .venv/
13
+ .venv-*/
14
+ venv/
15
+
16
+ # Editors / OS
17
+ .idea/
18
+ .vscode/
19
+ .DS_Store
@@ -0,0 +1,51 @@
1
+ # Changelog
2
+
3
+ ## 0.22.1
4
+
5
+ - 客户端/服务端兼容策略调整:由「客户端 x.y ≥ 服务端 x.y」改为「**(major, minor)
6
+ 相同即兼容**」,patch 位随意漂移(如 qatlasd 0.22.4 ↔ qatlas-cli 0.22.3)。
7
+ 两个方向不一致都会给 stderr 警告(带双方版本号与建议动作);写请求遇更新的
8
+ 服务端仍硬失败(exit code 4)。
9
+ - 升级提示由过时的 `pip install --upgrade quantum-atlas` 改为
10
+ `uv tool upgrade qatlas-cli`。
11
+ - 与 qatlasd 0.22.x 任意 patch 版本兼容(本次 patch 发布即为该契约的演练)。
12
+
13
+ ## 0.22.0
14
+
15
+ - 仓库迁移至 IAI-USTC-Quantum/qatlas-cli;安装方式与版本血统继承自
16
+ 主仓 `quantum-atlas` 包。
17
+ - 新增 PyPI Trusted Publishing 发布流程(tag `v*` 触发)。
18
+
19
+ ## 0.21.0a3
20
+
21
+ - CLI 从主仓 QuantumAtlas 拆分为独立仓库;版本号自主仓 `quantum-atlas`
22
+ 包的 0.21.0a3 继承延续,不重新从 0.x 计数。
23
+ - 安装方式与拆分前一致:`uv tool install qatlas-cli`(PyPI)。
24
+ - 发布流程:commitizen(`cz bump`,tag 格式 `v<version>`)打 tag 后由
25
+ `.github/workflows/release.yml` 经 PyPI Trusted Publishing 自动发布。
26
+
27
+ ## v0.24.0 (2026-09-07)
28
+
29
+ ### Feat
30
+
31
+ - **paper**: get metadata 子命令——按 qa_/arXiv/DOI 拉取论文元数据
32
+
33
+ ## v0.23.0 (2026-08-29)
34
+
35
+ ### Feat
36
+
37
+ - qatlas rag 命令的插件提示
38
+
39
+ ## v0.22.1 (2026-08-26)
40
+
41
+ ### Feat
42
+
43
+ - x.y compatibility policy; drop paper-get-pdf; add paper-get-images
44
+
45
+ ## v0.22.0 (2026-08-25)
46
+
47
+ ### Fix
48
+
49
+ - **ci**: grant contents:read so actions/checkout can fetch the tag
50
+
51
+ ## v0.21.0a3 (2026-08-25)
@@ -0,0 +1,142 @@
1
+ Metadata-Version: 2.5
2
+ Name: qatlas-cli
3
+ Version: 0.24.0
4
+ Summary: Command-line client for QuantumAtlas (qatlas CLI)
5
+ Author: IAI-USTC-Quantum
6
+ Keywords: cli,client,papers,quantum
7
+ Classifier: Development Status :: 3 - Alpha
8
+ Classifier: Intended Audience :: Science/Research
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: Programming Language :: Python :: 3.11
11
+ Classifier: Topic :: Scientific/Engineering :: Physics
12
+ Requires-Python: >=3.11
13
+ Requires-Dist: platformdirs<5,>=4
14
+ Requires-Dist: pydantic-settings<3,>=2.0.0
15
+ Requires-Dist: pydantic<3,>=2.5.0
16
+ Requires-Dist: pyyaml<7,>=6.0.1
17
+ Requires-Dist: requests<3,>=2.31.0
18
+ Provides-Extra: dev
19
+ Requires-Dist: pytest>=8.0.0; extra == 'dev'
20
+ Description-Content-Type: text/markdown
21
+
22
+ # qatlas-cli — QuantumAtlas 的命令行客户端
23
+
24
+ > QuantumAtlas 的 `qatlas` 命令行客户端:面向用户侧的论文获取、贡献上传、
25
+ > 本地解析等工作流,通过 HTTP 与服务端 qatlasd 交互。本仓库是主仓
26
+ > QuantumAtlas 拆出的独立私有仓库,只保留客户端与本地工具,不含服务端代码。
27
+
28
+ 所有服务端通信都是 `requests` 直发的 HTTP 调用,无重量级 SDK 依赖。
29
+
30
+ ## 安装
31
+
32
+ > **安装方式变更**:本包拆分自主仓的 `quantum-atlas` Python 包(0.21.0a3 起
33
+ > CLI 不再随主包发布)。PyPI 包名由 `quantum-atlas` 改为 **`qatlas-cli`**,
34
+ > 版本号从 0.21.0a3 延续(首个独立发布为 0.22.0)。之前用
35
+ > `uv tool install quantum-atlas` 安装的用户,改用下面的命令即可,
36
+ > 已有配置(`~/.config/qatlas/config.yaml`、PAT 等)不受影响。
37
+
38
+ 从 PyPI 安装为全局 CLI 工具(推荐,与拆分前 `quantum-atlas` 的安装方式一致):
39
+
40
+ ```bash
41
+ # 推荐:uv 全局工具(隔离环境 + 升级方便)
42
+ uv tool install qatlas-cli
43
+
44
+ # 或 pipx
45
+ pipx install qatlas-cli
46
+
47
+ # 或 plain pip
48
+ pip install qatlas-cli
49
+
50
+ qatlas --help
51
+ ```
52
+
53
+ 也可以直接从 GitHub 安装:
54
+
55
+ ```bash
56
+ uv tool install --from git+ssh://git@github.com/IAI-USTC-Quantum/qatlas-cli.git qatlas-cli
57
+ ```
58
+
59
+ 本地 editable 安装(开发用):
60
+
61
+ ```bash
62
+ git clone git@github.com:IAI-USTC-Quantum/qatlas-cli.git
63
+ cd qatlas-cli
64
+ uv sync --extra dev # 项目内 .venv,editable 安装本包
65
+ # 或装入当前环境:
66
+ uv pip install -e .
67
+ ```
68
+
69
+ ## 命令概览
70
+
71
+ ```
72
+ qatlas config # 管理用户级配置文件(~/.config/qatlas/config.yaml)
73
+ qatlas auth # 管理各 host 的 PAT / session token(login / status / token / logout)
74
+ qatlas paper # 论文元数据(JSON)/ markdown / 图片 zip 拉取(markdown 静默 fetch + LRO 轮询;PDF 交付已在服务端停用)
75
+ qatlas contrib # 贡献者工作流:上传 PDF(contrib pdf)或本地跑 MinerU 再推送(contrib mineru)
76
+ qatlas parser # 抓取并解析 arXiv 论文(本地工作区命令)
77
+ ```
78
+
79
+ 别名:`papers` → `paper`,`parse` → `parser`。
80
+
81
+ ```bash
82
+ qatlas auth login # 设备码 / PAT 登录
83
+ qatlas paper get markdown quant-ph/9508027 --output paper.md
84
+ qatlas paper get metadata quant-ph/9508027 # 论文元数据(JSON:paper_id / ids / title / authors / assets;不含 abstract)
85
+ qatlas contrib pdf quant-ph/9508027v1 --pdf paper.pdf
86
+ qatlas contrib mineru 2501.00010v1
87
+ ```
88
+
89
+ `search` 命令由独立插件 qatlas-search 提供(仓库 IAI-USTC-Quantum/qatlas-search),
90
+ `rag` 命令由独立插件 qatlas-rag 提供(仓库 IAI-USTC-Quantum/qatlas-rag);
91
+ 未安装时 `qatlas search` 或 `qatlas rag` 会给出对应的安装提示。
92
+
93
+ ### 插件机制
94
+
95
+ 第三方包可以通过 entry point 组 **`qatlas.plugins`** 注册插件,向 CLI 贡献
96
+ 顶层命令或 `contrib` 子命令。插件协议(基类 `QatlasPlugin` 与
97
+ `CommandSpec`)定义在 `qatlas/client/plugins/base.py`:
98
+
99
+ ```toml
100
+ # 插件包自己的 pyproject.toml
101
+ [project.entry-points."qatlas.plugins"]
102
+ myplugin = "my_package.qatlas_plugin:plugin"
103
+ ```
104
+
105
+ 内置命令优先于插件命令;插件不可用时会被静默跳过,不影响 CLI 本体。
106
+
107
+ ## 版本与兼容性
108
+
109
+ qatlas-cli 与服务端 qatlasd **各自独立演进版本号**,兼容协议是:
110
+
111
+ > **两者的 `(major, minor)` 相同即兼容**,patch 位随意漂移。
112
+ > 兼容性修复只 bump patch,例如 qatlasd `0.22.4` ↔ qatlas-cli `0.22.3` 是
113
+ > 受支持的配对;而 `0.23.x` 服务端配 `0.22.x` 客户端则不兼容。
114
+
115
+ 运行行为:CLI 每个请求带 `X-Qatlas-Client-Version` 头,服务端响应带
116
+ `X-Qatlas-Server-Version` 头,客户端据此比较:
117
+
118
+ - `(major, minor)` 一致:静默通过(patch 差异不算事);
119
+ - 服务端更新且为写操作:硬失败(exit code 4),提示 `uv tool upgrade qatlas-cli`;
120
+ - 服务端更新且为读操作:stderr 警告一次,继续执行;
121
+ - 客户端更新:stderr 警告一次(提示运维方升级 qatlasd),继续执行;
122
+ - 响应无版本头(0.8.0 之前的老服务端):跳过协商。
123
+
124
+ 完整策略见主仓文档:
125
+ [QuantumAtlas 版本与兼容策略](https://github.com/IAI-USTC-Quantum/QuantumAtlas/blob/main/docsite/dev/versioning.rst)。
126
+
127
+ ## 配置
128
+
129
+ 用户级配置位于 `~/.config/qatlas/config.yaml`(首次运行非 `config` 命令时
130
+ 自动创建),顶层 `server_url` / `token` 等字段供各客户端命令读取。环境变量
131
+ `QATLAS_*` 系列可覆盖对应配置;`QATLAS_SKIP_DOTENV=1` 跳过仓库 `.env` 加载。
132
+
133
+ ## 开发与测试
134
+
135
+ ```bash
136
+ uv sync --extra dev
137
+ uv run pytest -q # 默认全离线;真打外网的用例标了 network,需 -m network 显式开启
138
+ ```
139
+
140
+ 测试覆盖:CLI 命令分发与版本解析、auth(设备码登录 / token 存储,mock HTTP)、
141
+ paper / contrib / config 命令行为(mock 服务端)、parser 的 arXiv 抓取与
142
+ MinerU 客户端(固定 fixture / mock)。带 `network` 标记的 live 用例默认跳过。
@@ -0,0 +1,121 @@
1
+ # qatlas-cli — QuantumAtlas 的命令行客户端
2
+
3
+ > QuantumAtlas 的 `qatlas` 命令行客户端:面向用户侧的论文获取、贡献上传、
4
+ > 本地解析等工作流,通过 HTTP 与服务端 qatlasd 交互。本仓库是主仓
5
+ > QuantumAtlas 拆出的独立私有仓库,只保留客户端与本地工具,不含服务端代码。
6
+
7
+ 所有服务端通信都是 `requests` 直发的 HTTP 调用,无重量级 SDK 依赖。
8
+
9
+ ## 安装
10
+
11
+ > **安装方式变更**:本包拆分自主仓的 `quantum-atlas` Python 包(0.21.0a3 起
12
+ > CLI 不再随主包发布)。PyPI 包名由 `quantum-atlas` 改为 **`qatlas-cli`**,
13
+ > 版本号从 0.21.0a3 延续(首个独立发布为 0.22.0)。之前用
14
+ > `uv tool install quantum-atlas` 安装的用户,改用下面的命令即可,
15
+ > 已有配置(`~/.config/qatlas/config.yaml`、PAT 等)不受影响。
16
+
17
+ 从 PyPI 安装为全局 CLI 工具(推荐,与拆分前 `quantum-atlas` 的安装方式一致):
18
+
19
+ ```bash
20
+ # 推荐:uv 全局工具(隔离环境 + 升级方便)
21
+ uv tool install qatlas-cli
22
+
23
+ # 或 pipx
24
+ pipx install qatlas-cli
25
+
26
+ # 或 plain pip
27
+ pip install qatlas-cli
28
+
29
+ qatlas --help
30
+ ```
31
+
32
+ 也可以直接从 GitHub 安装:
33
+
34
+ ```bash
35
+ uv tool install --from git+ssh://git@github.com/IAI-USTC-Quantum/qatlas-cli.git qatlas-cli
36
+ ```
37
+
38
+ 本地 editable 安装(开发用):
39
+
40
+ ```bash
41
+ git clone git@github.com:IAI-USTC-Quantum/qatlas-cli.git
42
+ cd qatlas-cli
43
+ uv sync --extra dev # 项目内 .venv,editable 安装本包
44
+ # 或装入当前环境:
45
+ uv pip install -e .
46
+ ```
47
+
48
+ ## 命令概览
49
+
50
+ ```
51
+ qatlas config # 管理用户级配置文件(~/.config/qatlas/config.yaml)
52
+ qatlas auth # 管理各 host 的 PAT / session token(login / status / token / logout)
53
+ qatlas paper # 论文元数据(JSON)/ markdown / 图片 zip 拉取(markdown 静默 fetch + LRO 轮询;PDF 交付已在服务端停用)
54
+ qatlas contrib # 贡献者工作流:上传 PDF(contrib pdf)或本地跑 MinerU 再推送(contrib mineru)
55
+ qatlas parser # 抓取并解析 arXiv 论文(本地工作区命令)
56
+ ```
57
+
58
+ 别名:`papers` → `paper`,`parse` → `parser`。
59
+
60
+ ```bash
61
+ qatlas auth login # 设备码 / PAT 登录
62
+ qatlas paper get markdown quant-ph/9508027 --output paper.md
63
+ qatlas paper get metadata quant-ph/9508027 # 论文元数据(JSON:paper_id / ids / title / authors / assets;不含 abstract)
64
+ qatlas contrib pdf quant-ph/9508027v1 --pdf paper.pdf
65
+ qatlas contrib mineru 2501.00010v1
66
+ ```
67
+
68
+ `search` 命令由独立插件 qatlas-search 提供(仓库 IAI-USTC-Quantum/qatlas-search),
69
+ `rag` 命令由独立插件 qatlas-rag 提供(仓库 IAI-USTC-Quantum/qatlas-rag);
70
+ 未安装时 `qatlas search` 或 `qatlas rag` 会给出对应的安装提示。
71
+
72
+ ### 插件机制
73
+
74
+ 第三方包可以通过 entry point 组 **`qatlas.plugins`** 注册插件,向 CLI 贡献
75
+ 顶层命令或 `contrib` 子命令。插件协议(基类 `QatlasPlugin` 与
76
+ `CommandSpec`)定义在 `qatlas/client/plugins/base.py`:
77
+
78
+ ```toml
79
+ # 插件包自己的 pyproject.toml
80
+ [project.entry-points."qatlas.plugins"]
81
+ myplugin = "my_package.qatlas_plugin:plugin"
82
+ ```
83
+
84
+ 内置命令优先于插件命令;插件不可用时会被静默跳过,不影响 CLI 本体。
85
+
86
+ ## 版本与兼容性
87
+
88
+ qatlas-cli 与服务端 qatlasd **各自独立演进版本号**,兼容协议是:
89
+
90
+ > **两者的 `(major, minor)` 相同即兼容**,patch 位随意漂移。
91
+ > 兼容性修复只 bump patch,例如 qatlasd `0.22.4` ↔ qatlas-cli `0.22.3` 是
92
+ > 受支持的配对;而 `0.23.x` 服务端配 `0.22.x` 客户端则不兼容。
93
+
94
+ 运行行为:CLI 每个请求带 `X-Qatlas-Client-Version` 头,服务端响应带
95
+ `X-Qatlas-Server-Version` 头,客户端据此比较:
96
+
97
+ - `(major, minor)` 一致:静默通过(patch 差异不算事);
98
+ - 服务端更新且为写操作:硬失败(exit code 4),提示 `uv tool upgrade qatlas-cli`;
99
+ - 服务端更新且为读操作:stderr 警告一次,继续执行;
100
+ - 客户端更新:stderr 警告一次(提示运维方升级 qatlasd),继续执行;
101
+ - 响应无版本头(0.8.0 之前的老服务端):跳过协商。
102
+
103
+ 完整策略见主仓文档:
104
+ [QuantumAtlas 版本与兼容策略](https://github.com/IAI-USTC-Quantum/QuantumAtlas/blob/main/docsite/dev/versioning.rst)。
105
+
106
+ ## 配置
107
+
108
+ 用户级配置位于 `~/.config/qatlas/config.yaml`(首次运行非 `config` 命令时
109
+ 自动创建),顶层 `server_url` / `token` 等字段供各客户端命令读取。环境变量
110
+ `QATLAS_*` 系列可覆盖对应配置;`QATLAS_SKIP_DOTENV=1` 跳过仓库 `.env` 加载。
111
+
112
+ ## 开发与测试
113
+
114
+ ```bash
115
+ uv sync --extra dev
116
+ uv run pytest -q # 默认全离线;真打外网的用例标了 network,需 -m network 显式开启
117
+ ```
118
+
119
+ 测试覆盖:CLI 命令分发与版本解析、auth(设备码登录 / token 存储,mock HTTP)、
120
+ paper / contrib / config 命令行为(mock 服务端)、parser 的 arXiv 抓取与
121
+ MinerU 客户端(固定 fixture / mock)。带 `network` 标记的 live 用例默认跳过。
@@ -0,0 +1,61 @@
1
+ [project]
2
+ name = "qatlas-cli"
3
+ # Version lineage continues from the main-repo `quantum-atlas` package
4
+ # (the CLI was split out at 0.21.0a3); do not restart from 0.x.
5
+ version = "0.24.0"
6
+ description = "Command-line client for QuantumAtlas (qatlas CLI)"
7
+ readme = "README.md"
8
+ requires-python = ">=3.11"
9
+ authors = [{ name = "IAI-USTC-Quantum" }]
10
+ keywords = ["quantum", "papers", "cli", "client"]
11
+ classifiers = [
12
+ "Development Status :: 3 - Alpha",
13
+ "Intended Audience :: Science/Research",
14
+ "Programming Language :: Python :: 3",
15
+ "Programming Language :: Python :: 3.11",
16
+ "Topic :: Scientific/Engineering :: Physics",
17
+ ]
18
+ # Deliberately thin: all server communication is plain `requests` HTTP —
19
+ # no heavyweight SDK dependencies.
20
+ dependencies = [
21
+ "requests>=2.31.0,<3",
22
+ "pyyaml>=6.0.1,<7",
23
+ "platformdirs>=4,<5",
24
+ "pydantic>=2.5.0,<3",
25
+ "pydantic-settings>=2.0.0,<3",
26
+ ]
27
+
28
+ [project.optional-dependencies]
29
+ dev = [
30
+ "pytest>=8.0.0",
31
+ ]
32
+
33
+ [project.scripts]
34
+ qatlas = "qatlas.cli:main"
35
+
36
+ [build-system]
37
+ requires = ["hatchling>=1.24"]
38
+ build-backend = "hatchling.build"
39
+
40
+ [tool.hatch.build.targets.wheel]
41
+ packages = ["src/qatlas"]
42
+
43
+ # Commitizen: `cz bump` bumps [project].version via the uv provider and
44
+ # tags v<version>; the tag push triggers .github/workflows/release.yml.
45
+ [tool.commitizen]
46
+ name = "cz_conventional_commits"
47
+ tag_format = "v$version"
48
+ version_scheme = "pep440"
49
+ version_provider = "uv"
50
+ update_changelog_on_bump = true
51
+ major_version_zero = true
52
+ annotated_tag = true
53
+
54
+ [tool.pytest.ini_options]
55
+ testpaths = ["tests"]
56
+ # Live-network tests are opt-in: the default run must be fully offline.
57
+ addopts = "-m 'not network'"
58
+ markers = [
59
+ "network: opt-in tests that call real external APIs",
60
+ "e2e: end-to-end tests that load the repository .env and exercise real external services",
61
+ ]
@@ -0,0 +1,48 @@
1
+ """
2
+ QuantumAtlas - AI 驱动的量子算法开发辅助系统
3
+
4
+ 核心功能:从论文到可执行量子代码的完整转化链路
5
+ """
6
+
7
+ from __future__ import annotations
8
+
9
+ import tomllib
10
+ from importlib.metadata import PackageNotFoundError, version
11
+ from pathlib import Path
12
+
13
+
14
+ def _version_from_pyproject() -> str:
15
+ """Read [project].version from the nearest repo-root pyproject.toml.
16
+
17
+ Supports both the legacy flat layout (``qatlas/`` at the repo root,
18
+ pyproject at ``parents[1]``) and the src layout (``src/qatlas/``,
19
+ pyproject at ``parents[2]``).
20
+ """
21
+ here = Path(__file__).resolve()
22
+ for parent in (here.parents[1], here.parents[2]):
23
+ pyproject = parent / "pyproject.toml"
24
+ if not pyproject.is_file():
25
+ continue
26
+ with pyproject.open("rb") as f:
27
+ data = tomllib.load(f)
28
+ try:
29
+ return str(data["project"]["version"])
30
+ except KeyError:
31
+ continue
32
+ raise FileNotFoundError("no pyproject.toml with [project].version found")
33
+
34
+
35
+ def _resolve_version() -> str:
36
+ """Prefer repo pyproject when present, else installed distribution metadata."""
37
+ try:
38
+ return _version_from_pyproject()
39
+ except (FileNotFoundError, KeyError, OSError):
40
+ try:
41
+ return version("qatlas-cli")
42
+ except PackageNotFoundError:
43
+ return "0+unknown"
44
+
45
+
46
+ __version__ = _resolve_version()
47
+
48
+ __all__ = ["__version__"]