Package: jupyter-firefly-extensions
jupyter_firefly_extensionsJupyterLab extensions for rendering FITS and displaying tables, images, & charts with Firefly.OverviewThese extensions add the following features to JupyterLab:Open a FITS file from the file browser and see it in a tab.Start the full Firefly viewer in a tab (either through launcher or command palette).UseFireflyClientin notebook to start Firefly in a tab and send data
(tables, images, charts) to it using theFireflyClientpython API.PrerequisitesJupyterLab ^4.0.0 - where these extensions will run. Check past releases if you are using JupyterLab<4.firefly_client ^2.1.1 - can be installed withpip install firefly_client.Firefly server - you can run it locally via a Firefly Docker image obtained fromhttps://hub.docker.com/r/ipac/firefly.astropy ^3.0.0 - (optional) used for convenience in example notebooks.nodejs ^18.0.0 - only needed if you're doingdevelopment installVery Important: first setup the Firefly URL - 3 waysAdd the following line to your~/.jupyter/jupyter_notebook_config.pyc.Firefly.url='http://localhost:8080/firefly'OrAdd the following line to your~/.jupyter/jupyter_notebook_config.jsonunder the root object."Firefly":{"url":"http://localhost:8080/firefly"}OrUse the environment variable in the shell where you start jupyter labin bash:export FIREFLY_URL=http://localhost:8080/fireflyin tcsh:setenv FIREFLY_URL http://localhost:8080/fireflywhere the URL points to a Firefly server.Installationpipinstalljupyter_firefly_extensionsOpen JupyterLab (withjupyter lab) to start using these extensions - seeexamplesto learn how.Development installFirst:If developingfirefly_client, be sure to clone thefirefly_clientrepository
(https://github.com/Caltech-IPAC/firefly_client)
and then dopip install -e .from inside its directory.Make sure you have nodejs >=18.0.0 installed on your system or virtual environment. It's required for building TS/JS source. In conda environment, you can install it usingconda install nodejsThen:gitclonehttps://github.com/Caltech-IPAC/jupyter_firefly_extensionscdjupyter_firefly_extensions# Install package in development mode (changes in python source will reflect automatically)pipinstall-e.# Link your development version of the extension with JupyterLabjupyterlabextensiondevelop.--overwrite# Enable the server extensionjupyterserverextensionenablejupyter_firefly_extensions# Rebuild extension TS/JS source each time you make a changejlpmrunbuildHelpful commandsjupyter server extension list- show a list of server extensionsjupyter lab extension list- show a list of lab extensionsjupyter lab- run jupyter labjlpm <any yarn command>- JupyterLab-provided, locked version of the yarnTo remove extension:pipuninstalljupyter_firefly_extensionsExamplesTheexamplesdirectory has several example notebooks to demonstrate the extension features. When using the examples you should copy the directory and contents to another place or jupyter lab will and to keep rebuildingslate-demo-explicit.ipynb,slate-demo-explicit2.ipynb- demonstrates
opening a Firefly tab and sending data to it with theFireflyClientpython APIOther notebooks demonstrate capabilites of widgets which are no longer supported, so they won't work.Besides this, you can also use this extension to display fits images. In the file browser of jupyter lab, simply clicking on a.fitsfile will show the image in a new tab.TroubleshootingIf you are using a local Firefly server and facing issues with rendering images, check the console for an error message about being unable to load 'firefly-thread.worker.js'. If that's the case, you can clean your existing Firefly build usinggradle cleanand then build and deploy it in the development environment (instead of the local one, i.e., the default) by usinggradle -Penv=dev firefly:bAD. Then, reload the Jupyter Lab browser tab (and empty the cache). You shouldn't see that console error anymore and the images should render correctly.