question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

feature request: provider for "self"

See original GitHub issue

I would like a provider to be able to pass a container as an argument:

class Container(containers.DeclarativeContainer):

    foo = providers.Callable(calc_foo, containers.MarkerForContainer)
    bar = providers.Object('hello')

container = Container()
container.override_providers(container=container)

def calc_foo(container):
    print(container.bar())

container.foo()  # prints "hello" - ?

I assume that is impossible to do directly, right now? I guess perhaps I could do:


class Container(containers.DeclarativeContainer):

    container = providers.DependenciesContainer()
    foo = providers.Callable(calc_foo, container)
    bar = providers.Object('hello')

container = Container()
container.override_providers(container=container)

def calc_foo(container):
    print(container.bar())

container.foo()  # prints "hello" - ?

But having the container work without having to put cheese in it (to use a mousetrap analogy) would be great… any chance of something like the former (if indeed it isn’t possible)?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
rmk135commented, Feb 8, 2021

@shaunc Closing this issue. Let me know if you have any questions.

0reactions
rmk135commented, Feb 9, 2021

Thanks @shaunc

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Collect and Manage Feature Requests in SaaS
In this article, we'll cover several methods for collecting and managing feature requests to meet customer expectations for your SaaS.
Read more >
Feature Requests: What are they and how to manage them
Feature requests are a form of product feedback you may frequently encounter as a SaaS product manager. They typically come in the form...
Read more >
Feature-Request - au2mator - Self Service Portal
#FEATURE REQUEST. Tell us what you want to see next at au2mator – Self Service Portal or vote on a Feature Request.
Read more >
How To Manage Feature Requests [Template included]
This guide will teach you everything about feature requests – how to process them, manage them, respond to them, prioritize them – so...
Read more >
Feature Request Template: How to Manage Suggestions at ...
A feature request is a user's attempt at coming up with a solution to a problem they encountered while using your product. As...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found