SDK
Get up and running with Gretel's Python SDK.
Gretel's Python SDK is made available through both PyPi (most common) and GitHub.
Installation
Prerequisites
We require using Python 3.11+ when using the SDK. You can download Python 3.11 (or newer) here and install manually, or you may wish to install Python 3.11+ from your terminal. If you are working with a new Python installation or environment you should also verify that pip is installed.
Gretel Client
To get started, you will need to setup your environment and install the appropriate packages.
The most straightforward way to install the gretel-client
SDK is with pip:
pip install -U gretel-client
The -U
flag will ensure the most recent version is installed. Occasionally we will ship a Release Candidate (RC) version of the package. These are generally safe to install, you may optionally include this with the inclusion of the --pre
flag.
If you wish to have the most recent development features, you may also choose to install directly from GitHub with the following command. This may be suggested from our Customer Success team if you are testing new features that have not been fully released yet.
pip install git+https://github.com/gretelai/gretel-python-client@main
Configure your Gretel session
Your Gretel session is configured upon instantiation of a Gretel
object.
gretel = Gretel(api_key="prompt")
The default is to create or reuse a project called default-sdk-project
. If you instead want to specify an existing project to use, you can reference it by its Project ID, available below the name on the Projects list view. Here is an example:
gretel = Gretel(api_key="prompt", default_project_id="example-project-7b2cb5d118e8a58")
If Gretel cannot find a project for the ID you specified, Gretel will create a new project for you. The new project's name will be the value you put in the ID. For example, the below code generates a project named example-project
with an ID similar to that shown in the screenshot above.
gretel = Gretel(api_key="prompt", default_project_id="example-project")
Last updated
Was this helpful?