Callable[[List[str]], List[Book]] NotShownBooks = Callable[[List[Book]], List[Book]] # DI: container = punq.Container() container.register(BookNamesByIds, my_book_repo) container.register(FilterPreferedBooks, my_api) container.register(NotShownBooks, my_cache) # Somewhere: container.resolve(RecommendedBooks)([1, 2, 3]) !56