Install & Compatibility
Where this runs
tested against v0.4.2 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.920 runs
installs and imports cleanly · install 0.0s · import 0.000s · 279.1MB
glibcpy 3.10–3.920 runs
installs and imports cleanly · install 16.2s · import 0.000s · 263MB
271MB installed
● package 271MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
enable_nbextension_python
✓ from jupyter_contrib_core import enable_nbextension_python
✗ from jupyter_contrib_core import enable_nbextension_python
This quickstart demonstrates how to programmatically enable and disable a hypothetical Python nbextension using the compatibility functions provided by `jupyter-contrib-core`. This is typically used by other `jupyter-contrib` projects or advanced setup scripts, rather than directly by end-users. The functions interact with Jupyter's configuration.
import logging
from jupyter_contrib_core.notebook_compat.nbextensions import enable_nbextension_python, disable_nbextension_python
# jupyter-contrib-core is primarily for developers building Jupyter extensions.
# This example demonstrates programmatic enabling/disabling of a hypothetical
# Python-based nbextension using its compatibility API.
# Set up a basic logger as it's a required argument for these functions.
log = logging.getLogger(__name__)
log.setLevel(logging.INFO)
handler = logging.StreamHandler()
formatter = logging.Formatter('%(levelname)s: %(message)s')
handler.setFormatter(formatter)
log.addHandler(handler)
dummy_extension_name = "my_dummy_jupyter_extension"
try:
print(f"\nAttempting to enable nbextension: {dummy_extension_name}")
# Note: This will update Jupyter's configuration, but won't
# physically install files. If the extension isn't present,
# it might still 'enable' it in config, but it won't load.
enable_nbextension_python(
dummy_extension_name,
user=True, # Apply for the current user
sys_prefix=False,
overwrite=False,
logger=log
)
print(f"Successfully (or attempted) to enable {dummy_extension_name}. Check your Jupyter config.")
print(f"\nAttempting to disable nbextension: {dummy_extension_name}")
disable_nbextension_python(
dummy_extension_name,
user=True,
logger=log
)
print(f"Successfully (or attempted) to disable {dummy_extension_name}.")
except Exception as e:
print(f"\nAn error occurred during nbextension management: {e}")
jupyter-contrib-core --version
Debug
Known issues
breakingVersions of `jupyter-contrib-core` prior to 0.3.2 may not be compatible with Jupyter Notebook 5.0 and later due to internal module structure changes in `notebook` (e.g., `ArgumentConflict` module moved).fixUpgrade `jupyter-contrib-core` to version 0.3.2 or later when using Jupyter Notebook 5.0+.
affects: <0.3.2
gotcha`jupyter-contrib-core` aims to smooth over differences in the `nbextension` API across various Jupyter Notebook versions. Directly interacting with Jupyter Notebook's internal `nbextensions` APIs, rather than using the shims provided by this library, can lead to unexpected behavior or breakage when upgrading `notebook` versions.fixAlways use the compatibility layer provided by `jupyter_contrib_core.notebook_compat` when developing or managing `jupyter-contrib` extensions to ensure broader compatibility.
affects: All versions
breakingSignificant changes in Jupyter's architecture (e.g., moving from `notebook` to `jupyter_server` for modern JupyterLab deployments) may introduce incompatibilities. While `jupyter-contrib-core` provides `notebook` compatibility, its direct utility for `jupyter_server`-based environments might be limited or require newer, dedicated compatibility layers.fixCarefully review `jupyter-contrib-core` and dependent extension documentation when upgrading your Jupyter backend from `notebook` to `jupyter_server`. Some `nbextension`-style management may not directly translate.
affects: All versions (when transitioning from `notebook` to `jupyter_server`)
Upgrade
Version history
0.4.2latest on PyPI · released Nov 15, 2022
Audit
Dependencies
notebookrequiredProvides compatibility shims for Jupyter Notebook's nbextension API, requiring a Jupyter Notebook installation to be functional.