Skip to main content

A JupyterLab extension.

Project description

ploomber-extension

[!TIP] Deploy AI apps for free on Ploomber Cloud!

Install

pip install ploomber-extension

Contributing

Development install

conda create --name ploomber-extension python=3 --channel conda-forge --yes
conda activate ploomber-extension
conda install nodejs --channel conda-forge --yes
pip install -r requirements.txt
pip install -r requirements.dev.txt

jlpm install

Note: pkgmt format can be used to format and lint Python files before committing code. To format JavaScript and TypeScript files, use yarn run eslint. To lint without formatting, use yarn run eslint:check

# Note: this command will take some time the first time as it has to compile the
# frontend code. If the command fails, see the "troubleshooting setup" section below
pip install -e "."

# upon installation, both the frontend and backend extensions must be activated
# automatically, you can verify it by ensuring ploomber-extension appears here:
jupyter labextension list # frontend extension
jupyter server extension list # backend extension

# if they don't appear, you can activate them manually, but this means that
# the setup is incorrect! see pyproject.toml, under
# tool.hatch.build.targets.wheel.shared-data, and fix any issues

# activate manually
jupyter server extension enable ploomber_extension
jupyter labextension enable ploomber_extension


jupyter labextension develop . --overwrite

# NOTE: the two previous commands will fail if there are missing dependencies

# rebuild extension Typescript
# important: we had to set skipLibCheck: true
# https://discourse.jupyter.org/t/struggling-with-extensions-and-dependencies-versions/19550
jlpm build

To watch for changes and reload:

# in one terminal
jlpm watch

# another terminal
jupyter lab

Refresh JupyterLab to load the change in your browser.

By default, the jlpm build command generates the source maps for this extension to make it easier to debug using the browser dev tools. To also generate source maps for the JupyterLab core extensions, you can run the following command:

jupyter lab build --minimize=False

Troubleshooting setup

If you encounter errors when installing the package for development, you can try the following to configure an environment from scratch:

# remove conda environment
conda env remove --name ploomber-extension

# delete yarn.lock
rm yarn.lock

# delete all temporary files
git clean -fdx

Then, create the conda environment again, install dependencies (jlpm install), and build the extension manually (jupyter labextension build --development True .). Finally, verify if pip install -e "." works.

Adding dependencies

jlpm add PACKAGE

# example
jlpm add @jupyter-widgets/base

Development uninstall

pip uninstall ploomber-extension

In development mode, you will also need to remove the symlink created by jupyter labextension develop command. To find its location, you can run jupyter labextension list to figure out where the labextensions folder is located. Then you can remove the symlink named ploomber-extension within that folder.

Testing the extension

This extension is using Jest for JavaScript code testing.

This extension uses Playwright for the integration tests (aka user level tests). More precisely, the JupyterLab helper Galata is used to handle testing the extension in JupyterLab. More information are provided within the ui-tests README.

To run the tests:

pip install nox pyyaml

# unit tests
nox --session test

# ui tests
nox --session ui_test

# to only run the python unit tests
pytest tests

Releasing the extension

See RELEASE

Configuration

The package.json file contains a jupyterlab extension. More information about this section is here (you might need to switch the git branch dependin on which version JupyterLab version you're building for). The schema is here.

Ploomber Cloud API Endpoint

You can set the PLOOMBER_CLOUD_HOST variable to switch the API endpoint (by default, it's set to our production API endpoint).

export PLOOMBER_CLOUD_HOST=https://cloudapi-dev.ploomber.io

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ploomber_extension-0.1.0.tar.gz (191.7 kB view details)

Uploaded Source

Built Distribution

ploomber_extension-0.1.0-py3-none-any.whl (193.0 kB view details)

Uploaded Python 3

File details

Details for the file ploomber_extension-0.1.0.tar.gz.

File metadata

  • Download URL: ploomber_extension-0.1.0.tar.gz
  • Upload date:
  • Size: 191.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.12.1

File hashes

Hashes for ploomber_extension-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d54db9f05831e2bd0d1cf1c2d58988fac3044478ae61e899f1d75a108c0980b2
MD5 77acfb8827febfd668c2c0adedf5f53a
BLAKE2b-256 b111f08bbcd54dbd9c2244164696cbe2eedde067a3369bca273d054f611a57ca

See more details on using hashes here.

File details

Details for the file ploomber_extension-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for ploomber_extension-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e0581608419314adb11c6a912a6cea271e99adad12944737266e7edc1105c36e
MD5 43b36aee33ebccac995efd673a15c171
BLAKE2b-256 8e95e161f5a0670f44d2ee79f1ca04671186c9cd882542f0572ec5adfc753411

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page