Skip to content

Recap of PackageCompiler.jl push #26

@etpinard

Description

@etpinard

Writing down some info and thoughts that might useful to other Dash component developers that want to support Julia


Release v1.3.1 is the first release which made DashTextareaAutocomplete functional in PackageCompiler compiled apps.

We did so by adding a Artifact.toml to this project (more info on Julia Artifacts here). Julia artifacts only support publicly-available URLs of tarballs as targets, so we tar'ed the min.js and min.js.map files in deps/ in an extra build sub-command. After npm publish, this tarball is then available on unpkg.com e.g. at https://unpkg.com/[email protected]/deps/deps.tar.gz

In postbuild_fixups.sh, we:

  1. include the Pkg.Artifacts module in src/DashTextareaAutocomplete.jl and addPkg in the Project.toml deps
  2. use the artifact"" string macro to include the tarball content in src/DashTextareaAutocomplete.jl upon initialisation (see Resolve resource path during init #21)
  3. update the Artifact.toml specifications accordingly

(along with patching for #11)

PR #25 may eventually streamline this process a little bit more and perhaps make it more robust as well.

Drawbacks

  • We can't install DashTextareaAutocomplete before we npm publish (as Pkg.add requires the unpkg.com URL to download the artifact). That is, we can't install a dev version of DashTextareaAutocomplete from e.g. a github URL.

    Using RelocatableFolders.jl as demonstrated in Try RelocatableFolders.jl #20 would fix this problem, but this would perhaps uncover new problems such as adding a 0.x dependency to DashTextareaAutocomplete and potentially leading to slower performing apps.

  • Some of the operations in postbuild_fixups.sh are non trivial.

    The modifications of src/DashTextareaAutocomplete.jl by the postbuild_fixups.sh script could eventually make their way to dash's dash-generate-components julia component logic. Creating a tarball with min.js and min.js.map files from python wouldn't be too hard either.

    But trying to replicate the "update Artifact.toml specifications" step in python might be tricky (can we replicate the behaviour of Tar.tree_hash and sha256 identically in python?) and a bit of a moving target (what if Julia artifacts undergo a breaking change in a future release?). So, I think it would be safer to use a Julia script, but then maybe asking for all Dash component devs to have julia installed to build their components is too much?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions