A Jupyter kernel for running Hurl commands
Project description
Jupyter Hurl Kernel
A Jupyter kernel for executing Hurl commands directly in Jupyter notebooks.
What is Hurl?
Hurl is a command line tool that runs HTTP requests defined in a simple plain text format. It's designed for testing HTTP endpoints, APIs, and web services. Learn more at hurl.dev.
Features
- Execute Hurl commands directly in Jupyter notebook cells
- Get HTTP responses displayed in the notebook
- Supports all Hurl syntax and features
- Easy to install and use
Prerequisites
- Python 3.13+ - This project requires Python 3.13 or higher
- Hurl - Install Hurl from hurl.dev/docs/installation.html
Installing Hurl
On macOS:
brew install hurl
On Linux:
# Debian/Ubuntu
curl -LO https://github.com/Orange-OpenSource/hurl/releases/latest/download/hurl_amd64.deb
sudo dpkg -i hurl_amd64.deb
# Or build from source
cargo install hurl
On Windows:
# Using Scoop
scoop install hurl
# Or using Chocolatey
choco install hurl
Verify the installation:
hurl --version
Installation
From PyPI (Recommended)
pip install jupyter-hurl-kernel
install-hurl-kernel
For installation in a virtual environment or server:
pip install jupyter-hurl-kernel
install-hurl-kernel --sys-prefix
That's it! The package includes syntax highlighting for both:
- JupyterLab 4.x (automatic via bundled extension)
- JupyterLab 3.x and Classic Jupyter Notebook (automatic via CodeMirror 5 mode)
From Source
- Clone or download this repository:
git clone https://github.com/micedre/jupyter-hurl-kernel.git
cd jupyter-hurl-kernel
- Install the package using uv:
uv pip install -e .
- Install the Jupyter kernel:
install-hurl-kernel
For installation in a virtual environment:
install-hurl-kernel --sys-prefix
- Verify the kernel is installed:
jupyter kernelspec list
You should see hurl in the list of available kernels.
Usage
- Start Jupyter Notebook or JupyterLab:
jupyter notebook
# or
jupyter lab
-
Create a new notebook and select "Hurl" as the kernel
-
Write Hurl commands in notebook cells:
Example 1: Simple GET request
GET https://www.insee.fr
Example 2: GET with headers
GET https://api.github.com/users/octocat
User-Agent: MyApp/1.0
Accept: application/json
Example 3: POST request
POST https://httpbin.org/post
Content-Type: application/json
{
"name": "John Doe",
"age": 30
}
Example 4: Testing with assertions
GET https://httpbin.org/json
HTTP 200
[Asserts]
jsonpath "$.slideshow.title" == "Sample Slide Show"
Example 5: Include response headers (using %%include)
%%include
GET https://api.github.com/users/octocat
Example 6: Verbose output with all details (using %%verbose)
%%verbose
GET https://api.github.com/users/octocat
- Run the cell (Shift+Enter) to execute the Hurl command
The kernel will display:
- HTTP response output
- Any errors or validation failures
Magic Lines
You can control the output level using magic lines at the start of cells. These magic lines correspond to Hurl's command-line flags:
- No magic line (default) - Shows only the response body
%%include- Shows response headers and body (equivalent tohurl --include)%%verbose- Shows all information including request details, response headers, body, timing, etc. (equivalent tohurl --verbose)
Examples:
Normal output (body only):
GET https://www.insee.fr
Include mode (headers + body):
%%include
GET https://www.insee.fr
Verbose mode (complete details):
%%verbose
GET https://www.insee.fr
Features
Autocompletion
The kernel provides intelligent autocompletion for Hurl syntax. Press Tab to trigger autocompletion:
- HTTP Methods:
GET,POST,PUT,DELETE,PATCH,HEAD,OPTIONS, etc. - Common Headers:
Content-Type:,Authorization:,Accept:,User-Agent:, etc. - Hurl Sections:
[Asserts],[Captures],[QueryStringParams],[FormParams], etc. - Magic Lines:
%%include,%%verbose - Content Types: When typing
Content-Type:, get suggestions for common MIME types
The autocompletion is context-aware and will suggest relevant completions based on where your cursor is positioned.
Documentation Tooltips
Hover over or press Shift+Tab on keywords to see documentation:
- HTTP Methods: See descriptions of what each HTTP method does
- Hurl Sections: Get examples and explanations for each section type
- Magic Lines: Learn what each magic line does
Example: Place your cursor on GET and press Shift+Tab to see:
HTTP GET Method
GET method requests a representation of the specified resource.
Requests using GET should only retrieve data.
Syntax Highlighting
The kernel includes built-in syntax highlighting for all Jupyter environments:
- JupyterLab 4.x: Uses bundled CodeMirror 6 extension (automatically enabled)
- JupyterLab 3.x and Classic Jupyter Notebook: Uses CodeMirror 5 mode (automatically enabled)
Syntax highlighting provides:
- HTTP Methods (GET, POST, etc.) - highlighted as keywords
- URLs - highlighted as strings
- Headers - highlighted as attributes
- Section headers ([Asserts], [Captures], etc.) - highlighted as headers
- Magic lines (%%include, %%verbose) - highlighted as meta
- Assertions (status, jsonpath, etc.) - highlighted as builtins
- Operators (==, !=, >, <, etc.) - highlighted as operators
- Numbers and strings - appropriately colored
- Comments (#) - highlighted as comments
- JSONPath and XPath expressions - highlighted as variables
The syntax highlighting is automatically installed when you run install-hurl-kernel. After installation, you may need to refresh your browser for the highlighting to take effect.
How It Works
The kernel works by:
- Taking the Hurl code from the notebook cell
- Writing it to a temporary
.hurlfile - Executing
hurl --color <file> - Capturing and displaying the output in the notebook
- Cleaning up the temporary file
Troubleshooting
Code completion or syntax highlighting not working
If autocompletion or syntax highlighting isn't working on your Jupyter server, see the detailed TROUBLESHOOTING.md guide.
Quick fixes:
- Clear browser cache and hard refresh (Ctrl+Shift+R)
- Restart Jupyter server completely
- Reinstall:
pip install --upgrade --force-reinstall jupyter-hurl-kernel - Verify extension is loaded:
jupyter labextension list(should show jupyterlab-hurl-extension) - Check browser console (F12) for JavaScript errors
"hurl is not installed" error
Make sure Hurl is installed and available in your PATH:
which hurl
hurl --version
Kernel not appearing in Jupyter
Try reinstalling the kernel:
install-hurl-kernel --user
jupyter kernelspec list
Command timeout
By default, commands timeout after 30 seconds. For long-running requests, this can be adjusted in the kernel code.
Development
To modify the kernel:
-
Clone the repository:
git clone https://github.com/micedre/jupyter-hurl-kernel.git cd jupyter-hurl-kernel
-
Install in development mode:
uv pip install -e . install-hurl-kernel --sys-prefix
-
Make your changes to the kernel code in
src/jupyter_hurl_kernel/ -
Restart your Jupyter notebook kernel to test changes
Running Tests
# Build the package to verify
uv build
# Check the distribution
uv tool run twine check dist/*
Uninstallation
To remove the kernel:
jupyter kernelspec uninstall hurl
To uninstall the package:
uv pip uninstall jupyter-hurl-kernel
License
This project is open source and available under the MIT License.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Resources
Project details
Release history Release notifications | RSS feed
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file jupyter_hurl_kernel-0.0.8.tar.gz.
File metadata
- Download URL: jupyter_hurl_kernel-0.0.8.tar.gz
- Upload date:
- Size: 97.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9615c6df367379a8517717bb7d0c100130f0bef341acf787c46ee226198047ce
|
|
| MD5 |
7d5190a6a50a330fc63db96338127240
|
|
| BLAKE2b-256 |
323aa3a1d60ca30febaa2552381fa44b7381c07921827b2bfda6b1fdee267923
|
Provenance
The following attestation bundles were made for jupyter_hurl_kernel-0.0.8.tar.gz:
Publisher:
publish.yml on micedre/jupyter-hurl-kernel
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
jupyter_hurl_kernel-0.0.8.tar.gz -
Subject digest:
9615c6df367379a8517717bb7d0c100130f0bef341acf787c46ee226198047ce - Sigstore transparency entry: 626341468
- Sigstore integration time:
-
Permalink:
micedre/jupyter-hurl-kernel@125679328f5924c15e805bb8b3af6591c2cd1cfe -
Branch / Tag:
refs/tags/v0.0.8 - Owner: https://github.com/micedre
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@125679328f5924c15e805bb8b3af6591c2cd1cfe -
Trigger Event:
release
-
Statement type:
File details
Details for the file jupyter_hurl_kernel-0.0.8-py3-none-any.whl.
File metadata
- Download URL: jupyter_hurl_kernel-0.0.8-py3-none-any.whl
- Upload date:
- Size: 105.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
923d1017309764ac7564e4790677fc7d1a05f334639dab9bf2c7ea83cd82dac5
|
|
| MD5 |
ef60fd3b9d7dd8f3c94e292342982e77
|
|
| BLAKE2b-256 |
1a4baf8a852b5ac7cc45ffbd33027f14d9aeccce982a2bdf0d933b23c3834db2
|
Provenance
The following attestation bundles were made for jupyter_hurl_kernel-0.0.8-py3-none-any.whl:
Publisher:
publish.yml on micedre/jupyter-hurl-kernel
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
jupyter_hurl_kernel-0.0.8-py3-none-any.whl -
Subject digest:
923d1017309764ac7564e4790677fc7d1a05f334639dab9bf2c7ea83cd82dac5 - Sigstore transparency entry: 626341469
- Sigstore integration time:
-
Permalink:
micedre/jupyter-hurl-kernel@125679328f5924c15e805bb8b3af6591c2cd1cfe -
Branch / Tag:
refs/tags/v0.0.8 - Owner: https://github.com/micedre
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@125679328f5924c15e805bb8b3af6591c2cd1cfe -
Trigger Event:
release
-
Statement type: