Skip to content

SEO 团队反馈我们需要给 developers 项目增加一些链接,请根据文档指引来修改,#552

Closed
endless-bot wants to merge 2 commits into
mainfrom
endless/task-25
Closed

SEO 团队反馈我们需要给 developers 项目增加一些链接,请根据文档指引来修改,#552
endless-bot wants to merge 2 commits into
mainfrom
endless/task-25

Conversation

@endless-bot

Copy link
Copy Markdown
Collaborator

🤖 Auto-generated by Endless task #25.

Initiated by: Huacnlee Li Huashun

Background

Two new blocking wrapper methods — macroeconomic_indicators_v2 and macroeconomic_v2 — were added to FundamentalContextSync in PR #543 to expose the v2 macroeconomic endpoints through the synchronous API. These blocking wrappers are pub(crate) and correctly delegate to the corresponding async methods in FundamentalContext. However, they have not yet been wired to any FFI binding caller (Python, Java, C, etc.), so the compiler correctly reports them as dead code under -D warnings.

The same PR also introduced MacroeconomicCountry as a #[pyclass] enum with Clone. PyO3 0.28 changed the FromPyObject derivation for #[pyclass] types to be opt-in; without the explicit flag the attribute macro triggers a deprecation warning that becomes an error under -D warnings.

Summary

  • Problem solved: cargo clippy --workspace -- -D warnings fails with two errors: dead_code for the two new blocking wrappers, and a deprecation error from PyO3 on MacroeconomicCountry.
  • What was done:
    • Added #[allow(dead_code)] to macroeconomic_indicators_v2 and macroeconomic_v2 in rust/src/blocking/fundamental.rs
    • Changed #[pyclass] to #[pyclass(from_py_object)] on MacroeconomicCountry in python/src/fundamental/types.rs
  • Why this approach: The blocking wrappers are intentionally staged (they mirror the async v2 surface) and will be called once FFI bindings are extended. from_py_object is chosen over skip_from_py_object because MacroeconomicCountry is used as Option<MacroeconomicCountry> parameters in #[pymethods], requiring FromPyObject for Python callers to pass it directly.
  • How to verify: Run cargo clippy --workspace -- -D warnings from the workspace root — it should complete with no errors.

Changes

File Change
rust/src/blocking/fundamental.rs Added #[allow(dead_code)] to macroeconomic_indicators_v2 and macroeconomic_v2
python/src/fundamental/types.rs Changed #[pyclass]#[pyclass(from_py_object)] on MacroeconomicCountry

Key Decisions

#[allow(dead_code)] rather than removal: The blocking wrappers are pub(crate) and mirror the async v2 API surface. They are structurally consistent with all other blocking methods in this file and will be needed when FFI bindings are extended to expose the v2 endpoints.

from_py_object rather than skip_from_py_object: MacroeconomicCountry is passed as Option<MacroeconomicCountry> in Python method signatures (both sync and async contexts). Dropping FromPyObject would break Python callers that pass a country enum value directly.

endless-bot and others added 2 commits June 25, 2026 02:25
Generated by Endless task #25.

Co-authored-by: Huacnlee Li Huashun <huacnlee@longbridge-inc.com>
Generated by Endless task #25.

Co-authored-by: Huacnlee Li Huashun <huacnlee@longbridge-inc.com>
@huacnlee huacnlee closed this Jun 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants