{"id":527,"library":"jupyterlab-pygments","title":"JupyterLab Pygments Theme","description":"This package provides a syntax highlighting theme for Pygments, designed to leverage JupyterLab's CSS variables. It aims to integrate Pygments-generated HTML code blocks seamlessly with the visual styling of JupyterLab themes. The current version is 0.3.0, released on November 23, 2023, and it is actively maintained by the Jupyter Development Team.","status":"active","version":"0.3.0","language":"python","source_language":"en","source_url":"https://github.com/jupyterlab/jupyterlab_pygments.git","tags":["jupyter","jupyterlab","pygments","theme","syntax-highlighting","frontend"],"install":[{"cmd":"pip install jupyterlab-pygments","lang":"bash","label":"Install via pip"},{"cmd":"conda install -c conda-forge jupyterlab_pygments","lang":"bash","label":"Install via Conda"}],"dependencies":[{"reason":"Core dependency for syntax highlighting; requires version >=2.4.1.","package":"pygments"}],"imports":[{"wrong":"from jupyterlab_pygments import Style","symbol":"Style","correct":"from jupyterlab_pygments.style import Style"}],"quickstart":{"code":"from pygments import highlight\nfrom pygments.lexers import PythonLexer\nfrom pygments.formatters import HtmlFormatter\nfrom IPython.display import HTML, display\n\n# Example Python code to highlight\ncode_to_highlight = \"\"\"\ndef greet(name):\n    print(f\"Hello, {name}!\")\n\ngreet(\"World\")\n\"\"\"\n\n# Create an HTML formatter using the 'jupyterlab' style\n# The style 'jupyterlab' is made available by the jupyterlab-pygments package\nformatter = HtmlFormatter(style='jupyterlab', full=True, cssclass='highlight-jupyterlab')\n\n# Generate the HTML output with highlighting\nhighlighted_html = highlight(code_to_highlight, PythonLexer(), formatter)\n\n# To display in a Jupyter environment, use IPython.display\n# For standalone use, you would typically write highlighted_html to a file.\n# The 'full=True' option includes the <style> tags, making it self-contained.\ndisplay(HTML(highlighted_html))","lang":"python","description":"This quickstart demonstrates how to use the `jupyterlab` Pygments style to highlight Python code and display it within a Jupyter environment. The `HtmlFormatter` is configured with `style='jupyterlab'` to apply the theme, and `full=True` to embed the necessary CSS."},"warnings":[{"fix":"Be aware of these inherent limitations of Pygments styling when expecting an exact match to CodeMirror's rendering.","message":"Pygments-generated HTML and CSS classes from this theme are not as granular as JupyterLab's CodeMirror editor. This means some visual nuances, like differentiating properties from general names or how dots in `foo.bar` are styled, cannot be perfectly replicated.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Ensure that the generated HTML and CSS are properly scoped (e.g., by using a unique `cssclass` for the formatter and styling it appropriately) to minimize conflicts. Consider generating `full=True` output that includes the `<style>` tags for isolated styling.","message":"When directly embedding Pygments-generated HTML and CSS (especially with `HtmlFormatter`) into Jupyter Notebook/Lab cell outputs, the CSS can sometimes conflict with the global Jupyter theme, potentially affecting the readability of other output elements or applying unintended styles.","severity":"gotcha","affected_versions":"All versions"},{"fix":"This is an ongoing issue being addressed by the JupyterLab team, with work moving towards a separate `jupyterlab-builder` package. Packagers should monitor the `jupyterlab/jupyterlab-builder` repository for updates and potential solutions.","message":"There have been reported issues with recursive build-time dependencies (e.g., `jupyterlab-pygments`, `jupyterlab`, `nbconvert`) leading to bootstrapping problems during packaging, especially when upgrading Python versions (e.g., 3.8 to 3.9). This can make it difficult for packagers to build and install these components.","severity":"breaking","affected_versions":"All versions, particularly affecting package maintainers"},{"fix":"Upgrade your JupyterLab installation to version 4.x or later. This theme should remain compatible across JupyterLab versions, but leveraging a current JupyterLab host is recommended.","message":"While `jupyterlab-pygments` is a theme, its primary environment, JupyterLab 3, reached its end-of-maintenance on May 15, 2024, with critical fixes only until December 31, 2024. Users are strongly encouraged to upgrade to JupyterLab 4 for continued support and new features.","severity":"deprecated","affected_versions":"<4.0.0 (for host JupyterLab version)"},{"fix":"Ensure `pygments` is installed in your Python environment using `pip install pygments` or by including it in your project's `requirements.txt`.","message":"The `pygments` package is a core dependency for syntax highlighting and must be explicitly installed in the environment for scripts or applications that use it. A `ModuleNotFoundError` indicates that the package is missing.","severity":"breaking","affected_versions":"All versions"},{"fix":"Ensure that the `pygments` package is installed in your Python environment. This can typically be resolved by running `pip install pygments` or by including it in your project's dependency management file (e.g., `requirements.txt`).","message":"The `pygments` library, which is a fundamental dependency for `jupyterlab-pygments` and Pygments-related operations, is not found in the Python environment, leading to a `ModuleNotFoundError`.","severity":"breaking","affected_versions":"All versions (this is an environment setup issue, not specific to library versions)"}],"env_vars":null,"search_vec":"'0.3.0':42 '2023':47 '23':46 'activ':51 'aim':21 'block':29 'code':28 'css':18 'current':39 'design':13 'develop':56 'frontend':65 'generat':26 'highlight':9,64 'html':27 'integr':23 'jupyt':55,58 'jupyterlab':1,16,36,59 'leverag':15 'maintain':52 'novemb':45 'packag':5 'provid':6 'pygment':2,12,25,60 'pygments-gener':24 'releas':43 'seamless':30 'style':34 'syntax':8,63 'syntax-highlight':62 'team':57 'theme':3,10,37,61 'variabl':19 'version':40 'visual':33","created_at":"2026-03-28T15:17:27.674137+00:00","updated_at":"2026-04-16T15:59:47.153516+00:00","problems":{"verify_error":"Traceback (most recent call last):\n  File \"<string>\", line 1, in <module>\n  File \"/tmp/tmpceh5dgwq/venv/lib/python3.12/site-packages/jupyterlab_pygments/__init__.py\", line 8, in <module>\n    from .style import JupyterStyle  # noqa\n    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File \"/tmp/tmpceh5dgwq/venv/lib"},"ecosystem":"pypi","meta_description":null,"install_score":0,"quickstart_score":0,"quickstart_tag":"stale","pypi_latest":"0.3.0","cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/jupyterlab/jupyterlab_pygments","docs":null,"changelog":null,"pypi":"https://pypi.org/project/jupyterlab-pygments/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["web-framework"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"import_fail","verified_at":"2026-07-03","last_verified":"2026-07-03","next_check":"2026-07-10","install_tag":"stale"}}