Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recap of PackageCompiler.jl push #26

Open
etpinard opened this issue Dec 20, 2021 · 1 comment
Open

Recap of PackageCompiler.jl push #26

etpinard opened this issue Dec 20, 2021 · 1 comment

Comments

@etpinard
Copy link
Owner

etpinard commented Dec 20, 2021

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/dash-textarea-autocomplete@1.3.1/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?

@waralex
Copy link

waralex commented Dec 20, 2021

Hi, @etpinard , @Felix-Gauthier !
I have been working on a new system for generating/publishing component packages for Julia from Python packages for quite some time. Unfortunately, the work is not going very fast - because my main job takes up a lot of time and working on the current issues of Dash.jl also distracts from this task.
If you have the time and desire - could you check how your package will be generated and whether it will work with PackageCompiler out of the box?
The development version of components generator is here: https://github.com/waralex/DashComponentsBuilder.jl
For more operational communication, you can write to Julia's slack in the #dash channel, or directly to me there (my nickname is waralex)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants