You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
No abstract.pyi that pyright can read. I understand that pyright only can read static with simpler declaration. So I made crude one as test and put it in .env/lib/python3.13/site-packages/talib/abstract.pyi
# abstract.pyi
import numpy as np
import pandas as pd
from numpy.typing import NDArray
from typing import Union
_Array = NDArray[np.float64]
_Input = Union[pd.DataFrame, _Array]
def BBANDS(
input: _Input,
timeperiod: int = 5,
nbdevup: float = 2,
nbdevdn: float = 2,
matype: int = 0,
) -> pd.DataFrame: ...
I run test again, got no error and my LSP can give proper function signature. Amazing right?
Thanks for the green light . I still considering a script that can automatically generate it from source code. Do you have any newer thought about #212 from 2018?
You can get pretty far by modifying the _ta_lib.pyi probably.
Regarding #212, i didn't like a bunch of things about it, but partly i didn't like the instantiation of a new abstract function per function call, but sure if you want to do something there thats nice, sure.
Activity
mrjbq7 commentedon Mar 6, 2026
Wat?
AchmadFathoni commentedon Mar 6, 2026
Sorry, but which part you don't understand?
mrjbq7 commentedon Mar 6, 2026
Can you give me an example that would be nicer?
AchmadFathoni commentedon Mar 6, 2026
Let's use something simpler like https://github.com/freqtrade/freqtrade/blob/develop/tests/test_talib.py. We use pandas as input to TA-Lib function.
when I run
pyright test_talib.pyI gotWow why is that? Then I check the content of installed TA-lib
No abstract.pyi that pyright can read. I understand that pyright only can read static with simpler declaration. So I made crude one as test and put it in
.env/lib/python3.13/site-packages/talib/abstract.pyiI run test again, got no error and my LSP can give proper function signature. Amazing right?
mrjbq7 commentedon Mar 6, 2026
Nice! Feel free to contribute that !
AchmadFathoni commentedon Mar 6, 2026
Thanks for the green light . I still considering a script that can automatically generate it from source code. Do you have any newer thought about #212 from 2018?
mrjbq7 commentedon Mar 6, 2026
You can get pretty far by modifying the
_ta_lib.pyiprobably.Regarding #212, i didn't like a bunch of things about it, but partly i didn't like the instantiation of a new abstract function per function call, but sure if you want to do something there thats nice, sure.
We have generate scripts in tools/.
AchmadFathoni commentedon Mar 6, 2026
Alright. Anyway what python LSP do you use? Maybe there is better alternative than pyright itself.