I'm trying to write a framework using decorators and I want the user code to be as clean as possible but also work well with python hints and I have some trouble.
Imagine the next scenario:
framework.py:
from dependency import (getSomeThirdPartyPythonClass, SomeClass)
def my_framework_decorator(function):
def wrapper():
dependency : SomeClass = getSomeThirdPartyPythonClass()
function(function)
return wrapper
framework_user.py:
from framework import my_framework_decorator
@my_framework_decorator
def user_foo(dependency):
dependency. # and now I want auto complete of the SomeClass's functions and members
# from the IDE or from the linter.
I don't want to make the users import from "dependency"
Worth mentioning that I'm working with vscode but tried also pycharm and in both, I'm not getting the wanted result. I played with the setting.json file and the linter attributes but nothing helped.
If you can point for some good linter tool or familiar with a solution to the problem or mention some other elegant approach it will be great.