Basic Installation
The Python gRPC SDK is published to PyPI and can be installed just like any other Python package viapip. All you need to do to install it is run:
Developer Installation
For access to bleeding-edge features, you can build the package from source code. The recommended installation for most purposes is the basic install described above. Before getting started with the API, we need to set up a local development environment. Following this article will walk you through how to set up your local development environment, download our repository (which includes everything you need to get started), and verify your environment setup.0. (Optional) Create and activate a Python virtual environment…
Using thevenv module which ships with your Python install, create a virtual environment named “venv” thusly:
python3 here to access the ‘system’ Python executable.
To activate the environment:
python will access the Python executable for the activated environment, rather than the system Python. Installing Python packages — either from source as described below or via pip — will only impact the environment Python executable.
To deactivate the virtual environment, simply run the command deactivate.
1. Clone the stability-sdk repository from GitHub…
The stability-sdk repository (as of 0.3.0) has dependencies on git submodules. To fetch these submodules while cloning, use the --recurse-submodules argument:
--branch argument:
switch command after cloning to pull and checkout into any branch hosted at the origin remote (following these instructions, your origin remote will be set to https://github.com/stability-ai/stability-sdk.git). After navigating into the repository:
2. Navigate into the stability-sdk repository directory…
3. Install the Python SDK…
To use pip to install from the local codebase rather than pulling a package from PyPI, we simply pass the current location (i.e..) as an argument:
-e argument:
4. Optionally, set the STABILITY_HOST and STABILITY_KEY environment variables…
We’ll set these inside the example scripts as well, but this sets them in the environment so that you don’t need to pass these values as explicit arguments.
Note that export is Linux / MacOS syntax. If you are using Windows, you will need to use the set command instead.