Skip to content

[Python] Feat: Dependency Injection #2067

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from
Draft

Conversation

mrkaye97
Copy link
Contributor

@mrkaye97 mrkaye97 commented Jul 30, 2025

Description

Adds FastAPI-style dependency injection in Python

Open questions

  • Should dependencies accept context + workflow input as args?
  • How do we get type checking to work properly?

Also, should we also expose some kinds of callbacks / hooks / lifespans on the tasks, e.g.:

  • pre_run_hook, on_success_hook, on_exception_hook which return nothing but allow for setup + cleanup
    • pre-run would take input + ctx, on success input, ctx, output, and on exception input, ctx, and the exception
  • task_lifespan which yields nothing but allows for setup + cleanup
  • should there be some kind of global hook? or only task level?
  • can we propagate these through the task defaults?

Type of change

  • New feature (non-breaking change which adds functionality)

Copy link

vercel bot commented Jul 30, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
hatchet-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 30, 2025 10:49pm
hatchet-v0-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 30, 2025 10:49pm

@mrkaye97 mrkaye97 force-pushed the mk/dependency-injection branch from d221772 to 7c9d268 Compare July 30, 2025 22:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant