-
-
Notifications
You must be signed in to change notification settings - Fork 59
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
🚀 Feature request
Add support for objects that require asynchronous context for their creation.
Motivation
Currently I cannot instantiate objects like aiokafka.AIOKafkaProducer
. For example:
In main.py
:
import aiokafka
from jsonargparse import CLI
async def main(producer: aiokafka.AIOKafkaProducer) -> None:
print(producer)
if __name__ == "__main__":
CLI(main)
In config.yaml
:
producer:
class_path: aiokafka.AIOKafkaProducer
init_args:
bootstrap_servers: ["localhost:9092"]
In terminal:
python -m main --config config.yaml
Gives error:
RuntimeError: The object should be created within an async function or provide loop directly.
Pitch
The above code should runs without errors.
Alternatives
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request