Skip to main content

Jupyterlab extension to add handling of Makefiles and syntax colouring support

Project description

jupyterlab_makefile_file_type_extension

GitHub Actions npm version PyPI version Total PyPI downloads JupyterLab 4

A JupyterLab extension providing comprehensive Makefile support with syntax highlighting and custom file type recognition.

Makefile Extension Screenshot

Features

Comprehensive Makefile editing support in JupyterLab with syntax highlighting that distinguishes targets, variables, conditionals, and shell constructs.

File recognition:

  • Standard names: Makefile, makefile, GNUmakefile
  • Extensions: *.mk, *.mak, *.make
  • Custom red "M" icon in file browser

Highlighting coverage:

  • Build targets and dependencies
  • Variable references and shell constructs
  • Conditional directives
  • Special targets and silent commands
  • Line continuations and quoted strings

Requirements

  • JupyterLab >= 4.0.0

Install

To install the extension, execute:

pip install jupyterlab_makefile_file_type_extension

Configuration

IMPORTANT: Configure Tab Character Usage

Makefiles require tab characters for recipe command indentation. Recipe lines starting with spaces instead of tabs will cause Make execution to fail with "missing separator" errors. Configure JupyterLab to use tabs:

  1. Open JupyterLab Settings → Settings Editor
  2. Navigate to Text Editor section
  3. Set the following options:
    • Insert Spaces: Uncheck this option (or set to false in JSON)
    • Tab Size: Set to 4 (or your preferred tab width)

Alternatively, add this to your JupyterLab settings JSON:

{
  "editorConfig": {
    "insertSpaces": false,
    "tabSize": 4
  }
}

Note: All recipe commands (lines that execute shell commands under targets) MUST start with a tab character. The syntax highlighter requires tab-indented recipe lines for proper highlighting - space-indented recipes will not be highlighted and will fail during Make execution.

Uninstall

To remove the extension, execute:

pip uninstall jupyterlab_makefile_file_type_extension

Contributing

Development install

Note: You will need NodeJS to build the extension package.

The jlpm command is JupyterLab's pinned version of yarn that is installed with JupyterLab. You may use yarn or npm in lieu of jlpm below.

# Clone the repo to your local environment
# Change directory to the jupyterlab_makefile_file_type_extension directory

# Set up a virtual environment and install package in development mode
python -m venv .venv
source .venv/bin/activate
pip install --editable "."

# Link your development version of the extension with JupyterLab
jupyter labextension develop . --overwrite

# Rebuild extension Typescript source after making changes
# IMPORTANT: Unlike the steps above which are performed only once, do this step
# every time you make a change.
jlpm build

You can watch the source directory and run JupyterLab at the same time in different terminals to watch for changes in the extension's source and automatically rebuild the extension.

# Watch the source directory in one terminal, automatically rebuilding when needed
jlpm watch
# Run JupyterLab in another terminal
jupyter lab

With the watch command running, every saved change will immediately be built locally and available in your running JupyterLab. Refresh JupyterLab to load the change in your browser (you may need to wait several seconds for the extension to be rebuilt).

By default, the jlpm build command generates the source maps for this extension to make it easier to debug using the browser dev tools. To also generate source maps for the JupyterLab core extensions, you can run the following command:

jupyter lab build --minimize=False

Development uninstall

pip uninstall jupyterlab_makefile_file_type_extension

In development mode, you will also need to remove the symlink created by jupyter labextension develop command. To find its location, you can run jupyter labextension list to figure out where the labextensions folder is located. Then you can remove the symlink named jupyterlab_makefile_file_type_extension within that folder.

Testing the extension

Frontend tests

This extension is using Jest for JavaScript code testing.

To execute them, execute:

jlpm
jlpm test

Integration tests

This extension uses Playwright for the integration tests (aka user level tests). More precisely, the JupyterLab helper Galata is used to handle testing the extension in JupyterLab.

More information are provided within the ui-tests README.

Packaging the extension

See RELEASE

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

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file jupyterlab_makefile_file_type_extension-1.0.80.tar.gz.

File metadata

File hashes

Hashes for jupyterlab_makefile_file_type_extension-1.0.80.tar.gz
Algorithm Hash digest
SHA256 082fcddeb2948ead3c826058836b8be59c1515cd6017fc619c9ae0325aac3773
MD5 c27febaca31bb8af25da956b64e53ce2
BLAKE2b-256 9d00312626f8a0c3bea8dc0ca1b9a7a88f7eff811055799a1b3e63518afe82ca

See more details on using hashes here.

File details

Details for the file jupyterlab_makefile_file_type_extension-1.0.80-py3-none-any.whl.

File metadata

File hashes

Hashes for jupyterlab_makefile_file_type_extension-1.0.80-py3-none-any.whl
Algorithm Hash digest
SHA256 cda2832f3b021cb2ecefb91df0da3bc7bca29fa570b94b767684376823de88fe
MD5 340137003a5210c98e625962f7572aa9
BLAKE2b-256 89ef1d103f056dd8c33d4d2030d72949b8c1cf78e553c7492cb30777b21dfd11

See more details on using hashes here.

Supported by

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