From 6074bb8699217b4440c2987a38d4cd781f5421df Mon Sep 17 00:00:00 2001 From: Pigbibi <20649888+Pigbibi@users.noreply.github.com> Date: Wed, 5 Aug 2026 19:02:24 +0800 Subject: [PATCH] chore: bind CN strategies to QPK 2f75 Co-Authored-By: Codex --- .github/workflows/ci.yml | 1 - pyproject.toml | 2 +- qsl.toml | 2 +- tests/test_qsl_compat_metadata.py | 55 ++++++++++++++++++++++--------- uv.lock | 4 +-- 5 files changed, 43 insertions(+), 21 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index df80b6f..132e191 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -74,7 +74,6 @@ jobs: set -euo pipefail python -m pip install --upgrade pip python -m pip install -e . pandas pytest pytest-cov ruff==0.15.22 build - python -m pip install --no-deps -e external/QuantPlatformKit - name: Verify dependencies run: | diff --git a/pyproject.toml b/pyproject.toml index 69e0112..62aa5b5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -10,7 +10,7 @@ readme = "README.md" requires-python = ">=3.11" dependencies = [ "pandas>=2.0", - "quant-platform-kit @ git+https://github.com/QuantStrategyLab/QuantPlatformKit.git@5d4bbd0e7ef9a1434010e8b6a69905d39ee55f1b", + "quant-platform-kit @ git+https://github.com/QuantStrategyLab/QuantPlatformKit.git@2f75b59289ef24ab47a3ed8d522c9ef8d6aea6b2", ] [project.optional-dependencies] diff --git a/qsl.toml b/qsl.toml index 21fd900..1cba4fe 100644 --- a/qsl.toml +++ b/qsl.toml @@ -5,5 +5,5 @@ upgrade_ring = "ring_b" bundle = "2026.07.4" requires = [ "pandas>=2.0", - "quant-platform-kit @ git+https://github.com/QuantStrategyLab/QuantPlatformKit.git@5d4bbd0e7ef9a1434010e8b6a69905d39ee55f1b", + "quant-platform-kit @ git+https://github.com/QuantStrategyLab/QuantPlatformKit.git@2f75b59289ef24ab47a3ed8d522c9ef8d6aea6b2", ] diff --git a/tests/test_qsl_compat_metadata.py b/tests/test_qsl_compat_metadata.py index dd84db1..5bd8b40 100644 --- a/tests/test_qsl_compat_metadata.py +++ b/tests/test_qsl_compat_metadata.py @@ -1,9 +1,17 @@ -from pathlib import Path import tomllib +from pathlib import Path + + +ROOT = Path(__file__).resolve().parents[1] +QPK_REVISION = "2f75b59289ef24ab47a3ed8d522c9ef8d6aea6b2" +QPK_URL = ( + "quant-platform-kit @ git+https://github.com/QuantStrategyLab/" + f"QuantPlatformKit.git@{QPK_REVISION}" +) def test_qsl_compat_metadata_exists_and_bundle() -> None: - qsl_path = Path(__file__).resolve().parents[1] / "qsl.toml" + qsl_path = ROOT / "qsl.toml" assert qsl_path.exists(), "qsl.toml missing" with qsl_path.open("rb") as f: data = tomllib.load(f) @@ -11,20 +19,35 @@ def test_qsl_compat_metadata_exists_and_bundle() -> None: assert data.get("compat", {}).get("bundle") == "2026.07.4", "compat.bundle mismatch" -def test_qsl_qpk_pin_matches_project_dependency() -> None: - root = Path(__file__).resolve().parents[1] - with (root / "qsl.toml").open("rb") as f: - qsl = tomllib.load(f) - with (root / "pyproject.toml").open("rb") as f: - project = tomllib.load(f) +def test_qpk_pin_lock_and_ci_are_dependency_enabled() -> None: + with (ROOT / "pyproject.toml").open("rb") as file: + pyproject = tomllib.load(file) + with (ROOT / "qsl.toml").open("rb") as file: + qsl = tomllib.load(file) + with (ROOT / "uv.lock").open("rb") as file: + lock = tomllib.load(file) - dependency = next( - value for value in project["project"]["dependencies"] if value.startswith("quant-platform-kit @ ") - ) - qpk_pin = dependency.rsplit("@", maxsplit=1)[1] + assert QPK_URL in pyproject["project"]["dependencies"] + assert QPK_URL in qsl["compat"]["requires"] - assert dependency in qsl["compat"]["requires"] - assert ( - f"QuantPlatformKit.git?rev={qpk_pin}#{qpk_pin}" - in (root / "uv.lock").read_text(encoding="utf-8") + packages = {package["name"]: package for package in lock["package"]} + locked_qpk = packages["quant-platform-kit"] + locked_strategy = packages["cn-equity-strategies"] + assert locked_qpk["source"]["git"] == ( + "https://github.com/QuantStrategyLab/QuantPlatformKit.git" + f"?rev={QPK_REVISION}#{QPK_REVISION}" + ) + locked_requirement = next( + dependency + for dependency in locked_strategy["metadata"]["requires-dist"] + if dependency["name"] == "quant-platform-kit" ) + assert locked_requirement["git"] == ( + "https://github.com/QuantStrategyLab/QuantPlatformKit.git" + f"?rev={QPK_REVISION}" + ) + + ci = (ROOT / ".github/workflows/ci.yml").read_text(encoding="utf-8") + assert "--no-deps" not in ci + assert "python -m pip install -e ." in ci + assert "python -m pip check" in ci diff --git a/uv.lock b/uv.lock index 33fa886..22541d3 100644 --- a/uv.lock +++ b/uv.lock @@ -31,7 +31,7 @@ test = [ requires-dist = [ { name = "pandas", specifier = ">=2.0" }, { name = "pytest", marker = "extra == 'test'", specifier = ">=8" }, - { name = "quant-platform-kit", git = "https://github.com/QuantStrategyLab/QuantPlatformKit.git?rev=5d4bbd0e7ef9a1434010e8b6a69905d39ee55f1b" }, + { name = "quant-platform-kit", git = "https://github.com/QuantStrategyLab/QuantPlatformKit.git?rev=2f75b59289ef24ab47a3ed8d522c9ef8d6aea6b2" }, ] provides-extras = ["test"] @@ -315,7 +315,7 @@ wheels = [ [[package]] name = "quant-platform-kit" version = "0.10.0" -source = { git = "https://github.com/QuantStrategyLab/QuantPlatformKit.git?rev=5d4bbd0e7ef9a1434010e8b6a69905d39ee55f1b#5d4bbd0e7ef9a1434010e8b6a69905d39ee55f1b" } +source = { git = "https://github.com/QuantStrategyLab/QuantPlatformKit.git?rev=2f75b59289ef24ab47a3ed8d522c9ef8d6aea6b2#2f75b59289ef24ab47a3ed8d522c9ef8d6aea6b2" } [[package]] name = "six"