Metadata-Version: 2.4
Name: gradipin
Version: 0.1.2
Summary: Static URLs for your Gradio demos. One line of code.
Project-URL: Homepage, https://gradipin.lovable.app
Project-URL: Documentation, https://github.com/gradipin/gradipin-python
Project-URL: Repository, https://github.com/gradipin/gradipin-python
Project-URL: Issues, https://github.com/gradipin/gradipin-python/issues
Author: Gradipin
License: MIT
License-File: LICENSE
Keywords: demo,gradio,ml,share,tunnel
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Libraries
Requires-Python: >=3.10
Requires-Dist: click>=8.1
Requires-Dist: python-dotenv>=1.0
Requires-Dist: requests>=2.31
Provides-Extra: dev
Requires-Dist: build>=1.2; extra == 'dev'
Requires-Dist: mypy>=1.10; extra == 'dev'
Requires-Dist: pytest-mock>=3.12; extra == 'dev'
Requires-Dist: pytest>=8.0; extra == 'dev'
Requires-Dist: responses>=0.25; extra == 'dev'
Requires-Dist: ruff>=0.5; extra == 'dev'
Requires-Dist: twine>=5.1; extra == 'dev'
Requires-Dist: types-requests>=2.31; extra == 'dev'
Provides-Extra: gradio
Requires-Dist: gradio>=4.0; extra == 'gradio'
Description-Content-Type: text/markdown

# Gradipin

**Static URLs for your Gradio demos. One line of code.**

Gradio's `share=True` gives you a public URL that changes every time you restart
your demo. Gradipin sits in front of those tunnels and gives you a stable link
like `https://gradipin.lovable.app/go/<account>/<app>` that always points to
whichever tunnel is currently live — perfect for tweets, READMEs, and your
team's "demos" channel.

```python
import gradio as gr
import gradipin

demo = gr.Interface(lambda x: x.upper(), "text", "text")
gradipin.share(demo, app="vision-model")
# Prints something like:
#   Gradipin: https://gradipin.lovable.app/go/your-account/vision-model
#     → https://abc123.gradio.live
```

The exact URL format depends on your Gradipin deployment — the canonical
public URL is returned by the API and is also exposed as
`session.public_url` if you need it programmatically.

That's it. Restart the script, get a new tunnel, your friends still hit the
same URL.

## Install

```bash
pip install gradipin[gradio]
```

If you're not using Gradio (e.g. you have your own ngrok / cloudflared tunnel
in front of a FastAPI app), the base install is enough:

```bash
pip install gradipin
```

## Authenticate

Grab an API key from [gradipin.lovable.app/dashboard](https://gradipin.lovable.app/dashboard),
then either:

```bash
gradipin login           # saves to ~/.gradipin/config
```

or set the environment variable:

```bash
export GRADIPIN_KEY=gp_live_...
```

or pass it explicitly:

```python
gradipin.share(demo, app="vision-model", key="gp_live_...")
```

## Lower-level API

Have your own public URL? Use the context manager:

```python
import gradipin

with gradipin.session("my-api", url="https://abc.ngrok.io"):
    run_my_fastapi_server()
```

## CLI

```bash
gradipin login            # save your API key
gradipin logout           # forget your API key
gradipin list             # list your apps and their status
gradipin status <app>     # check whether a specific app is live
```

## Configuration precedence

API key resolution (first match wins):

1. Explicit `key=...` argument
2. `GRADIPIN_KEY` environment variable
3. `~/.gradipin/config` (written by `gradipin login`)
4. `GRADIPIN_KEY` in a `.env` file in the current working directory

Other environment variables:

- `GRADIPIN_API_URL` — override the API base URL (default
  `https://gradipin.lovable.app/api/v1`). Useful for self-hosted backends or
  local development.
- `GRADIPIN_HEARTBEAT` — heartbeat interval in seconds (default `30`).

## Development

```bash
git clone https://github.com/gradipin/gradipin-python
cd gradipin-python
uv sync --extra dev --extra gradio
uv run pytest
```

## License

MIT
