{"id":13421808,"url":"https://github.com/dask/dask-labextension","last_synced_at":"2025-03-15T10:31:24.857Z","repository":{"id":37612031,"uuid":"69283044","full_name":"dask/dask-labextension","owner":"dask","description":"JupyterLab extension for Dask","archived":false,"fork":false,"pushed_at":"2025-02-24T14:15:34.000Z","size":3700,"stargazers_count":318,"open_issues_count":46,"forks_count":65,"subscribers_count":16,"default_branch":"main","last_synced_at":"2025-03-15T04:54:12.233Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dask.png","metadata":{"funding":{"github":["numfocus"],"custom":["https://numfocus.org/donate-to-dask"],"tidelift":"pypi/dask"},"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2016-09-26T19:01:37.000Z","updated_at":"2025-03-05T14:20:18.000Z","dependencies_parsed_at":"2023-02-18T08:46:04.956Z","dependency_job_id":"7a0b4ae1-e195-457b-9aec-6a209ce1c41b","html_url":"https://github.com/dask/dask-labextension","commit_stats":{"total_commits":324,"total_committers":25,"mean_commits":12.96,"dds":0.5864197530864197,"last_synced_commit":"99c4d2a1a1cbff61322356be6566432e87c4d72f"},"previous_names":[],"tags_count":37,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dask%2Fdask-labextension","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dask%2Fdask-labextension/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dask%2Fdask-labextension/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dask%2Fdask-labextension/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dask","download_url":"https://codeload.github.com/dask/dask-labextension/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243685556,"owners_count":20330982,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-30T23:00:30.330Z","updated_at":"2025-03-15T10:31:24.157Z","avatar_url":"https://github.com/dask.png","language":"TypeScript","funding_links":["https://github.com/sponsors/numfocus","https://numfocus.org/donate-to-dask","https://tidelift.com/funding/github/pypi/dask"],"categories":["Uncategorized","Python","others","JupyterLab扩展","JupyterLab Extensions","TypeScript"],"sub_categories":["Uncategorized"],"readme":"# Dask JupyterLab Extension\n\n[![Build Status](https://github.com/dask/dask-labextension/actions/workflows/python.yaml/badge.svg)](https://github.com/dask/dask-labextension/actions/workflows/python.yaml) [![Version](https://img.shields.io/npm/v/dask-labextension.svg)](https://www.npmjs.com/package/dask-labextension) [![Downloads](https://img.shields.io/npm/dm/dask-labextension.svg)](https://www.npmjs.com/package/dask-labextension) [![Dependencies](https://img.shields.io/librariesio/release/npm/dask-labextension.svg)](https://libraries.io/npm/dask-labextension)\n\nThis package provides a JupyterLab extension to manage Dask clusters,\nas well as embed Dask's dashboard plots directly into JupyterLab panes.\n\n![Dask Extension](./dask.png)\n\n## Explanatory Video (5 minutes)\n\n\u003ca href=\"http://www.youtube.com/watch?feature=player_embedded\u0026v=EX_voquHdk0 \"\n   target=\"_blank\"\u003e\n\u003cimg src=\"http://img.youtube.com/vi/EX_voquHdk0/0.jpg\"\n       alt=\"Dask + JupyterLab Screencast\" width=\"560\" height=\"315\" border=\"10\" /\u003e\n\u003c/a\u003e\n\n## Requirements\n\nJupyterLab \u003e= 1.0\ndistributed \u003e= 1.24.1\n\n## Installation\n\nTo install the Dask JupyterLab extension you will need to have JupyterLab installed.\nFor JupyterLab \u003c 3.0, you will also need [Node.js](https://nodejs.org/) version \u003e= 12.\nThese are available through a variety of sources.\nOne source common to Python users is the conda package manager.\n\n```bash\nconda install jupyterlab\nconda install -c conda-forge nodejs\n```\n\n### JupyterLab 4.x\n\nInstall the latest version of the extension for the JupyterLab 4\nsupport. You should be able to install this extension with pip or conda,\nand start using it immediately, e.g.\n\n```bash\npip install dask-labextension\n```\n\n### JupyterLab 3.x\n\nFor JupyterLab 3.x, use lastest supported version `6.2.0`.\n\n```bash\npip install dask-labextension==6.2.0\n```\n\n### JupyterLab 2.x\n\nPrior to JupyterLab 3.0 client-side and server-side components needed\nto be installed separately, with node available on the machine.\n\nThe server-side component can be installed via pip or conda-forge:\n\n```bash\npip install 'dask_labextension\u003c5'\n```\n\n```bash\nconda install -c conda-forge 'dask-labextension\u003c5'\n```\n\nYou then build the client-side extension into JupyterLab with:\n\n```bash\njupyter labextension install dask-labextension\n```\n\nIf you are running Notebook 5.2 or earlier, enable the server extension by running\n\n```bash\njupyter serverextension enable --py --sys-prefix dask_labextension\n```\n\n## Configuration of Dask cluster management\n\nThis extension has the ability to launch and manage several kinds of Dask clusters,\nincluding local clusters and kubernetes clusters.\nOptions for how to launch these clusters are set via the\n[dask configuration system](http://docs.dask.org/en/latest/configuration.html#configuration),\ntypically a `.yml` file on disk.\n\nBy default the extension launches a `LocalCluster`, for which the configuration is:\n\n```yaml\nlabextension:\n  factory:\n    module: 'dask.distributed'\n    class: 'LocalCluster'\n    args: []\n    kwargs: {}\n  default:\n    workers: null\n    adapt:\n      null\n      # minimum: 0\n      # maximum: 10\n  initial:\n    []\n    # - name: \"My Big Cluster\"\n    #   workers: 100\n    # - name: \"Adaptive Cluster\"\n    #   adapt:\n    #     minimum: 0\n    #     maximum: 50\n```\n\nIn this configuration, `factory` gives the module, class name, and arguments needed to create the cluster.\nThe `default` key describes the initial number of workers for the cluster, as well as whether it is adaptive.\nThe `initial` key gives a list of initial clusters to start upon launch of the notebook server.\n\nIn addition to `LocalCluster`, this extension has been used to launch several other Dask cluster\nobjects, a few examples of which are:\n\n- A SLURM cluster, using\n\n```yaml\nlabextension:\n    factory:\n      module: 'dask_jobqueue'\n       class: 'SLURMCluster'\n       args: []\n       kwargs: {}\n```\n\n- A PBS cluster, using\n\n```yaml\nlabextension:\n  factory:\n    module: 'dask_jobqueue'\n    class: 'PBSCluster'\n    args: []\n    kwargs: {}\n```\n\n- A [Kubernetes cluster](https://github.com/pangeo-data/pangeo-cloud-federation/blob/8f7f4bf9963ef1ed180dd20c952ff1aa8df54ca2/deployments/ocean/image/binder/dask_config.yaml#L37-L42), using\n\n```yaml\nlabextension:\n  factory:\n    module: dask_kubernetes\n    class: KubeCluster\n    args: []\n    kwargs: {}\n```\n\n## Configuring a default layout\n\nThis extension can store a default layout for the Dask dashboard panes,\nwhich is useful if you find yourself reaching for the same dashboard charts over and over.\nYou can launch the default layout via the command palette,\nor by going to the File menu and choosing \"Launch Dask Dashboard Layout\".\n\nDefault layouts can be configured via the JupyterLab config system\n(either using the JSON editor or the user interface).\nSpecify a layout by writing a JSON object keyed by the\n[individual charts](https://github.com/dask/distributed/blob/f31fbde748294065ed70dd5c4399821fa664a9f1/distributed/dashboard/scheduler.py#L72-L117)\nyou would like to open.\nEach chart is opened with a `mode`, and a `ref`.\n`mode` refers to how the chart is to be added to the workspace.\nFor example, if you want to split a panel and add the new one to the right, choose `split-right`.\nOther options are `split-top`, `split-bottom`, `split-left`, `tab-after`, and `tab-before`.\n`ref` refers to the panel to which `mode` is applied, and might be the names of other dashboard panels.\nIf `ref` is `null`, the panel in question is added at the top of the layout hierarchy.\n\nA concrete example of a default layout is\n\n```json\n{\n  \"individual-task-stream\": {\n    \"mode\": \"split-right\",\n    \"ref\": null\n  },\n  \"individual-workers-memory\": {\n    \"mode\": \"split-bottom\",\n    \"ref\": \"individual-task-stream\"\n  },\n  \"individual-progress\": {\n    \"mode\": \"split-right\",\n    \"ref\": \"individual-workers-memory\"\n  }\n}\n```\n\nwhich adds the task stream to the right of the workspace,\nthen adds the worker memory chart below the task stream,\nthen adds the progress chart to the right of the worker memory chart.\n\n## Development install\n\nAs described in the [JupyterLab documentation](https://jupyterlab.readthedocs.io/en/stable/extension/extension_dev.html#developing-a-prebuilt-extension)\nfor a development install of the labextension you can run the following in this directory:\n\n```bash\njlpm  # Install npm package dependencies\njlpm build  # Compile the TypeScript sources to Javascript\njupyter labextension develop . --overwrite  # Install the current directory as an extension\n```\n\nTo rebuild the extension:\n\n```bash\njlpm build\n```\n\nYou should then be able to refresh the JupyterLab page\nand it will pick up the changes to the extension.\n\nTo run an editable install of the server extension, run\n\n```bash\npip install -e .\njupyter serverextension enable --sys-prefix dask_labextension\n```\n\n## Publishing\n\nThis extension contains a front-end component written in TypeScript\nand a back-end component written in Python.\nThe front-end is compiled to Javascript during the build process\nand is distributed as static assets along with the Python package.\n\n### Release process\n\nThis requires `node`, `build`, `hatch` and `twine` to be installed.\n\n```bash\n# To set version (e.g. 7.0.0). hatch will update version string in package.json\nhatch version \"7.0.0\"\n\n# Examples of bumping version\n# minor bump\nhatch version minor  # Bumps to 7.1.0\n# beta pre-release bump\n# If published to pypi this can be installed with the --pre flag to pip\nhatch version b  # Bumps to 7.1.0b0\n# bump minor and beta\nhatch version minor,b  # Bumps to 7.2.0b0\n# release all of the --pre-release flags such as alpha beta rc\nhatch release  # Bumps to 7.2.0\n\n# git commit after bumping version\ngit add package.json \u0026\u0026 git commit -m \"Bump version: {version}\"\n# Tag this version\ngit tag {version}\n\n# Finally push to main, build and upload package to PyPI\ngit push upstream main \u0026\u0026 git push upstream main --tags  # pushes to GitHub\npython -m build .  # Build the package\ntwine upload dist/*  # Upload the package to PyPI\n```\n\n### Handling Javascript package version conflicts\n\nUnlike Python, Javascript packages can include more than one version of the same dependency.\nUsually the `yarn` package manager handles this okay, but occasionally you might end up with conflicting versions,\nor with unexpected package bloat.\nYou can try to fix this by deduplicating dependencies:\n\n```bash\njlpm yarn-deduplicate -s fewer\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdask%2Fdask-labextension","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdask%2Fdask-labextension","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdask%2Fdask-labextension/lists"}