{"id":6694,"library":"jupyter-contrib-core","title":"Jupyter Contrib Core","description":"Jupyter Contrib Core provides common utilities for jupyter-contrib projects, primarily offering a `notebook-4.2`-compatible `nbextension` API to smooth over differences across various Jupyter Notebook versions. It includes shared application components, CLI scripts, and testing utilities for developers building Jupyter extensions. The current version is 0.4.2, and releases are generally driven by compatibility updates with newer Jupyter Notebook versions.","status":"active","version":"0.4.2","language":"en","source_language":"en","source_url":"https://github.com/jupyter-contrib/jupyter_contrib_core","tags":["jupyter","notebook","nbextension","utility","compatibility","extension-development"],"install":[{"cmd":"pip install jupyter-contrib-core","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"Provides compatibility shims for Jupyter Notebook's nbextension API, requiring a Jupyter Notebook installation to be functional.","package":"notebook","optional":false}],"imports":[{"note":"This is a key function for programmatically managing Python-based nbextensions using the compatibility layer provided by jupyter-contrib-core.","symbol":"enable_nbextension_python","correct":"from jupyter_contrib_core.notebook_compat.nbextensions import enable_nbextension_python"},{"note":"Used to programmatically disable Python-based nbextensions.","symbol":"disable_nbextension_python","correct":"from jupyter_contrib_core.notebook_compat.nbextensions import disable_nbextension_python"}],"quickstart":{"code":"import logging\nfrom jupyter_contrib_core.notebook_compat.nbextensions import enable_nbextension_python, disable_nbextension_python\n\n# jupyter-contrib-core is primarily for developers building Jupyter extensions.\n# This example demonstrates programmatic enabling/disabling of a hypothetical\n# Python-based nbextension using its compatibility API.\n\n# Set up a basic logger as it's a required argument for these functions.\nlog = logging.getLogger(__name__)\nlog.setLevel(logging.INFO)\nhandler = logging.StreamHandler()\nformatter = logging.Formatter('%(levelname)s: %(message)s')\nhandler.setFormatter(formatter)\nlog.addHandler(handler)\n\ndummy_extension_name = \"my_dummy_jupyter_extension\"\n\ntry:\n    print(f\"\\nAttempting to enable nbextension: {dummy_extension_name}\")\n    # Note: This will update Jupyter's configuration, but won't\n    # physically install files. If the extension isn't present,\n    # it might still 'enable' it in config, but it won't load.\n    enable_nbextension_python(\n        dummy_extension_name,\n        user=True, # Apply for the current user\n        sys_prefix=False,\n        overwrite=False,\n        logger=log\n    )\n    print(f\"Successfully (or attempted) to enable {dummy_extension_name}. Check your Jupyter config.\")\n\n    print(f\"\\nAttempting to disable nbextension: {dummy_extension_name}\")\n    disable_nbextension_python(\n        dummy_extension_name,\n        user=True,\n        logger=log\n    )\n    print(f\"Successfully (or attempted) to disable {dummy_extension_name}.\")\n\nexcept Exception as e:\n    print(f\"\\nAn error occurred during nbextension management: {e}\")","lang":"python","description":"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."},"warnings":[{"fix":"Upgrade `jupyter-contrib-core` to version 0.3.2 or later when using Jupyter Notebook 5.0+.","message":"Versions 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).","severity":"breaking","affected_versions":"<0.3.2"},{"fix":"Always use the compatibility layer provided by `jupyter_contrib_core.notebook_compat` when developing or managing `jupyter-contrib` extensions to ensure broader compatibility.","message":"`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.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Carefully 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.","message":"Significant 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.","severity":"breaking","affected_versions":"All versions (when transitioning from `notebook` to `jupyter_server`)"}],"env_vars":null,"last_verified":"2026-04-15T00:00:00.000Z","next_check":"2026-07-14T00:00:00.000Z","problems":[]}