Git Product home page Git Product logo

jupyterlab-fonts's Introduction

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.

jupyterlab-fonts's People

Contributors

bollwyvl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

jupyterlab-fonts's Issues

Uninstallation

I can see that this is going to be merged into Jupyter Lab, and I'd like to uninstall, given that the fonts menu brought in by this extension does not show any fonts to choose from when hovered, in my installation. What is the uninstall procedure?

Many thanks, and even more thanks for working on the Jupyter Lab PR of this feature!

How to add font?

Thanks for the awesome extension! This works smoothly in my setting :)
I'd like to try jupyterlab with some other fonts (ex. D2coding).
Could you please instruct how I can add custom fonts?

Add docs/demo on RTD

What I am trying to do...

Learn more about jupyterlab-fonts without:

  • installing
  • starting a Binder (frequently down now)

How I would like to learn how to do it...

Visit a static site running on ReadTheDocs with working demos.

How the project might keep the docs accurate...

  • typedoc (or sphinx-js) for JS API
  • pytest-check-links
  • hunspell
  • robot against the build docs
  • add per-PR-push review with PR badges

Error module 'mistune' has no attribute 'BlockGrammar' maybe linked to #6531 (?)

After installation of jupyterlab-fonts and running jupyter lab inside my virtual env (see config below) I get twice the following error message :

[E 2022-09-30 09:53:33.813 ServerApp] Uncaught exception GET /api/nbconvert?1664524413629 (127.0.0.1)
    HTTPServerRequest(protocol='http', host='localhost:8888', method='GET', uri='/api/nbconvert?1664524413629', version='HTTP/1.1', remote_ip='127.0.0.1')
    Traceback (most recent call last):
      File "/home/vidal/.local/share/virtualenvs/FlaskVenv-XZ2RGVQf/lib/python3.10/site-packages/tornado/web.py", line 1713, in _execute
        result = await result
      File "/home/vidal/.local/share/virtualenvs/FlaskVenv-XZ2RGVQf/lib/python3.10/site-packages/jupyter_server/services/nbconvert/handlers.py", line 29, in get
        from nbconvert.exporters import base
      File "/home/vidal/.local/share/virtualenvs/FlaskVenv-XZ2RGVQf/lib/python3.10/site-packages/nbconvert/__init__.py", line 3, in <module>
        from . import filters, postprocessors, preprocessors, writers
      File "/home/vidal/.local/share/virtualenvs/FlaskVenv-XZ2RGVQf/lib/python3.10/site-packages/nbconvert/filters/__init__.py", line 8, in <module>
        from .markdown import *
      File "/home/vidal/.local/share/virtualenvs/FlaskVenv-XZ2RGVQf/lib/python3.10/site-packages/nbconvert/filters/markdown.py", line 13, in <module>
        from .markdown_mistune import markdown2html_mistune
      File "/home/vidal/.local/share/virtualenvs/FlaskVenv-XZ2RGVQf/lib/python3.10/site-packages/nbconvert/filters/markdown_mistune.py", line 37, in <module>
        class MathBlockGrammar(mistune.BlockGrammar):
    AttributeError: module 'mistune' has no attribute 'BlockGrammar'
[W 2022-09-30 09:53:33.814 ServerApp] wrote error: 'Unhandled error'
[E 2022-09-30 09:53:33.814 ServerApp] {
      "Host": "localhost:8888",
      "Accept": "*/*",
      "Referer": "http://localhost:8888/lab",
      "User-Agent": "Mozilla/5.0 (X11; Linux x86_64; rv:106.0) Gecko/20100101 Firefox/106.0"
    }
[E 2022-09-30 09:53:33.814 ServerApp] 500 GET /api/nbconvert?1664524413629 (127.0.0.1) 31.35ms referer=http://localhost:8888/lab

When I uninstall jupyterlab-fonts the eror does not disappear and I have to reinstall nbconvert to get back a vlean jupyter lab
Configuration :
Linux ####### 5.18.0-4-amd64 #1 SMP PREEMPT_DYNAMIC Debian 5.18.16-1 (2022-08-10) x86_64 GNU/Linux
pipenv, version 2022.9.24
Pipfle :

[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"

[packages]
jupyter = "*"
jupyterlab = "*"
jupyter-nbextensions-configurator = "*"
voila = "*"
jupyterlab-hdf = "*"
flask = "*"
jinja2 = "*"
gunicorn = "*"
psycopg2 = "*"
flask-sqlalchemy = "*"
ipywidgets = "*"
flexx = "*"
plotly = "*"
numpy = "*"
pandas = "*"
six = "*"
wheel = "*"
pandoc = "*"
pandocfilters = "*"
pypandoc = "*"
sqlalchemy = "*"
pymysql = "*"
jupyterlab-language-pack-fr-fr = "*"
psycopg2-binary = "*"
flask-migrate = "*"
requests = "*"
spidev = "*"
pillow = "*"
setuptools = "*"
kaleido = "*"
nbconvert = "*"**
jupyterlab-fonts = "*"
mistune = "*"
pipenv = "*"

[dev-packages]

[requires]
python_version = "3.10"

Initially-loaded notebook may not register properly in JupyterLab 3.5.0

Description

When a notebook loads as part of the layoutrestorer, etc. sometimes the data-jpf- tags aren't applied, and the stylesheet isn't created if needed.

Reproduce

  • open a notebook
  • add some style
    • see the styles applied
  • reload the page
    • do not see the styles applied
    • no errors appear

Expected behavior

  • see styles immediately

Context

  • Operating System and version: ubuntu
  • Browser and version: all
  • JupyterLab version: 3.5.0
  • jupyterlab-fonts version(s): 2.1.1

Release 3.0.0a2

  • merge all outstanding PRs
  • ensure the versions have been bumped (check with doit)
  • ensure the CHANGELOG is up-to-date
    • move the new release to the top of the stack
  • validate on binder
  • wait for a successful build of main
  • download the dist archive and unpack somewhere (maybe a fresh dist)
  • create a new release through the GitHub UI
    • paste in the relevant CHANGELOG entries
    • upload the artifacts
  • actually upload to npm.com, pypi.org
    #!/usr/bin/env bash
    set -eux
    cd dist
    twine upload *.tar.gz *.whl
    npm login
    for tarball in deathbeds-jupyterlab-font*.tgz; do
      npm publish $tarball
    done
    npm logout
  • postmortem

Release 3.0.0a3

  • merge all outstanding PRs
  • ensure the versions have been bumped (check with doit)
  • ensure the CHANGELOG is up-to-date
    • move the new release to the top of the stack
  • validate on binder
  • wait for a successful build of main
  • download the dist archive and unpack somewhere (maybe a fresh dist)
  • create a new release through the GitHub UI
    • paste in the relevant CHANGELOG entries
    • upload the artifacts
  • actually upload to npm.com, pypi.org
    #!/usr/bin/env bash
    set -eux
    cd dist
    twine upload *.tar.gz *.whl
    npm login
    for tarball in deathbeds-jupyterlab-font*.tgz; do
      npm publish $tarball
    done
    npm logout
  • postmortem

Installation error

ValueError: "@deathbeds/[email protected]" is not compatible with the current JupyterLab

Conflicting Dependencies:
JupyterLab              Extension            Package
>=0.10.0-0 <0.11.0-0    >=0.16.0-0 <0.17.0-0 @jupyterlab/application

Any advice on how to upgrade JupyterLab so this extension can be installed?

Release 2.0.0

  • make a release issue
  • ensure the CHANGELOG is updated
  • wait for CI
  • download the dist
  • make a GitHub release off master
  • upload the assets
  • upload to PyPI, npm
  • handle conda-forge chores
  • post-mortem
    • README needs screenshots

This extension does not yet support the current version of JupyterLab.

Conflicting Dependencies:
JupyterLab Extension Package
>=1.1.3 <1.2.0 >=0.19.1 <0.20.0@jupyterlab/application
>=1.1.3 <1.2.0 >=0.19.2 <0.20.0@jupyterlab/notebook、

but my version of jupyter bleow

jupyter core : 4.5.0
jupyter-notebook : 6.0.1
qtconsole : 4.5.5
ipython : 7.8.0
ipykernel : 5.1.2
jupyter client : 5.3.3
jupyter lab : 1.1.4
nbconvert : 5.6.0
ipywidgets : 7.5.1
nbformat : 4.4.0
traitlets : 4.3.3
it looks satisfied

Support more @ directives

Elevator Pitch

Support other @ directives, especially @keyframes

Motivation

Enable animation.

Design Ideas

Add more special handling for @keyframes, maybe others.

Release 3.0.0

  • merge all outstanding PRs
  • ensure the versions have been bumped (check with doit)
  • ensure the CHANGELOG is up-to-date
    • move the new release to the top of the stack
  • validate on binder
  • wait for a successful build of main
  • download the dist archive and unpack somewhere (maybe a fresh dist)
  • create a new release through the GitHub UI
    • paste in the relevant CHANGELOG entries
    • upload the artifacts
  • actually upload to npm.com, pypi.org
    #!/usr/bin/env bash
    set -eux
    cd dist
    twine upload *.tar.gz *.whl
    npm login
    for tarball in deathbeds-jupyterlab-font*.tgz; do
      npm publish $tarball
    done
    npm logout
  • postmortem

Release 2.1.1

  • merge all outstanding PRs
  • ensure the versions have been bumped (check with doit)
  • ensure the CHANGELOG is up-to-date
    • move the new release to the top of the stack
  • validate on binder
  • wait for a successful build of main
  • download the dist archive and unpack somewhere (maybe a fresh dist)
  • create a new release through the GitHub UI
    • paste in the relevant CHANGELOG entries
    • upload the artifacts
  • actually upload to npm.com, pypi.org
    cd dist
    twine upload *.tar.gz *.whl
    npm login
    for tarball in deathbeds-jupyterlab-font*.tar.gz; do
      npm publish .tgz
    done
    npm logout
  • postmortem #63

Updating jupyterlab-fonts to interact with the new JupyterLab settings editor

With the addition of a JupyterLab settings editor, jupyter-lab fonts seems like it could fit with core JupyterLab in some new (and exciting!) ways. I'd be interested in seeing jupyterlab-fonts

  • as an extension section in the JupyterLab settings editor (instead of their current placement in the menu bar)
  • somehow appearing in/linking to the jupyterlab-fonts settings section as overrides in any place in the settings editor where the theme is referenced they (to avoid confusion from conflicting information)
  • bonus points if adding other non-font theme editing parameters could also appear here

Does this sound like an update this project would be interested in making?

(cc: @tonyfast)

There is no Fonts option in settings after I install the plugin

To make my problem clearer,please see the following picture.

image

This is so weird because I also installed this plugin in another environment and it worked. So I have no clue what's wrong this time.
PS:I also tried to re-install jupyterlab and then this plugin but it still don't work

Release 2.1.0

  • merge all outstanding PRs
  • ensure the versions have been bumped (check with doit)
  • ensure the CHANGELOG is up-to-date
    • move the new release to the top of the stack
  • validate on binder
  • validate on ReadTheDocs
  • wait for a successful build of main
  • download the dist archive and unpack somewhere (maybe a fresh dist)
  • create a new release through the GitHub UI
    • paste in the relevant CHANGELOG entries
    • upload the artifacts
  • actually upload to npm.com, pypi.org
    cd dist
    twine upload *.tar.gz *.whl
    npm login
    for tarball in deathbeds-jupyterlab-fonts-*.tar.gz; do
      npm publish .tgz
    done
    npm logout
  • postmortem
    • handle conda-forge feedstock tasks
    • validate on binder via simplest-possible gists
    • bump to next development version
    • update release procedures

Core UI "@deathbeds/jupyterlab-fonts" can't install on Jupyter lab 3.0.9

Config option kernel_spec_manager_class not recognized by InstallLabExtensionApp.
[W 2021-02-26 12:24:25.589 LabApp] Config option kernel_spec_manager_class not recognized by LabApp.
An error occured.
ValueError: The extension "@deathbeds/jupyterlab-fonts" does not yet support the current version of JupyterLab.

Conflicting Dependencies:
JupyterLab Extension Package

=3.0.6 <3.1.0 >=2.0.0 <3.0.0 @jupyterlab/application
=3.0.5 <3.1.0 >=2.0.0 <3.0.0 @jupyterlab/mainmenu
=3.0.6 <3.1.0 >=2.0.0 <3.0.0 @jupyterlab/notebook

When can the extension adapt to jupyterlab 3.x?

install nbjss

When I pip install nbjss, I got this error:

Collecting nbjss
  Could not find a version that satisfies the requirement nbjss (from versions: )
No matching distribution found for nbjss

jupyter lab version: 0.35.4

conflict with jupyterlab 4.0

I upgraded my jupyterlab to 4.0 and when i install jupyterlab font it reinstalls old version of jupyterlab. and when i force install 4.0, font says it requires jupyterlab 3.x and it causes some weird behavior.

jupyter lab largely improves performance of notebook, and it would be great to check if font can support 4.0.

Release 3.0.0a1

  • merge all outstanding PRs
  • ensure the versions have been bumped (check with doit)
  • ensure the CHANGELOG is up-to-date
    • move the new release to the top of the stack
  • validate on binder
  • wait for a successful build of main
  • download the dist archive and unpack somewhere (maybe a fresh dist)
  • create a new release through the GitHub UI
    • paste in the relevant CHANGELOG entries
    • upload the artifacts
  • actually upload to npm.com, pypi.org
    cd dist
    twine upload *.tar.gz *.whl
    npm login
    for tarball in deathbeds-jupyterlab-font*.tgz; do
      npm publish --access=public $tarball
    done
    npm logout
  • postmortem

release 3.0.0a0

  • merge all outstanding PRs
  • ensure the versions have been bumped (check with doit)
  • ensure the CHANGELOG is up-to-date
    • move the new release to the top of the stack
  • validate on binder
    • not up today

  • wait for a successful build of main
  • download the dist archive and unpack somewhere (maybe a fresh dist)
  • create a new release through the GitHub UI
    • paste in the relevant CHANGELOG entries
    • upload the artifacts
  • actually upload to npm.com, pypi.org
    cd dist
    twine upload *.tar.gz *.whl
    npm login
    for tarball in deathbeds-jupyterlab-font*.tar.gz; do
      npm publish .tgz
    done
    npm logout
  • postmortem
    • handle conda-forge feedstock tasks
    • validate on binder via simplest-possible gists
    • bump to next development version
    • update release procedures

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.