Skip to main content

Python SDK

The latest version of fused-py is 1.20.1.

Documentation overview

Python Install

Python Version: 3.10+

pip install "fused[all]"
Installation details
note

Installing fused is required if you're running fused on your end (locally or in a development environment). If you're working in Workbench UDF Builder or App Builder fused is already installed for you.

  1. Set up a Python environment:

We're using venv but you could use conda or any other environment manager in Python.

python3 -m venv .venv
source .venv/bin/activate
  1. Install the fused package:

You can only install the base package, though we recommend still adding the optional dependencies:

pip install fused

Or install with optional dependencies:

# For raster data processing
pip install "fused[raster]"

# For vector data processing
pip install "fused[vector]"

# Install all optional dependencies
pip install "fused[all]"

Authenticate

The first time you use Fused you'll need to authenticate.

from fused.api import NotebookCredentials

credentials = NotebookCredentials()
print(credentials.url)

Follow the URL in your browser to authenticate.

Basic API usage

Some basic examples of how to use fused to run UDFs:

Hello World UDF

import fused

@fused.udf
def udf(x: int = 1):
return f"Hello world {x + x}"

fused.run(udf)
>> Hello world 2

Simple data UDF

import fused

@fused.udf
def udf(x: int = 3):
import pandas as pd
return pd.DataFrame({"x": range(x)})

fused.run(udf)
>>   | x |
|---|---|
| 0 | 0 |
| 1 | 1 |
| 2 | 2 |