Skip to content

Improve the ContextPipeline.compose API #3265

@janbuchar

Description

@janbuchar
  • The current state (accepting an object with action and cleanup callbacks) is more of an MVP
    • type inference is less than optimal
    • it's a lot of writing
    • sharing some stuff between action and cleanup without making it part of the extended context is tricky
  • Alternative A: Accept a function that will return a cleanup callback (similarly to useEffect in React)
  • Alternative B: Accept an async generator that will yield the context extension and clean up afterwards (similarly to Pytest fixtures and to crawlee-python)
  • Alternative C: Accept an instance of a class
  • Relevant discussion https://apify.slack.com/archives/C02JQSN79V4/p1756468275920019

Metadata

Metadata

Assignees

No one assigned

    Labels

    t-toolingIssues with this label are in the ownership of the tooling team.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions