Giter Site home page Giter Site logo

Comments (4)

zvi-quantivly avatar zvi-quantivly commented on June 7, 2024

I tried excluding self inside DjangoDash.get_expanded_arguments() (see here). Unfortunately, there was no difference.

from django-plotly-dash.

GibbsConsulting avatar GibbsConsulting commented on June 7, 2024

@zvi-quantivly what is the driver behind wanting to embed the DjangoDash instance inside a class? In particular, is there something specific that leads you to this code structure?

from django-plotly-dash.

zvi-quantivly avatar zvi-quantivly commented on June 7, 2024

Yes. It's a little difficult to explain briefly, but I am working on a Django project that needs to be able to run user provided code as a β€œplugin”. Each plugin is written as a small Python package that depends on a common SDK and exposes a subclass of some base Plugin class (from the SDK). These plugin subclasses are dynamically imported, initialized, and executed by the project. The initialization procedures populate specific plugin attributes with endpoints and authorization information that is required for its execution.

E.g., if we consider the example above, Base provides something like self.run_query(), which uses an attribute such as self.server_address, which is populated by the Django project as part of the initialization of a plugin. The self.update_plot() method needs to be able to use self.run_query() to run. HTH.

from django-plotly-dash.

zvi-quantivly avatar zvi-quantivly commented on June 7, 2024

It looks like the source of the problem is that setting method attributes on bound methods is disallowed [ref]. This happens in the custom callback() decorator's func.expanded assignment (here) whenever self.app.callback(...)(self.some_method) is called (in which case, func is a bound method). I still haven't found a solution for this. Now trying to think whether function objects (see second example here) might somehow work.

from django-plotly-dash.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.