Package: dask-labextension
Dask JupyterLab ExtensionThis package provides a JupyterLab extension to manage Dask clusters,
as well as embed Dask's dashboard plots directly into JupyterLab panes.Explanatory Video (5 minutes)RequirementsJupyterLab >= 1.0
distributed >= 1.24.1InstallationTo install the Dask JupyterLab extension you will need to have JupyterLab installed.
For JupyterLab < 3.0, you will also needNode.jsversion >= 12.
These are available through a variety of sources.
One source common to Python users is the conda package manager.condainstalljupyterlab
condainstall-cconda-forgenodejsJupyterLab 4.xInstall the latest version of the extension for the JupyterLab 4
support. You should be able to install this extension with pip or conda,
and start using it immediately, e.g.pipinstalldask-labextensionJupyterLab 3.xFor JupyterLab 3.x, use lastest supported version6.2.0.pipinstalldask-labextension==6.2.0JupyterLab 2.xPrior to JupyterLab 3.0 client-side and server-side components needed
to be installed separately, with node available on the machine.The server-side component can be installed via pip or conda-forge:pipinstall'dask_labextension<5'condainstall-cconda-forge'dask-labextension<5'You then build the client-side extension into JupyterLab with:jupyterlabextensioninstalldask-labextensionIf you are running Notebook 5.2 or earlier, enable the server extension by runningjupyterserverextensionenable--py--sys-prefixdask_labextensionConfiguration of Dask cluster managementThis extension has the ability to launch and manage several kinds of Dask clusters,
including local clusters and kubernetes clusters.
Options for how to launch these clusters are set via thedask configuration system,
typically a.ymlfile on disk.By default the extension launches aLocalCluster, for which the configuration is:labextension:factory:module:'dask.distributed'class:'LocalCluster'args:[]kwargs:{}default:workers:nulladapt:null# minimum:0# maximum: 10initial:[]# - name: "My Big Cluster"#   workers: 100# - name: "Adaptive Cluster"#   adapt:#     minimum: 0#     maximum: 50In this configuration,factorygives the module, class name, and arguments needed to create the cluster.
Thedefaultkey describes the initial number of workers for the cluster, as well as whether it is adaptive.
Theinitialkey gives a list of initial clusters to start upon launch of the notebook server.In addition toLocalCluster, this extension has been used to launch several other Dask cluster
objects, a few examples of which are:A SLURM cluster, usinglabextension:factory:module:'dask_jobqueue'class:'SLURMCluster'args:[]kwargs:{}A PBS cluster, usinglabextension:factory:module:'dask_jobqueue'class:'PBSCluster'args:[]kwargs:{}AKubernetes cluster, usinglabextension:factory:module:dask_kubernetesclass:KubeClusterargs:[]kwargs:{}Configuring a default layoutThis extension can store a default layout for the Dask dashboard panes,
which is useful if you find yourself reaching for the same dashboard charts over and over.
You can launch the default layout via the command palette,
or by going to the File menu and choosing "Launch Dask Dashboard Layout".Default layouts can be configured via the JupyterLab config system
(either using the JSON editor or the user interface).
Specify a layout by writing a JSON object keyed by theindividual chartsyou would like to open.
Each chart is opened with amode, and aref.moderefers to how the chart is to be added to the workspace.
For example, if you want to split a panel and add the new one to the right, choosesplit-right.
Other options aresplit-top,split-bottom,split-left,tab-after, andtab-before.refrefers to the panel to whichmodeis applied, and might be the names of other dashboard panels.
Ifrefisnull, the panel in question is added at the top of the layout hierarchy.A concrete example of a default layout is{"individual-task-stream":{"mode":"split-right","ref":null},"individual-workers-memory":{"mode":"split-bottom","ref":"individual-task-stream"},"individual-progress":{"mode":"split-right","ref":"individual-workers-memory"}}which adds the task stream to the right of the workspace,
then adds the worker memory chart below the task stream,
then adds the progress chart to the right of the worker memory chart.Development installAs described in theJupyterLab documentationfor a development install of the labextension you can run the following in this directory:jlpm# Install npm package dependenciesjlpmbuild# Compile the TypeScript sources to Javascriptjupyterlabextensiondevelop.--overwrite# Install the current directory as an extensionTo rebuild the extension:jlpmbuildYou should then be able to refresh the JupyterLab page
and it will pick up the changes to the extension.To run an editable install of the server extension, runpipinstall-e.
jupyterserverextensionenable--sys-prefixdask_labextensionPublishingThis extension contains a front-end component written in TypeScript
and a back-end component written in Python.
The front-end is compiled to Javascript during the build process
and is distributed as static assets along with the Python package.Release processThis requiresnode,build,hatchandtwineto be installed.# To set version (e.g. 7.0.0). hatch will update version string in package.jsonhatchversion"7.0.0"# Examples of bumping version# minor bumphatchversionminor# Bumps to 7.1.0# beta pre-release bump# If published to pypi this can be installed with the --pre flag to piphatchversionb# Bumps to 7.1.0b0# bump minor and betahatchversionminor,b# Bumps to 7.2.0b0# release all of the --pre-release flags such as alpha beta rchatchrelease# Bumps to 7.2.0# git commit after bumping versiongitaddpackage.json&&gitcommit-m"Bump version: {version}"# Tag this versiongittag{version}# Finally push to main, build and upload package to PyPIgitpushupstreammain&&gitpushupstreammain--tags# pushes to GitHubpython-mbuild.# Build the packagetwineuploaddist/*# Upload the package to PyPIHandling Javascript package version conflictsUnlike Python, Javascript packages can include more than one version of the same dependency.
Usually theyarnpackage manager handles this okay, but occasionally you might end up with conflicting versions,
or with unexpected package bloat.
You can try to fix this by deduplicating dependencies:jlpmyarn-deduplicate-sfewer