oci uses a simple dict to build clients and other components. You can build these manually, or oci can parse and validate a config file.

Using the default configuration location ~/.oci/config you can use config.from_file() to load any profile. By default, the DEFAULT profile is used:

>>> from oci.config import from_file
>>> config = from_file()

# Using a different profile from the default location
>>> config = from_file(profile_name="integ-beta")

# Using the default profile from a different file
>>> config = from_file(file_location="~/.oci/")

Since config is a dict, you can also build it manually and check it with config.validate_config():

import os
from myproject import testrunner
user_ocid = os.environ["USER_OCID"]
key_file = key_for(user_ocid)

config = {
    "user": user_ocid,
    "key_file": key_file,
    "fingerprint": calc_fingerprint(key_file),
    "tenancy": testrunner.tenancy,
    "region": testrunner.region

from oci.config import validate_config

See also

The SDK and Tool Configuration page has a full description of the required and supported options. These are supported across the SDKs, so if you've already set this file up for the Ruby or Java SDKs, you're all set.