Comments (4)
In case anyone else stumbles here someday, here's the code snippet of how we're handling this currently. Instead of dash.callback
, we made mylib.callback
and use it in the same way:
P = typing.ParamSpec("P") # Params to dash.callback (e.g. dash.Outputs, dash.Inputs)
F = typing.TypeVar( # Signature of our function being passed to dash.callback
"F", bound=typing.Callable[..., typing.Any]
)
@functools.wraps(dash.callback) # Just meta-fun, not the usage of `functools.wraps` I'm asking about...
def callback(
*dash_io_args: P.args,
**dash_io_kwargs: P.kwargs,
) -> typing.Callable[[F], F]:
"""wraps dash.callback to enable introspection to access the underlying function"""
def our_decorator(f: F) -> F:
"""The inner closure that nests two decorators (functools.wraps and dash.callback)"""
return functools.wraps(f)(dash.callback(*dash_io_args, **dash_io_kwargs)(f))
return our_decorator
from dash.
Upon further review, it appears that the reason we didn't see a mycallback.__wrapped__
was that the callback wrapping functionality stores the wrapped function elsewhere, but then just returns back the original function from the decorator. I'm double checking, but I think that this means this could all be shut down. Sorry for the inconvenience.
from dash.
Indeed, dash.callback()
returns the original function unaltered and unwrapped. It does create a wrapped version, but it stores that in its own internal ~namespace. So I'm closing this down. Sorry y'all.
from dash.
Thanks @shea-parkes - yes up to v2.3 we returned the wrapper but this was fixed in v2.4.0 via #1839
from dash.
Related Issues (20)
- [Feature Request] Supports more flexible and free component type properties HOT 1
- [BUG] Meta tags don't work for Dash pages when app is integrated into Flask app HOT 1
- [BUG] width of the dcc.Input field does not scale properly when step=None HOT 6
- [BUG] OSError: [WinError 10048] Only one usage of each socket address (protocol/network address/port) is normally permitted HOT 5
- [BUG] title option in
- [BUG] title option in options seems to not work. HOT 1
- [BUG] Error loading dependencies HOT 7
- [Feature Request] openssf scorecard
- [Feature Request] Expose `dash.NoUpdate` for Type Hinting HOT 6
- Delete Data from Heat Figs with Patch() [Feature Request] HOT 4
- [Feature Request] Global set_props in backend callbacks. HOT 2
- [BUG] The `infer_jupyter_proxy_config` method does not work due to timeout
- CI broken due to `flaky` incompatibility with latest `pytest`
- Improved Datatables HOT 3
- Background callbacks with celery + redis getting 204s HOT 1
- How does the new version of dash dynamically create callback HOT 1
- When there are three identical outputs, the allow_duplicate is set and an error will be reported. HOT 5
- dash title design issues HOT 3
- [BUG] When using multiple instances of dash on a flask server, they cannot share the same page name, even though they have different url routes HOT 4
- How does dash combine with flask jwt? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dash.