plotly / plotly/dash

separate node and python build steps in dash-generate-components

Open
#1,256 0 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature P3
Dominant language
Python
Stars
24.4k
Forks
2.3k
Avg merge
2d 7h
Merged PRs (30d)
13

Description

Links for building custom components for reference:
https://dash.plotly.com/plugins
https://github.com/plotly/dash-component-boilerplate

Is your feature request related to a problem? Please describe.
Building custom dash components requires nodejs + python at the same time. It complicates CI pipeline, since it's not possible to use docker's node and python images separately, but you have to make a custom docker image with both

my Dockerfile for reference
FROM ubuntu:latest

ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update && \
    apt-get install nodejs npm python3 python3-pip -y && \
    node --version && \
    python3 --version && \
    python3 -m pip install "dash[dev]>=1.3.1"

COPY ./custom_dash_components/package.json /src/custom_dash_components/
COPY ./custom_dash_components/package-lock.json /src/custom_dash_components/
WORKDIR /src/custom_dash_components/
RUN npm i

COPY ./custom_dash_components/ /src/custom_dash_components/

RUN npm run build:js && npm run build:py

build:py is dash-generate-components ./src/lib/components custom_dash_components -p package-info.json

Describe the solution you'd like

I think it's possible to separate nodejs and python build steps, so

  1. nodejs step would build js code and generate metadata file
  2. python step would take metadata file as a cmd arg and generate python code
Related code

https://github.com/plotly/dash/blob/066e5719c0969e2210d90af69bc4a90db22e1b12/dash/development/component_generator.py#L55-L90

Describe alternatives you've considered
Another option is to generate python code in nodejs, so python is not required, but I'd guess that's harder to implement

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with dash/development/component_generator.py around lines 55-90 and the dash-generate-components command shown in the issue. Trace how the current build consumes JavaScript output and produces Python code, then define the metadata handoff between the Node.js and Python steps. Done means the two steps can run in separate environments while generating the same custom component artifacts.

Written by the indexing model from the issue text.

Assessment

Tech stack
nodejs, python
Domain
build-system, cli, developer-experience
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.