Installation

The Graphora client library is designed to be easy to install and has minimal dependencies. This guide will walk you through the installation process and help you get set up quickly.

Requirements

  • Python 3.7 or higher
  • pip (Python package installer)

Installing with pip

The recommended way to install the Graphora client library is using pip:

pip install graphora

This will install the library and all its dependencies.

Installing from source

If you prefer to install from source, you can clone the repository and install it using pip:

git clone https://github.com/graphora/graphora-client.git
cd graphora-client
pip install -e .

Dependencies

The Graphora client library has the following dependencies:

  • requests>=2.25.0 - For making HTTP requests to the Graphora API
  • pydantic>=1.8.0 - For data validation and settings management
  • pyyaml>=5.4.0 - For parsing YAML ontology files

These dependencies will be automatically installed when you install the library using pip.

Verifying the installation

You can verify that the library is installed correctly by importing it in Python:

import graphora

print(graphora.__version__)
# Should print: 0.2.0

This should print the version number of the installed library.

Environment setup

The Graphora client library uses environment variables for configuration. You can set these variables in your environment or provide them directly when initializing the client.

Required: User ID

All API calls require a user ID to scope the operations to your account. You can set it as an environment variable:

export GRAPHORA_USER_ID="your-user-id"

Or provide it directly when initializing the client:

from graphora import GraphoraClient

client = GraphoraClient(
    base_url="https://api.graphora.io",
    user_id="your-user-id",  # Required
    api_key="your-api-key"
)

API key

You’ll need an API key to authenticate with the Graphora API. You can set it as an environment variable:

export GRAPHORA_API_KEY="your-api-key"

Or provide it directly when initializing the client:

from graphora import GraphoraClient

client = GraphoraClient(
    base_url="https://api.graphora.io",
    user_id="your-user-id",
    api_key="your-api-key"
)

API URL

By default, the client will connect to the production API URL. You can override this by setting the GRAPHORA_API_URL environment variable:

export GRAPHORA_API_URL="https://api.graphora.io"

Or provide it directly when initializing the client:

from graphora import GraphoraClient

client = GraphoraClient(
    base_url="https://api.graphora.io",
    user_id="your-user-id"
)

Complete Environment Setup

Here’s a complete example of setting up your environment:

# Required
export GRAPHORA_USER_ID="your-user-id"
export GRAPHORA_API_KEY="your-api-key"

# Optional
export GRAPHORA_API_URL="https://api.graphora.io"

With these environment variables set, you can initialize the client with minimal parameters:

from graphora import GraphoraClient

# Uses environment variables for configuration
client = GraphoraClient(base_url="https://api.graphora.io")

Next steps

Now that you have installed the Graphora client library, you can: