Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:
run: |
set -euo pipefail
python -m pip install --upgrade pip uv
uv sync --frozen --extra test --no-install-project
uv sync --frozen --extra test
- name: Smoke import pinned shared packages
run: |
set -euo pipefail
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/sync-cloud-run-env.yml
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ jobs:
run: |
set -euo pipefail
python -m pip install --upgrade pip uv
uv sync --frozen --no-dev --no-install-project
uv sync --frozen --no-dev
- name: Resolve Cloud Run sync targets
id: strategy_requirements
if: steps.config.outputs.env_sync_enabled == 'true'
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ backtest_output_*/
backtest_research/
backtest_high_offense/
research/backtests/

*.egg-info/
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@ Thanks for contributing to `LongBridgePlatform`.
Run the main verification command before opening a pull request:

```bash
python3 -m pip install -r requirements.txt && python3 -m unittest discover -s tests -v
uv sync --frozen --extra test && uv run --no-sync python -m pytest -q
```
6 changes: 2 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,8 @@ RUN apt-get update \
&& apt-get install -y --no-install-recommends git \
&& rm -rf /var/lib/apt/lists/*

COPY pyproject.toml uv.lock ./
RUN python -m pip install --upgrade pip uv \
&& uv sync --frozen --no-dev --no-install-project

COPY . .
RUN python -m pip install --upgrade pip uv \
&& uv sync --frozen --no-dev

CMD ["gunicorn", "--bind", ":8080", "--workers", "1", "--threads", "1", "--timeout", "300", "main:app"]
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Direct runtime profiles can usually run from market history or portfolio state.
## Quick start

```bash
uv sync --frozen --extra test --no-install-project
uv sync --frozen --extra test
uv run --no-sync ruff check --exclude external .
uv run --no-sync python scripts/check_qpk_pin_consistency.py
```
Expand Down
2 changes: 1 addition & 1 deletion README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ LongBridgePlatform 是 QuantStrategyLab 的LongBridge 美股/港股执行平台
## 快速开始

```bash
uv sync --frozen --extra test --no-install-project
uv sync --frozen --extra test
uv run --no-sync ruff check --exclude external .
uv run --no-sync python scripts/check_qpk_pin_consistency.py
```
Expand Down
10 changes: 0 additions & 10 deletions constraints.txt

This file was deleted.

21 changes: 18 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "longbridge-platform"
version = "0.2.0"
version = "0.3.0"
description = "QuantStrategyLab platform layer for LongBridge broker."
requires-python = ">=3.11"
dependencies = [
Expand Down Expand Up @@ -39,7 +39,22 @@ omit = ["tests/*", "*/external/*"]
show_missing = true

[tool.setuptools]
package-dir = { "" = "src" }
py-modules = [
"decision_mapper",
"main",
"runtime_config_support",
"runtime_execution_policy",
"runtime_logging",
"strategy_loader",
"strategy_registry",
"strategy_runtime",
]

[tool.setuptools.packages.find]
where = ["src"]
include = [
"application*",
"entrypoints*",
"notifications*",
"scripts*",
"strategy*",
]
13 changes: 0 additions & 13 deletions requirements.txt

This file was deleted.

5 changes: 4 additions & 1 deletion scripts/gate_codex_app_review.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ def compile_patterns(policy: dict[str, Any]) -> list[re.Pattern[str]]:

# ─── static guard ────────────────────────────────────────────────────────────

ALLOWED_REMOVED_FILES = {"constraints.txt", "requirements.txt"}

_SENSITIVE = re.compile(
r'(?:api[_\s]?key|secret|password|token|credential|private[_\s]?key)\s*[:=]\s*["\']'
r'(?!\$\{\{|{{|example|placeholder|test|your[-_\s]|xxx|TODO|CHANGEME)[^"\']{12,}["\']',
Expand Down Expand Up @@ -128,7 +130,8 @@ def check_metadata(files: list[dict[str, Any]], policy: dict[str, Any]) -> list[
for f in files:
fn = f.get("filename", "?")
st = (f.get("status") or "").lower().strip()
if st == "removed": issues.append(f"**File deleted**: `{fn}` — verify intentional")
if st == "removed" and fn not in ALLOWED_REMOVED_FILES:
issues.append(f"**File deleted**: `{fn}` — verify intentional")
elif st == "renamed": issues.append(f"**File renamed**: `{f.get('previous_filename', '?')}` → `{fn}`")
if len(files) > mx_f:
issues.append(f"**Too many files**: {len(files)} changed (limit {mx_f})")
Expand Down
4 changes: 2 additions & 2 deletions tests/test_dependency_pins.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@


def test_longport_stays_on_python_312_compatible_major() -> None:
requirements = Path("requirements.txt").read_text(encoding="utf-8")
pyproject = Path("pyproject.toml").read_text(encoding="utf-8")

assert "longport==3.0.23" in requirements
assert "longport==3.0.23" in pyproject
18 changes: 18 additions & 0 deletions tests/test_gate_codex_app_review.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
from __future__ import annotations

from scripts.gate_codex_app_review import check_metadata


def test_metadata_allows_removing_legacy_dependency_manifests() -> None:
files = [
{"filename": "requirements.txt", "status": "removed"},
{"filename": "constraints.txt", "status": "removed"},
]

assert check_metadata(files, {}) == []


def test_metadata_still_blocks_other_deleted_files() -> None:
files = [{"filename": "main.py", "status": "removed"}]

assert check_metadata(files, {}) == ["**File deleted**: `main.py` — verify intentional"]
2 changes: 1 addition & 1 deletion tests/test_sync_cloud_run_env_workflow.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ grep -Fq 'workload_identity_provider: ${{ env.GCP_WORKLOAD_IDENTITY_PROVIDER }}'
grep -Fq 'service_account: ${{ env.GCP_WORKLOAD_IDENTITY_SERVICE_ACCOUNT }}' "$workflow_file"
grep -Fq 'uses: actions/checkout@v6' "$workflow_file"
grep -Fq 'uses: actions/setup-python@v6' "$workflow_file"
grep -Fq 'uv sync --frozen --no-dev --no-install-project' "$workflow_file"
grep -Fq 'uv sync --frozen --no-dev' "$workflow_file"
grep -Fq 'id: strategy_requirements' "$workflow_file"
grep -Fq 'name: Resolve Cloud Run sync targets' "$workflow_file"
grep -Fq 'uv run --no-sync python scripts/build_cloud_run_env_sync_plan.py --json' "$workflow_file"
Expand Down
12 changes: 8 additions & 4 deletions tests/test_uv_dependency_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,15 @@ def test_ci_docker_and_env_sync_use_uv_lock() -> None:
lockfile = Path("uv.lock").read_text(encoding="utf-8")

assert lockfile.startswith("version = ")
assert "uv sync --frozen --extra test --no-install-project" in ci
assert "uv sync --frozen --extra test" in ci
assert "uv run --no-sync ruff check --exclude external ." in ci
assert "uv run --no-sync python scripts/check_qpk_pin_consistency.py" in ci
assert "uv sync --frozen --no-dev --no-install-project" in env_sync
assert "uv sync --frozen --no-dev" in env_sync
assert "uv run --no-sync python scripts/build_cloud_run_env_sync_plan.py --json" in env_sync
assert "COPY pyproject.toml uv.lock ./" in dockerfile
assert "uv sync --frozen --no-dev --no-install-project" in dockerfile
assert "COPY . ." in dockerfile
assert dockerfile.index("COPY . .") < dockerfile.index("uv sync --frozen --no-dev")
assert "uv sync --frozen --no-dev" in dockerfile
assert "python -m pip install -r requirements.txt" not in dockerfile
assert "--no-install-project" not in ci
assert "--no-install-project" not in env_sync
assert "--no-install-project" not in dockerfile
2 changes: 1 addition & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading