jbang-jupyter-runner


Namejbang-jupyter-runner JSON
Version 0.1.3 PyPI version JSON
download
home_pageNone
SummaryJupyter Lab extension to run .java and .jsh files with jbang
upload_time2025-10-08 15:47:01
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseMIT License Copyright (c) 2025 Jupyter Java Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords java jbang jupyter jupyterlab jupyterlab-extension
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Jupyter JBang Runner

A JupyterLab extension that adds a run button to `.java` and `.jsh` files, allowing you to execute them directly with [jbang](https://www.jbang.dev/).

![JupyterLab](https://img.shields.io/badge/JupyterLab-4.0+-orange.svg)
![License](https://img.shields.io/badge/license-MIT-blue.svg)

## Demo 

![](https://raw.githubusercontent.com/jbangdev/jbang-jupyter-runner/main/docs/example.gif)

## Features

- 🚀 **Run Button**: Adds a run button (▶️) to the toolbar of `.java` and `.jsh` files
- 💾 **Auto-save**: Automatically saves files before running to ensure latest code is executed
- 🔄 **Terminal Reuse**: Reuses existing terminals per file to avoid clutter
- 📺 **Terminal Integration**: Executes files using jbang in an integrated terminal
- 🎯 **Smart Detection**: Only shows the run button for supported file types (`.java`, `.jsh`)

## Prerequisites

- JupyterLab 4.0+
- [jbang](https://www.jbang.dev/) installed and available in PATH
- Node.js and npm (for development)
- Python 3.8+ (for installation)

## Installation

### For Users

```bash
pip install jbang-jupyter-runner
```

### For Development

**Detailed guide**: See [CONTRIBUTING.md](./docs/DEVELOPMENT.md)

## Usage

1. **Open a Java or JSH file**: Open any `.java` or `.jsh` file in JupyterLab
2. **Click the Run Button**: Look for the run button (▶️) in the file editor toolbar
3. **View Output**: The file will be executed with jbang in a terminal tab

### Example Files

Create a simple Java file to test:

**HelloWorld.java**

```java
///usr/bin/env jbang "$0" "$@" ; exit $?

public class HelloWorld {
    public static void main(String[] args) {
        System.out.println("Hello from JBang!");
    }
}
```

Or a JShell script:

**example.jsh**

```java
///usr/bin/env jbang "$0" "$@" ; exit $?
//DEPS org.apache.commons:commons-lang3:3.12.0

import org.apache.commons.lang3.StringUtils;

System.out.println(StringUtils.capitalize("hello world"));
```

## How It Works

### Terminal Management

The extension creates one terminal per file:

- **First run**: Creates a new terminal named `jbang-FileName.java`
- **Subsequent runs**: Reuses the same terminal, just sends a new command
- **Different files**: Each file gets its own dedicated terminal

### Auto-save Feature

Before executing, the extension:

1. Checks if the file has unsaved changes
2. Automatically saves the file if needed
3. Then runs the jbang command with the latest code

This ensures you always run the current version of your code!

## Development

### Project Structure

```
jbang-jupyter-runner/
├── src/                    # TypeScript source code
│   ├── index.ts           # Extension entry point
│   └── runButton.ts       # Run button implementation
├── style/                  # CSS styles
├── jbang_jupyter_runner/  # Python package
│   ├── __init__.py
│   ├── _version.py
│   └── labextension/      # Built extension (generated)
├── lib/                    # Compiled JavaScript (generated)
├── package.json           # npm configuration
├── pyproject.toml         # Python package configuration
└── tsconfig.json          # TypeScript configuration
```

## License

MIT License - see LICENSE file for details

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "jbang-jupyter-runner",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "java, jbang, jupyter, jupyterlab, jupyterlab-extension",
    "author": null,
    "author_email": "Max Rydahl Andersen <max@xam.dk>",
    "download_url": "https://files.pythonhosted.org/packages/e1/fd/52ea634e5524dc99297a7fe27f39909460cb64697e1f34756272714b72dd/jbang_jupyter_runner-0.1.3.tar.gz",
    "platform": null,
    "description": "# Jupyter JBang Runner\n\nA JupyterLab extension that adds a run button to `.java` and `.jsh` files, allowing you to execute them directly with [jbang](https://www.jbang.dev/).\n\n![JupyterLab](https://img.shields.io/badge/JupyterLab-4.0+-orange.svg)\n![License](https://img.shields.io/badge/license-MIT-blue.svg)\n\n## Demo \n\n![](https://raw.githubusercontent.com/jbangdev/jbang-jupyter-runner/main/docs/example.gif)\n\n## Features\n\n- \ud83d\ude80 **Run Button**: Adds a run button (\u25b6\ufe0f) to the toolbar of `.java` and `.jsh` files\n- \ud83d\udcbe **Auto-save**: Automatically saves files before running to ensure latest code is executed\n- \ud83d\udd04 **Terminal Reuse**: Reuses existing terminals per file to avoid clutter\n- \ud83d\udcfa **Terminal Integration**: Executes files using jbang in an integrated terminal\n- \ud83c\udfaf **Smart Detection**: Only shows the run button for supported file types (`.java`, `.jsh`)\n\n## Prerequisites\n\n- JupyterLab 4.0+\n- [jbang](https://www.jbang.dev/) installed and available in PATH\n- Node.js and npm (for development)\n- Python 3.8+ (for installation)\n\n## Installation\n\n### For Users\n\n```bash\npip install jbang-jupyter-runner\n```\n\n### For Development\n\n**Detailed guide**: See [CONTRIBUTING.md](./docs/DEVELOPMENT.md)\n\n## Usage\n\n1. **Open a Java or JSH file**: Open any `.java` or `.jsh` file in JupyterLab\n2. **Click the Run Button**: Look for the run button (\u25b6\ufe0f) in the file editor toolbar\n3. **View Output**: The file will be executed with jbang in a terminal tab\n\n### Example Files\n\nCreate a simple Java file to test:\n\n**HelloWorld.java**\n\n```java\n///usr/bin/env jbang \"$0\" \"$@\" ; exit $?\n\npublic class HelloWorld {\n    public static void main(String[] args) {\n        System.out.println(\"Hello from JBang!\");\n    }\n}\n```\n\nOr a JShell script:\n\n**example.jsh**\n\n```java\n///usr/bin/env jbang \"$0\" \"$@\" ; exit $?\n//DEPS org.apache.commons:commons-lang3:3.12.0\n\nimport org.apache.commons.lang3.StringUtils;\n\nSystem.out.println(StringUtils.capitalize(\"hello world\"));\n```\n\n## How It Works\n\n### Terminal Management\n\nThe extension creates one terminal per file:\n\n- **First run**: Creates a new terminal named `jbang-FileName.java`\n- **Subsequent runs**: Reuses the same terminal, just sends a new command\n- **Different files**: Each file gets its own dedicated terminal\n\n### Auto-save Feature\n\nBefore executing, the extension:\n\n1. Checks if the file has unsaved changes\n2. Automatically saves the file if needed\n3. Then runs the jbang command with the latest code\n\nThis ensures you always run the current version of your code!\n\n## Development\n\n### Project Structure\n\n```\njbang-jupyter-runner/\n\u251c\u2500\u2500 src/                    # TypeScript source code\n\u2502   \u251c\u2500\u2500 index.ts           # Extension entry point\n\u2502   \u2514\u2500\u2500 runButton.ts       # Run button implementation\n\u251c\u2500\u2500 style/                  # CSS styles\n\u251c\u2500\u2500 jbang_jupyter_runner/  # Python package\n\u2502   \u251c\u2500\u2500 __init__.py\n\u2502   \u251c\u2500\u2500 _version.py\n\u2502   \u2514\u2500\u2500 labextension/      # Built extension (generated)\n\u251c\u2500\u2500 lib/                    # Compiled JavaScript (generated)\n\u251c\u2500\u2500 package.json           # npm configuration\n\u251c\u2500\u2500 pyproject.toml         # Python package configuration\n\u2514\u2500\u2500 tsconfig.json          # TypeScript configuration\n```\n\n## License\n\nMIT License - see LICENSE file for details\n",
    "bugtrack_url": null,
    "license": "MIT License\n        \n        Copyright (c) 2025 Jupyter Java\n        \n        Permission is hereby granted, free of charge, to any person obtaining a copy\n        of this software and associated documentation files (the \"Software\"), to deal\n        in the Software without restriction, including without limitation the rights\n        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n        copies of the Software, and to permit persons to whom the Software is\n        furnished to do so, subject to the following conditions:\n        \n        The above copyright notice and this permission notice shall be included in all\n        copies or substantial portions of the Software.\n        \n        THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n        SOFTWARE.",
    "summary": "Jupyter Lab extension to run .java and .jsh files with jbang",
    "version": "0.1.3",
    "project_urls": null,
    "split_keywords": [
        "java",
        " jbang",
        " jupyter",
        " jupyterlab",
        " jupyterlab-extension"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "ef321de01e03d06c783805acc221531929c30fa94bb643db33287a19aa98a468",
                "md5": "517b405094841900a2bd16f204a03843",
                "sha256": "61f6086d3490776f9bf6baf67490249306f71cc4b7bfe3b2ddd1392e95ec3375"
            },
            "downloads": -1,
            "filename": "jbang_jupyter_runner-0.1.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "517b405094841900a2bd16f204a03843",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 26623,
            "upload_time": "2025-10-08T15:46:59",
            "upload_time_iso_8601": "2025-10-08T15:46:59.514830Z",
            "url": "https://files.pythonhosted.org/packages/ef/32/1de01e03d06c783805acc221531929c30fa94bb643db33287a19aa98a468/jbang_jupyter_runner-0.1.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "e1fd52ea634e5524dc99297a7fe27f39909460cb64697e1f34756272714b72dd",
                "md5": "cee48a3515d216def1d225611ee2bcee",
                "sha256": "c4f9cc98296aa14da301c1202683ae5e6c4dfaa9f3d579b0ec73947b34f89ced"
            },
            "downloads": -1,
            "filename": "jbang_jupyter_runner-0.1.3.tar.gz",
            "has_sig": false,
            "md5_digest": "cee48a3515d216def1d225611ee2bcee",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 1035246,
            "upload_time": "2025-10-08T15:47:01",
            "upload_time_iso_8601": "2025-10-08T15:47:01.358972Z",
            "url": "https://files.pythonhosted.org/packages/e1/fd/52ea634e5524dc99297a7fe27f39909460cb64697e1f34756272714b72dd/jbang_jupyter_runner-0.1.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-10-08 15:47:01",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "jbang-jupyter-runner"
}
        
Elapsed time: 0.76000s