|
| 1 | +# Generate Dash.jl artifacts |
| 2 | + |
| 3 | +Dash.jl uses Julia |
| 4 | +[Artifacts](https://docs.julialang.org/en/v1/stdlib/Artifacts/) to load |
| 5 | +front-end resources that Dash.jl shares with the python version of |
| 6 | +[dash](https://github.com/plotly/dash). |
| 7 | + |
| 8 | +The [Artifacts.toml](../Artifacts.toml) file lists the location of the |
| 9 | +publicly-available tarball containing all the required resources. |
| 10 | + |
| 11 | +The tarballs are hosted on the |
| 12 | +[DashCoreResources](https://github.com/plotly/DashCoreResources) repo, under |
| 13 | +_Releases_. They are generated and deployed using the `generate.jl` script in |
| 14 | +this directory. |
| 15 | + |
| 16 | +## How to run `generate.jl` ? |
| 17 | + |
| 18 | +### Step 0: get push rights to `DashCoreResources` |
| 19 | + |
| 20 | +### Step 1: get GitHub personal access token |
| 21 | + |
| 22 | +See [GitHub docs](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#creating-a-fine-grained-personal-access-token) |
| 23 | +for more info. |
| 24 | + |
| 25 | +If using a fine-grained token, make sure to enable _Read and Write access to code_. |
| 26 | + |
| 27 | +### Step 2: expose your token into your shell |
| 28 | + |
| 29 | +```sh |
| 30 | +# for example: |
| 31 | +export GITHUB_TOKEN="<your GitHub personal access token>" |
| 32 | +``` |
| 33 | + |
| 34 | +### Step 3: run `generate.jl` |
| 35 | + |
| 36 | +```sh |
| 37 | +cd Dash.jl/gen_resources |
| 38 | + |
| 39 | +# install `generate.jl` deps |
| 40 | +julia --project -e 'import Pkg; Pkg.instantiate()' |
| 41 | + |
| 42 | +# generate `gen_resources/build/deploy/` content, |
| 43 | +# but do not deploy! |
| 44 | +julia --project generate.jl |
| 45 | + |
| 46 | +# if everything looks fine, |
| 47 | +# generate `gen_resources/build/deploy/` content (again) and |
| 48 | +# deploy to the `DashCoreResource` releases with: |
| 49 | +julia --project generate.jl --deploy |
| 50 | +``` |
| 51 | + |
| 52 | +#### If `generate.jl` errors |
| 53 | + |
| 54 | +<details> |
| 55 | +<summary>with a PyError / PyImport error</summary> |
| 56 | + |
| 57 | +that is an error like: |
| 58 | + |
| 59 | +```sh |
| 60 | +ERROR: LoadError: PyError (PyImport_ImportModule |
| 61 | + |
| 62 | +The Python package dash could not be imported by pyimport. Usually this means |
| 63 | +that you did not install dash in the Python version being used by PyCall. |
| 64 | + |
| 65 | +PyCall is currently configured to use the Python version at: |
| 66 | + |
| 67 | +/usr/bin/python3 |
| 68 | +``` |
| 69 | +
|
| 70 | +try |
| 71 | +
|
| 72 | +```jl |
| 73 | +using PyCall |
| 74 | +ENV["PYTHON"] = joinpath(homedir(), ".julia/conda/3/x86_64/bin") |
| 75 | +import Pkg |
| 76 | +Pkg.build("PyCall") |
| 77 | +# check that it matches with |
| 78 | +PyCall.pyprogramname |
| 79 | +``` |
| 80 | +
|
| 81 | +and then re-run `generate.jl`. |
| 82 | +
|
| 83 | +</details> |
| 84 | +
|
| 85 | +### Step 4: Commit the changes to `Artifacts.toml` |
| 86 | +
|
| 87 | +and push to [plotly/Dash.jl](https://github.com/plotly/Dash.jl) |
| 88 | +(preferably on a new branch) to get a CI test run started. |
0 commit comments