Dash.jl icon indicating copy to clipboard operation
Dash.jl copied to clipboard

Compatibility with `PackageCompiler.jl`

Open MichaelHatherly opened this issue 4 years ago • 4 comments

Currently Dash.jl (and the related component packages) hardcode paths to resources into globals, see https://github.com/plotly/Dash.jl/blob/dev/src/Dash.jl#L5-L6 for example. This means that the package cannot be used along with https://github.com/JuliaLang/PackageCompiler.jl since that paths are not "relocatable" (https://julialang.github.io/PackageCompiler.jl/dev/devdocs/relocatable_part_3/#Relocatability-of-Julia-packages-1).

The two standard approaches to solving this issue are to either:

  • store the actual content of the files located in the resource folders directly into the module's globals, rather than just the paths to those resources, or
  • make use of the Artifacts system (https://pkgdocs.julialang.org/dev/artifacts/) to provide the resources in PackageCompiler-friendly paths.

MichaelHatherly avatar May 20 '21 10:05 MichaelHatherly

Would this allow Julia Dash apps to be compiled into desktop executables? Sounds pretty neat if so.

image

jackparmer avatar May 27 '21 03:05 jackparmer

Yes, pretty much that. We have a workaround at the moment to force the resulting executables to be relocatable, but it's not something I'd like to keep around for too long 😆 I'm happy to look into it a bit more deeply when time allows, it'll likely require adjustments to the component generation code to avoid the hardcoding.

MichaelHatherly avatar May 27 '21 06:05 MichaelHatherly

Hi @MichaelHatherly! I wrote the PR #111 with the concept of solving this problem for the dash core. I would be grateful for your feedback and participation in its discussion. If this concept is accepted, then we can do something similar with the components

waralex avatar Jun 21 '21 08:06 waralex

Hi, @Felix-Gauthier and I recently made dash-textarea-autocomplete work in PackageCompiler compiled apps.

In https://github.com/etpinard/dash-textarea-autocomplete/issues/26, I wrote down some info on how we made things work and some thoughts on how to potentially improve the dash-generate-components command and/or dash-component-boilerplate.

Cheers! (this will be my last PackageCompiler-related comment :smirk: )

etpinard avatar Dec 20 '21 21:12 etpinard

https://github.com/plotly/Dash.jl/pull/131 essentially resolves this issue. Closing

etpinard avatar Jul 11 '23 19:07 etpinard