Metadata-Version: 2.4
Name: jupyterlab-spark-webui
Version: 0.1.0
Summary: JupyterLab extension to open the Spark Web UI via the notebook proxy
Project-URL: Homepage, https://github.com/your-org/jupyterlab-spark-webui
Project-URL: Repository, https://github.com/your-org/jupyterlab-spark-webui
Project-URL: Issues, https://github.com/your-org/jupyterlab-spark-webui/issues
Author-email: Your Name <you@example.com>
License: MIT
Keywords: jupyter,jupyterlab,jupyterlab-extension,spark
Classifier: Framework :: Jupyter
Classifier: Framework :: Jupyter :: JupyterLab
Classifier: Framework :: Jupyter :: JupyterLab :: 4
Classifier: Framework :: Jupyter :: JupyterLab :: Extensions
Classifier: Framework :: Jupyter :: JupyterLab :: Extensions :: Prebuilt
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.8
Requires-Dist: jupyter-server-proxy>=4.0.0
Description-Content-Type: text/markdown

# jupyterlab-spark-webui

A JupyterLab extension that adds a **Spark UI** menu entry to the menu bar.
When clicked, it checks whether Apache Spark is running on port 4040 and opens
the Spark jobs page as an embedded JupyterLab tab via
[jupyter-server-proxy](https://github.com/jupyterhub/jupyter-server-proxy).

## Requirements

| Requirement | Version |
|-------------|---------|
| JupyterLab | ≥ 4.0 |
| jupyter-server-proxy | ≥ 4.0 |
| Python | ≥ 3.8 |

## Installation

```bash
pip install jupyterlab-spark-webui
```

No additional steps are needed. JupyterLab discovers the extension
automatically after installation.

### Verify installation

```bash
jupyter labextension list
# jupyterlab-spark-webui v0.1.0 enabled OK
```

## Usage

1. Start a Spark session in a notebook (this starts the Spark UI on port 4040).
2. Click **Spark UI** in the JupyterLab menu bar.
3. Click **Open Spark UI**.
   - If Spark is running → the jobs page opens as a JupyterLab tab.
   - If Spark is not running → a dialog displays *"No Spark found (port 4040)."*

The extension resolves the proxy URL from the current page path, so it works
in JupyterHub deployments at any base URL prefix
(e.g. `/notebook/<namespace>/<name>/lab`).

## Uninstallation

```bash
pip uninstall jupyterlab-spark-webui
```

---

## Development

### Prerequisites

- Python ≥ 3.8 with [uv](https://docs.astral.sh/uv/)
- Node.js ≥ 18 with npm

### Setup and build

```bash
git clone https://github.com/your-org/jupyterlab-spark-webui
cd jupyterlab-spark-webui

./build.sh          # build everything + produce dist/*.whl
./start-lab.sh      # launch JupyterLab with the extension loaded
```

Pass `--no-wheel` to skip the wheel build during development iteration:

```bash
./build.sh --no-wheel
```

### Project structure

```
├── src/
│   └── index.ts          # Extension entry point (TypeScript)
├── jupyterlab_spark_webui/
│   ├── __init__.py       # Python package / labextension path declaration
│   └── labextension/     # Built JS bundle (generated by build.sh)
├── style/
│   └── index.css
├── pyproject.toml        # Python package metadata and build config
├── package.json          # npm package and TypeScript dependencies
├── tsconfig.json         # TypeScript compiler config
├── build.sh              # Full build + deploy + wheel script
└── start-lab.sh          # Launch JupyterLab using the uv environment
```

---

## Publishing to PyPI

### 1. Prerequisites

- A [PyPI](https://pypi.org) account
- A PyPI API token (generate one at *Account settings → API tokens*)

### 2. Update metadata

Edit `pyproject.toml` and set the correct `authors`, `[project.urls]`, and
bump `version` before each release.

### 3. Build

```bash
./build.sh          # produces dist/jupyterlab_spark_webui-<version>-py3-none-any.whl
```

### 4. Publish

With **uv** (recommended):

```bash
uv publish --token pypi-<your-token>
```

Or with **twine**:

```bash
pip install twine
twine upload dist/* --username __token__ --password pypi-<your-token>
```

### 5. Test on TestPyPI first (optional but recommended)

```bash
# Publish to the test registry
uv publish --publish-url https://test.pypi.org/legacy/ --token pypi-<test-token>

# Install from the test registry
pip install --index-url https://test.pypi.org/simple/ jupyterlab-spark-webui
```

### Checklist before publishing

- [ ] `version` bumped in `pyproject.toml` **and** `package.json`
- [ ] `authors` and `[project.urls]` filled in
- [ ] `./build.sh` ran successfully and `dist/*.whl` exists
- [ ] Extension verified working locally via `./start-lab.sh`
- [ ] `git tag v<version>` created and pushed
