Using bare Python objects as resources
When starting to build a set of assets or jobs, you may want to use a bare Python object without configuration as a resource, such as a third-party API client.
Dagster supports passing plain Python objects as resources. This follows a similar pattern to using a ConfigurableResource subclass; however, assets that use these resources must annotate them with ResourceParam. This annotation lets Dagster know that the parameter is a resource and not an upstream input.
    import dagster as dg
    # `ResourceParam[GitHub]` is treated exactly like `GitHub` for type checking purposes,
    # and the runtime type of the github parameter is `GitHub`. The purpose of the
    # `ResourceParam` wrapper is to let Dagster know that `github` is a dg.resource and not an
    # upstream dg.asset.
    @dg.asset
    def public_github_repos(github: dg.ResourceParam[GitHub]):
        return github.organization("dagster-io").repositories()
    defs = dg.Definitions(
        assets=[public_github_repos],
        resources={"github": GitHub(...)},
    )