CLI & SDK
Get up and running with Gretel's CLI and SDK.
Last updated
Was this helpful?
Get up and running with Gretel's CLI and SDK.
Last updated
Was this helpful?
The Gretel CLI and Python SDK are made available through both (most common) and .
We require using Python 3.11+ when using the CLI and SDK. You can download Python 3.11 (or newer) and install manually, or you may wish to install Python 3.11+ . If you are working with a new Python installation or environment you should also .
To get started, you will need to setup your environment and install the appropriate packages.
The most straightforward way to install the gretel-client
CLI and SDK is with pip:
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.
If you are using to run Gretel jobs on your own cloud infrastructure, the Gretel CLI and SDK will require your cloud provider's respective Python libraries. To install these dependencies run the relevant command below.
After installing the package, you should configure authentication with Gretel Cloud. This will be required in order to create and utilize any models.
If you are installing Gretel on a system that you own or wholly control, we highly recommend configuring the CLI and SDK once with our configuration assistant. If you do this once, you will be able to use the CLI and SDK without doing specific authentication before running any commands.
To begin the CLI configuration process, use the command:
This will walk you through some prompts. You may press <ENTER>
to accept the default which is shown in square brackets for each prompt. The prompt will look similar to:
Press <ENTER>
to accept the default value for the Endpoint. (https://api.gretel.cloud
)
The Artifact Endpoint is only required for Gretel Hybrid users. If you are using Gretel Cloud, press <ENTER>
to accept the default value of cloud
. If you are a Gretel Hybrid user the configured value should be the URI for the Sink Bucket which was created during the Gretel Hybrid deployment. This would be the resource identifier for an Amazon S3 Bucket, Azure Storage Container, Google Cloud Storage Bucket.
Amazon S3 Example: s3://your-sink-bucket
Azure Storage Example: azure//your-sink-bucket
Google Cloud Storage Example: gcs://your-sink-bucket
The Default Runner is set for cloud
. Press <ENTER>
to accept the default value unless you are a Gretel Hybrid user or are running Gretel locally on your own machine(s). We recommend keeping cloud
as the default runner, which will utilize Gretel Cloud's auto-scaling GPU and CPU fleet to create and utilize models.
If you are a Gretel Hybrid user set this value to hybrid
to utilize hybrid runners.
If you need to run compute on your own machine(s) set this value to local
.
When prompted for your Default Project, you may optionally enter a Project Name or press <ENTER>
to accept the default.
Finally, you can test your configuration using the command:
If the configuration is good to go, you should get back an output like this:
At this point, you are authenticated with Gretel, and can use the CLI without needing to re-authenticate. If you run into trouble, feel free to contact us for help!
The Gretel Client uses cloud provider specific libraries to interact with the underlying object storage via the smart_open
library. If you're a Gretel Hybrid user you may need to configure your environment with proper credentials for your specific cloud provider.
When prompted for your Gretel API Key, paste the key you created in the .
See additional storage setup instructions per cloud provider .
Gretel Python Client docs can be found .
When using AWS, the Gretel Client will look for default credentials already configured on your system. Docs for configuring credentials can be found . For Gretel CLI usage we recommend configuring the "credentials file" (which can be done using the AWS CLI) or utilizing environment variables. Both of these authentication methods are outlined in the linked documentation.
When using Azure, the Gretel Client will look for credentials already configured on your system. Docs for configuring credentials can be found . For Gretel CLI usage we recommend authenticating with the Azure CLI or utilizing environment variables. Both of these authentication methods are outlined in the linked documentation.
The AZURE_STORAGE_ACCOUNT_NAME
may be used to configure the Gretel Client with , but it will try all of the options supported by . AZURE_STORAGE_ACCOUNT_NAME
should contain the value of the storage account associated with your storage container.
When using GCP, the Gretel Client will look for default credentials already configured on your machine. Docs for configuring GCP credentials can be found . For Gretel CLI usage we recommend authenticating with the GCP CLI (gcloud
).