Problem
trend_analysis is listed in __all__ at python/eo_processor/__init__.py:151 and documented as a public top-level function in the README, but it is neither imported from ._core nor defined as a wrapper anywhere in __init__.py.
This means:
from eo_processor import trend_analysis → ImportError
from eo_processor import * → ImportError (star-import resolves every name in __all__, and trend_analysis is unbound)
- The README itself works around the bug by telling users to import from the private module:
from eo_processor._core import trend_analysis
This directly violates the project's own invariant from skills/python-api-surface/SKILL.md: "if it's public, it must be importable, typed, tested, and documented."
The Rust kernel works
The function is fully implemented in src/trends.rs:20 and registered into _core at src/lib.rs:100. Only the Python public surface is broken.
Scope
| File |
Change |
python/eo_processor/__init__.py |
Add trend_analysis as _trend_analysis and TrendSegment as _TrendSegment to the from ._core import (...) block. Add a thin wrapper def trend_analysis(y, threshold): ... following the existing pattern (e.g. linear_regression at ~line 349). |
python/eo_processor/__init__.pyi |
Add stub for trend_analysis(y: Sequence[float], threshold: float) -> list[TrendSegment]: ... and a class TrendSegment matching the Rust struct fields (start_index, end_index, slope, intercept). |
tests/test_trends.py |
Add tests: no-break case (large threshold → single segment), a break case (linspace(0,10,50) + linspace(10,0,50) → ≥2 segments), invalid inputs (negative threshold, NaN in y). |
README.md:321 |
Replace from eo_processor._core import trend_analysis with from eo_processor import trend_analysis. |
Acceptance criteria
Version impact
Per the project's SemVer section: exposing a previously-unexported-but-documented function is a minor bump (new public surface, backward-compatible).
Note: A bump:minor label will be needed on the PR to trigger the automated version bump and release pipeline.
Problem
trend_analysisis listed in__all__atpython/eo_processor/__init__.py:151and documented as a public top-level function in the README, but it is neither imported from._corenor defined as a wrapper anywhere in__init__.py.This means:
from eo_processor import trend_analysis→ImportErrorfrom eo_processor import *→ImportError(star-import resolves every name in__all__, andtrend_analysisis unbound)from eo_processor._core import trend_analysisThis directly violates the project's own invariant from
skills/python-api-surface/SKILL.md: "if it's public, it must be importable, typed, tested, and documented."The Rust kernel works
The function is fully implemented in
src/trends.rs:20and registered into_coreatsrc/lib.rs:100. Only the Python public surface is broken.Scope
python/eo_processor/__init__.pytrend_analysis as _trend_analysisandTrendSegment as _TrendSegmentto thefrom ._core import (...)block. Add a thin wrapperdef trend_analysis(y, threshold): ...following the existing pattern (e.g.linear_regressionat ~line 349).python/eo_processor/__init__.pyitrend_analysis(y: Sequence[float], threshold: float) -> list[TrendSegment]: ...and aclass TrendSegmentmatching the Rust struct fields (start_index,end_index,slope,intercept).tests/test_trends.pylinspace(0,10,50) + linspace(10,0,50)→ ≥2 segments), invalid inputs (negative threshold, NaN in y).README.md:321from eo_processor._core import trend_analysiswithfrom eo_processor import trend_analysis.Acceptance criteria
from eo_processor import trend_analysisworksfrom eo_processor import *works (no ImportError)__init__.pyiruff check python/eo_processor/passesVersion impact
Per the project's SemVer section: exposing a previously-unexported-but-documented function is a minor bump (new public surface, backward-compatible).
Note: A
bump:minorlabel will be needed on the PR to trigger the automated version bump and release pipeline.