Skip to main content

"main importable for jupyterlab-fonts.

Project description

fonts-icon jupyterlab-fonts

Data-driven Style and Typography for JupyterLab powered by JSS.

ci-badge demo-badge

This is Free Software

We're trying some things out here, and invite you test it out, but make no guarantees that it is good or even works. What we mean by that is covered in the shouty text at the bottom of the LICENSE.

If something is broken, become a contributor and raise an issue, but we cannot guarantee any kind of response time. Similarly, PRs will be reviewed on a time-permitting basis.

Prerequisites

  • Python >=3.8
  • a Jupyter client
    • JupyterLab >=3,<5
      • for specific JupyterLab compatibility, see the changelog.
    • Jupyter Notebook >=7,<8

Installing

pip install jupyterlab-fonts
# or
conda install -c conda-forge jupyterlab-fonts

Uninstalling

We're sorry to see you go!

pip uninstall jupyterlab-fonts
# or
conda uninstall jupyterlab-fonts

Usage

JupyterLab

Quick Configuration with the Jupyter Lab Menu

To change your default fonts, from the main menu, select SettingsFontsCodeFont (or Size or Line Height) and the value you'd like.

Some features of Content, i.e. your rendered Markdown and HTML, are also available, and more will hopefully be added over time.

Full Configuration with the Font Editor

You can view all available font configurations by selecting SettingsFontsGlobal Fonts.... These values will be stored in your JupyterLab settings.

Notebook-specific Configuration

When viewing an .ipynb, change just the fonts for that file by clicking fonts-icon in the Notebook toolbar (right now, next to cell type). The font, style changes, and its license information will be stored in the Notebook metadata.

This can rapidly increase the size of your notebook file, and can make it harder to use in collaboration. We're looking into some alterate approaches.

Advanced Configuration

In JupyterLab, the fonts-icon Fonts section of Advanced JSON Settings can control things entirely unrelated to fonts. There's no guarantee that highly-customized styles will work nicely with the Font Editor, or with downstream applications of jupyterlab-fonts metadata.

Here's an example of changing how a Notebook file looks when in Presentation Mode.

{
  "styles": {
    ":root": {
      "--jp-code-font-family": "'Fira Code Regular', 'Source Code Pro', monospace",
      "--jp-code-font-size": "19px"
    },
    ".jp-mod-presentationMode .jp-Notebook": {
      "& .CodeMirror, & .cm-editor": {
        "fontSize": "32px"
      },
      "& .jp-InputPrompt, & .jp-OutputPrompt": {
        "display": "none"
      }
    }
  }
}

Notebooks

Similarly, the JupyterLab Property Inspector enables these customizations in a specific .ipynb file, at both the document and cell level: these are dynamically generated, and scoped to the document/cell id.

Supporting Multiple Application Versions

The above example shows how different versions of JupyterLab (or Notebook) may use different DOM classes for the same logical content, such as:

Element JupyterLab <4 JupyterLab 4
a code editor .CodeMirror .cm-editor

JSS Plugins

All JSON-compatible features of the jss-preset-default plugins are enabled with the default settings, with some specific notes below. For portability, dynamic JS-based features are not supported.

Nesting

The the & (ampersand) allows for nesting selectors, as standardized by the W3C CSS Nesting Module and implemented in many browsers.

Global

All settings-derived styles will be wrapped in a @global selector.

In Jupyter Workflows

Use in overrides.json

overrides.json allows for simple, declarative configuration of JupyterLab core and third-party extensions, even after the lab server has been started.

{
  "@deathbeds/jupyterlab-fonts:fonts": {
    "styles": {
      ":root": {
        "--jp-code-font-family": "'Fira Code Regular', 'Source Code Pro', monospace",
        "--jp-code-font-size": "19px"
      }
    }
  }
}
Binder

In binder, one might deploy this with a postBuild script:

#!/usr/bin/env bash
set -eux
mkdir -p "${NB_PYTHON_PREFIX}/share/jupyter/lab/settings"
cp overrides.json "${NB_PYTHON_PREFIX}/share/jupyter/lab/settings"
JupyterLite

Similarly, this is a well-known file to JupyterLite, making it straightforward to do light customization without needing to build and distribute a full theme plugin.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jupyterlab_fonts-3.0.0a1.tar.gz (1.3 MB view details)

Uploaded Source

Built Distribution

jupyterlab_fonts-3.0.0a1-py3-none-any.whl (1.1 MB view details)

Uploaded Python 3

File details

Details for the file jupyterlab_fonts-3.0.0a1.tar.gz.

File metadata

  • Download URL: jupyterlab_fonts-3.0.0a1.tar.gz
  • Upload date:
  • Size: 1.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for jupyterlab_fonts-3.0.0a1.tar.gz
Algorithm Hash digest
SHA256 2c9319f8735d79bb2d8950f9a3b98a0e7b1aa6b60f26f383e6753ffc74be97a6
MD5 920b06e43a782cdc0ed151f8595b9da1
BLAKE2b-256 9d1da7071b35892f20d62b40424b97d8c9be11b371aa6b836ae58324133812dd

See more details on using hashes here.

Provenance

File details

Details for the file jupyterlab_fonts-3.0.0a1-py3-none-any.whl.

File metadata

File hashes

Hashes for jupyterlab_fonts-3.0.0a1-py3-none-any.whl
Algorithm Hash digest
SHA256 2f3949f4f66ce8f5b976ad3d6e3740f209d89e51d398c56d126932cae57a9c80
MD5 4664724232f78a6fe9579d47d31eda43
BLAKE2b-256 80948bfe23e993609d6a938f70c706efd55dbf975566971a5ac3cfa3ce69e8b0

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page