dishka

Provide a Python dependency injection framework for managing object lifecycles.

15|4|Updated Jan 20, 2026
One-click install
npx skills add https://github.com/cofin/flow --skill dishka
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: dishka
Source: https://github.com/cofin/flow/tree/main/skills/dishka
Command: npx skills add https://github.com/cofin/flow --skill dishka

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill simplifies managing complex dependencies in Python applications, especially within web frameworks like Litestar and FastAPI, by providing a robust and intuitive dependency injection system.

Core Features & Use Cases

  • Automated Dependency Resolution: Automatically injects required objects into your functions and classes.
  • Scoped Lifetimes: Manages the lifecycle of dependencies with application, request, action, and step scopes.
  • Framework Integrations: Seamlessly integrates with Litestar, FastAPI, and Click for streamlined development.
  • Use Case: When building a web API with Litestar, use this Skill to manage database connections, user services, and configuration objects, ensuring they are correctly instantiated and available where needed.

Quick Start

Use the dishka skill to set up a Litestar application with dependency injection.

Frequently Asked Questions about dishka

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I manage dependency injection in a FastAPI application?

Dependency injection in FastAPI is managed by defining providers and scopes to automate the provisioning of services, configurations, and resources directly into your application functions.

What is the best way to handle object lifecycles and scopes in Python web APIs?

Handling object lifecycles in Python web APIs involves using scoped lifetimes such as application, request, action, and step scopes to control how dependencies are instantiated and cleaned up.

Can I use dependency injection with Litestar and Click CLI applications?

Yes, dependency injection integrates seamlessly with Litestar and Click, enabling streamlined web development and supporting CLI applications with asynchronous injection capabilities.

How do I mock dependencies for testing in Python?

Mocking dependencies for testing in Python utilizes robust testing utilities that allow you to override defined providers, ensuring isolated unit tests without requiring actual database connections or external services.

Does dishka support async dependency injection for CLI tools?

Yes, dishka supports CLI applications with async injection capabilities, allowing you to manage asynchronous resources and services seamlessly within command-line interfaces.