Skip to content

About

A labextension to integrate pyflyby with notebooks

Resources

Contributing

Stars

14 stars

Watchers

9 watching

Forks

Repository files navigation

@deshaw/jupyterlab_pyflyby

PyPI version PyPI DM Github Actions Status

A labextension to integrate pyflyby with notebooks

Pyflyby helps you get rid of the tedious task of recalling and adding import statements. This labextension takes it further by adding the import statements automatically in your notebook. For eg. executing np.arange(10)

Screenshot

You can decide cell where imports should be added by adding 'pyflyby-cell' cell tag to it.

Requirements

  • JupyterLab >= 4.0

Install

pip install jupyterlab_pyflyby

Contributing

Development install

Note: You will need NodeJS to build the extension package.

The jlpm command is the pinned version of yarn that is installed with jupyter-builder. You may use yarn or npm in lieu of jlpm below.

# Clone the repo to your local environment
# Change directory to the jupyterlab_pyflyby directory
# Install package in development mode, along with the development dependencies
pip install -e ".[dev]"
# Link your development version of the extension with JupyterLab
jupyter-builder develop . --overwrite
# Rebuild extension Typescript source after making changes
jlpm run build

You can watch the source directory and run JupyterLab at the same time in different terminals to watch for changes in the extension's source and automatically rebuild the extension.

# Watch the source directory in one terminal, automatically rebuilding when needed
jlpm run watch
# Run JupyterLab in another terminal
jupyter-lab

With the watch command running, every saved change will immediately be built locally and available in your running JupyterLab. Refresh JupyterLab to load the change in your browser (you may need to wait several seconds for the extension to be rebuilt).

By default, the jlpm run 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

Endpoint authentication

Every verb method of every handler in jupyterlab_pyflyby/handlers.py must carry a @tornado.web.authenticated decorator, or, if an endpoint is deliberately public, an explicit @allow_unauthenticated/@ws_authenticated decorator from jupyter_server.auth.decorator. The build workflow enforces this by running:

python .github/scripts/check_auth.py

Publishing

  1. Install dependencies: pip install twine hatch
  2. Update the version in package.json and update the release date in CHANGELOG.md
  3. Commit the change in step 1
  4. For test release, manually trigger the Build and publish to PyPI workflow - you need to check the Test release checkbox
  5. Draft a new GitHub release, creating an approriate version tag
  6. Publish the draft and verify that the publish job in the build workflow passed.

Uninstall

pip uninstall jupyterlab_pyflyby

History

This plugin was contributed back to the community by the D. E. Shaw group.

D. E. Shaw Logo

License

This project is released under a BSD-3-Clause license.

We love contributions! Before you can contribute, please sign and submit this Contributor License Agreement (CLA). This CLA is in place to protect all users of this project.

"Jupyter" is a trademark of the LF Charities, of which Project Jupyter is a part.

About

A labextension to integrate pyflyby with notebooks

Resources

Contributing

Stars

14 stars

Watchers

9 watching

Forks

Releases

Packages

Contributors

Languages