jsoniq-jupyterlab-extension is a JupyterLab extension that adds basic token highlighting for JSONiq code. Syntax highlighting with CodeMirror is enabled for jsoniq cells using the %%jsoniq magic and for .jq files.
- Basic token highlighting - provides JSONiq token highlighting for
%%jsoniqmagic cells within Python notebooks. - Syntax highlighting for
.jqfiles - can be enabled for.jqfiles using the Jupyter language selector.
Install the extension from Python packaging. No npm or yarn installation is required for users.
To install, run:
pip install jsoniq-jupyterlab-extensionAfter installing the package, you may need to enable the extension in JupyterLab:
jupyter labextension enable jsoniq-jupyterlab-extensionOnce the extension is installed and enabled, it automatically recognizes jsoniq magic cells and files for syntax highlighting.
%%jsoniq
for $book in json-file("books.json")
where $book.price lt 20
return $book.titleThis cell should become highlighted.
To contribute to the development of jsoniq-jupyterlab, follow these steps:
-
Clone the repository:
git clone https://github.com/davidbuzatu-marian/jsoniq-jupyterlab.git cd jsoniq-jupyterlab -
Install dependencies:
pnpm install # Install JavaScript dependencies pnpm run antlr4 # Generate parser from grammar uv python install # Setup Python environment using uv uv sync # Sync dependencies for Python environment
-
Build the extension:
uv run pnpm run build:prod
-
Link the extension for local development:
jupyter labextension link . -
Launch JupyterLab:
jupyter lab
To build the project for production, the following commands build the JavaScript files, build the Jupyter extension and install this result for local testing.
uv run pnpm run build:prodsrc/: Contains the source code of the extension.dist/: Build artifacts for the extension.package.json: Contains the configuration and dependencies for the extension.tests/: Contains a set of tests relating to syntax highlighting.
We welcome contributions to the jsoniq-jupyterlab-extension project! If you have any suggestions, bug reports, or pull requests, please feel free to submit them on the GitHub repository.
This project is licensed under the Apache-2.0 License. See the LICENSE file for details.