Skip to main content

JupyterLab extension to support JSONiq magic within python cells. This extension is required to get the JSONiq LSP functionality.

Reason this release was yanked:

Broken build

Project description

JSONiq JupyterLab Extension

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.

Features

  • Basic token highlighting - provides JSONiq token highlighting for %%jsoniq magic cells within Python notebooks.
  • Syntax highlighting for .jq files - can be enabled for .jq files using the Jupyter language selector.

Installation

Install the extension from Python packaging. No manual npm, yarn, or language-server install is required for users.

To install, run:

pip install jsoniq-jupyterlab-extension

To prefetch or refresh the bundled wrapper after installation, run:

jsoniq-ensure-wrapper

After installing the package, you may need to enable the extension in JupyterLab:

jupyter labextension enable jsoniq-jupyterlab-extension

Usage

Once the extension is installed and enabled, it automatically recognizes jsoniq magic cells and files for syntax highlighting.

Example

%%jsoniq
for $book in json-file("books.json")
where $book.price lt 20
return $book.title

This cell should become highlighted.

Development

To contribute to the development of jsoniq-jupyterlab, follow these steps:

  1. Clone the repository:

    git clone https://github.com/davidbuzatu-marian/jsoniq-jupyterlab.git
    cd jsoniq-jupyterlab
    
  2. 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
    
  3. Build the extension:

    uv run pnpm run build:prod
    

    Hatch includes the bundled JSONiq language server from node_modules in the Python package so the wheel can launch it directly with node.

  4. Link the extension for local development:

    jupyter labextension link .
    
  5. Launch JupyterLab:

    jupyter lab
    

Building and testing the extension

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:prod

Project Structure

  • src/: 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.

Contributing

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.

License

This project is licensed under the Apache-2.0 License. See the LICENSE file for details.

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

jsoniq_jupyterlab_extension-2.0.0a7.tar.gz (714.8 kB view details)

Uploaded Source

Built Distribution

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

jsoniq_jupyterlab_extension-2.0.0a7-py3-none-any.whl (238.3 kB view details)

Uploaded Python 3

File details

Details for the file jsoniq_jupyterlab_extension-2.0.0a7.tar.gz.

File metadata

File hashes

Hashes for jsoniq_jupyterlab_extension-2.0.0a7.tar.gz
Algorithm Hash digest
SHA256 a6b32838de597a8483429e0e82815535925e5379addeb2cd035d05795bd35b8b
MD5 2374b3080df00099ff5b2cdf57f1273f
BLAKE2b-256 721d17e8af3b7203f3e2124b1a1a3d06e6f96912ff1dd6b05fbb7d7111ee3c9f

See more details on using hashes here.

Provenance

The following attestation bundles were made for jsoniq_jupyterlab_extension-2.0.0a7.tar.gz:

Publisher: publish.yml on RumbleDB/jsoniq-jupyterlab-extension

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file jsoniq_jupyterlab_extension-2.0.0a7-py3-none-any.whl.

File metadata

File hashes

Hashes for jsoniq_jupyterlab_extension-2.0.0a7-py3-none-any.whl
Algorithm Hash digest
SHA256 0c1cdd3f95e1ac4e60c2e1a46218d140ed10ef10711d439ca2d01635f6075632
MD5 cfed6412f27b46b2c9eb2ad1af691c3a
BLAKE2b-256 b414548ce4ffaef04d8537c0820d6bd0433de187f61331f9fe45c12407942996

See more details on using hashes here.

Provenance

The following attestation bundles were made for jsoniq_jupyterlab_extension-2.0.0a7-py3-none-any.whl:

Publisher: publish.yml on RumbleDB/jsoniq-jupyterlab-extension

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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