Skip to main content

jupyter_secrets_manager

Github Actions Status

A JupyterLab extension to manage secrets.

Overview

The two main plugins of this extension are the SecretsManager and the SecretsConnector.

Secrets manager

The manager be the only interface for extensions / users to retrieve secrets.

It knows only one connector, its role is to act as an interface between an extension / user / input and the secrets connector.

Extension should not query directly the secrets connector. All requests for secrets must go through the manager.

Secrets connector

The secrets connector is the one that fetches and saves secrets. It partially implements the Jupyterlab IDataConnector. Given a secrets ID, the connector should return the associated secrets.

By default, the extension provides an 'in memory' secrets connector: secrets are stored only during the current session.

The secrets connector is provided by a plugin (with a token). This means that a third party extension can disable the default one and provide a new connector (to fetch secrets from a remote server for example).

Features

Associating inputs and secrets

Any third party extension can associate an HTML input element to a secret, using the attach() method of the manager. It requires a namespace and id to link the input with a "unique" ID. This association should be done when the input is attached to the DOM.

Associating an input to an namespace/id triggers a fetch on the secrets connector. If a secrets is fetched, the input is filled with the value of that secret.

When the user updates manually the input, it triggers a save of the secret by the secrets connector.

Requirements

  • JupyterLab >= 4.0.0

Install

To install the extension, execute:

pip install jupyter_secrets_manager

Uninstall

To remove the extension, execute:

pip uninstall jupyter_secrets_manager

Contributing

Development install

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

The jlpm command is JupyterLab's pinned version of yarn that is installed with JupyterLab. You may use yarn or npm in lieu of jlpm below.

# Clone the repo to your local environment
# Change directory to the jupyter_secrets_manager directory
# Install package in development mode
pip install -e "."
# Link your development version of the extension with JupyterLab
jupyter labextension develop . --overwrite
# Rebuild extension Typescript source after making changes
jlpm 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 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 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

Development uninstall

pip uninstall jupyter_secrets_manager

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 jupyter-secrets-manager within that folder.

Testing the extension

Frontend tests

This extension is using Jest for JavaScript code testing.

To execute them, execute:

jlpm
jlpm test

Integration tests

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.

Packaging the extension

See RELEASE

Metadata

Release files for jupyter-secrets-manager 0.5.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for jupyter-secrets-manager 0.5.1
File Size Uploaded
jupyter_secrets_manager-0.5.1.tar.gz 139.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for jupyter-secrets-manager 0.5.1
File Interpreter ABI Platform
jupyter_secrets_manager-0.5.1-py3-none-any.whl Python 3 none any Details

Total release size: 161.0 kB

Release files / jupyter_secrets_manager-0.5.1.tar.gz

Download URL jupyter_secrets_manager-0.5.1.tar.gz
Size 139.3 kB
Tags Source
SHA-256 checksum
How to use checksums
7583a5416a349e98ea37daef24d1346a8437567c4bc7ef75e2d7c4520216e338
BLAKE2b-256 checksum
How to use checksums
1dd50ec8a132f41a0e287690ee8f5dee26b8abc7b7a975114d0ccea344d365e9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.2.0 CPython/3.12.13

Release files / jupyter_secrets_manager-0.5.1-py3-none-any.whl

Download URL jupyter_secrets_manager-0.5.1-py3-none-any.whl
Size 21.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
68aaea228fee1c9c49a5700a8cfd40b188b4598a6fc1f46828d47d400aa7a6a8
BLAKE2b-256 checksum
How to use checksums
420180d1a2ac2fa3be98e08c45dcebe045092e35ba5a0a44e4fe6ce1ccf345ff
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.2.0 CPython/3.12.13

Release history Release notifications | RSS feed

This release

0.5.1 This release

2 release files

0.5.0

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page