Metadata-Version: 2.4
Name: nanohub-dash
Version: 0.1.2
Summary: Jupyter magic commands for configuring Dash apps on nanoHUB
Author: nanoHUB
License: MIT
Project-URL: Homepage, https://github.com/nanohub/nanohub-dash
Project-URL: Repository, https://github.com/nanohub/nanohub-dash
Keywords: jupyter,dash,nanohub,magic
Classifier: Development Status :: 4 - Beta
Classifier: Framework :: IPython
Classifier: Framework :: Jupyter
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Python: >=3.8
Description-Content-Type: text/markdown
Requires-Dist: ipython>=7.0

# nanohub-dash

[![Documentation Status](https://readthedocs.org/projects/nanohub-dash/badge/?version=latest)](https://nanohub-dash.readthedocs.io/en/latest/?badge=latest)

Tools for running Dash applications on nanoHUB.

## Documentation

Full documentation is available at [https://nanohub-dash.readthedocs.io](https://nanohub-dash.readthedocs.io)

## Installation

```bash
pip install nanohub-dash
```

## Features

- **Jupyter Magic Command** (`%set_dash_env`): Configure environment variables for Dash apps directly in Jupyter notebooks
- **Command-line Tool** (`start_dash`): Launch Dash applications with automatic proxy configuration and header injection

## Quick Start

### Jupyter Notebook

```python
%load_ext nanohubdash
%set_dash_env

import os
from dash import Dash, html

app = Dash(__name__,
    routes_pathname_prefix=os.getenv("DASH_ROUTES_PATHNAME_PREFIX"),
    requests_pathname_prefix=os.getenv("DASH_REQUESTS_PATHNAME_PREFIX")
)
app.layout = html.Div("Hello nanoHUB!")

if __name__ == "__main__":
    app.run(
        jupyter_server_url=os.environ.get("DASH_BASE_PROXY"),
        host=os.environ.get("DASH_HOST", "0.0.0.0"),
        port=os.environ.get("DASH_PORT", "8001"),
    )
```

### Command Line

```bash
start_dash --app myapp.py
```

## Environment Variables

The magic command sets the following environment variables:

- `DASH_REQUESTS_PATHNAME_PREFIX` - The proxy path prefix for Dash requests
- `DASH_ROUTES_PATHNAME_PREFIX` - Set to `/`
- `DASH_HOST` - The bind host for Dash
- `DASH_PORT` - The port for Dash
- `DASH_BASE_PROXY` - The proxy URL (https://proxy.<hub_host>)

## Requirements

- Python >= 3.8
- IPython >= 7.0
- Must be running on a nanoHUB environment with `SESSION` and `SESSIONDIR` environment variables set

## License

MIT License - Copyright 2026 HUBzero Foundation, LLC.
