Files
pandas-ta-classic/pandas_ta_classic/trend/__init__.py
T
rmarcink 59ccbb40ca refactor(core): lazy-load AnalysisIndicators and category subpackages
Replace eager wildcard-imports with on-demand attribute resolution.
Cold import drops from ~930 ms to ~280 ms because no indicator function
runs at import time. Public API is preserved.

* `_lazy_subpackage.install_lazy_subpackage` installs `__getattr__` /
  `__dir__` on every category package so `from <cat> import <name>`
  imports `<cat>/<name>.py` only on first access. Supports aliases (e.g.
  `math.max` -> `math.rolling_max`) and special targets (e.g.
  `candles.cdl` lives inside `candles/cdl_pattern.py`).
* `_indicator_loader._make_ta_wrapper` builds a per-indicator
  `AnalysisIndicators` method from the underlying function signature,
  invoked lazily by the new `AnalysisIndicators.__getattr__`. The old
  hand-written wrapper class (2400+ lines) is gone.
* Top-level `pandas_ta_classic.__getattr__` resolves bare names like
  `ta.rsi` and individual candle submodules (`ta.cdl_2crows`). It also
  exposes `ALL_PATTERNS` and emits a `DeprecationWarning` for the legacy
  `CDL_PATTERN_NAMES` alias.
* `core.pyi` + `tools/gen_core_stub.py` give IDEs and mypy full
  signatures for every accessor method; the stub is generated from
  Category at build time.
* All ten category `__init__.py` files collapse to a single
  `install_lazy_subpackage(__name__)` call.
* `math` joins `_VALID_CATEGORIES` so the loader discovers its operators
  alongside other indicators.
* `tests/test_indicator_candle.py` switches to the new public
  `ALL_PATTERNS` name.
2026-06-27 17:47:39 +02:00

4 lines
106 B
Python

from pandas_ta_classic._lazy_subpackage import install_lazy_subpackage
install_lazy_subpackage(__name__)