Install & Compatibility
Where this runs
tested against v2.2.73 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.910 runs
installs and imports cleanly · install 0.0s · import 0.000s · 75.7MB
glibcpy 3.10–3.910 runs
installs and imports cleanly · install 9.4s · import 0.000s · 77MB
81MB installed
● package 81MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
ApiClientFactory
✓ from lusid import ApiClientFactory
✗ from lusid.utilities import ApiClientFactory
This quickstart demonstrates how to initialize the `ApiClientFactory`, authenticate using environment variables (supporting both Personal Access Token and OAuth2 Client Credentials flows), and make a simple call to list portfolios. Ensure the necessary LUSID environment variables are set before running.
import os
from lusid_sdk.utilities import ApiClientFactory
from lusid_sdk.api import PortfoliosApi
# Configure environment variables for LUSID authentication.
# These can be set in your shell or via a .env file.
# Example for Personal Access Token (PAT):
# export LUSID_FBN_TOKEN='your_finbourne_token'
# export LUSID_API_URL='https://lusid.finbourne.com/api'
# export LUSID_APP_NAME='my-python-app'
#
# Example for OAuth 2.0 Client Credentials:
# export LUSID_CLIENT_ID='your_client_id'
# export LUSID_CLIENT_SECRET='your_client_secret'
# export LUSID_TOKEN_URL='https://identity.finbourne.com/oauth/token'
# export LUSID_API_URL='https://lusid.finbourne.com/api'
# export LUSID_APP_NAME='my-python-app'
try:
# Create an ApiClientFactory instance. It picks up config from environment variables.
# For LUSID_FBN_TOKEN, you would use: ApiClientFactory()
# For OAuth, you might need to pass details if not in env vars, but env vars are preferred.
api_factory = ApiClientFactory()
# Get a specific API client, e.g., for portfolios
portfolios_api: PortfoliosApi = api_factory.build(PortfoliosApi)
# List all portfolios
paginated_response = portfolios_api.list_portfolios(
limit=5,
scope='default'
)
print(f"Successfully connected to LUSID. Found {paginated_response.paging.total_items} portfolios.")
for portfolio in paginated_response.values:
print(f"- {portfolio.display_name} ({portfolio.scope}/{portfolio.code})")
except Exception as e:
print(f"An error occurred: {e}")
if "401 Unauthorized" in str(e):
print("Please check your LUSID authentication details (LUSID_FBN_TOKEN or OAuth credentials).")
elif "Missing configuration" in str(e):
print("Ensure LUSID_API_URL and authentication environment variables are set.")
Debug
Known issues
gotchaThe recommended authentication and client creation mechanism is `ApiClientFactory`. Direct instantiation of `Configuration` and `ApiClient` objects from `lusid_sdk.configuration` and `lusid_sdk.api_client` is still possible but less robust for managing multiple API clients or complex authentication flows.fixAlways prefer `from lusid_sdk.utilities import ApiClientFactory` and use `api_factory.build(YourApiClass)` to get API clients.
affects: >=2.0.0
gotchaMany LUSID API list methods return paginated results. Directly accessing `response.values` will only give the first page. For comprehensive results, you need to iterate through pages or use the SDK's built-in `get_all` helper methods (if available for the specific API endpoint).fixCheck the `list_` method documentation for `get_all_` alternatives or manually handle pagination using `response.paging.next_page` and `limit`/`page` parameters.
affects: All versions
gotchaLUSID is a rapidly evolving platform. The SDK is frequently updated to reflect changes in the underlying LUSID API (new endpoints, modified models, deprecations). Using an outdated SDK version can lead to `AttributeError` for missing fields/methods or unexpected API behaviour.fixRegularly update `lusid-sdk` to the latest version (`pip install --upgrade lusid-sdk`) to ensure compatibility with the LUSID API and access to the newest features.
affects: All versions
breakingMajor version 2.0.0 introduced significant changes to the SDK's internal structure and recommended usage patterns, primarily around how API clients are instantiated and configured. Older code using direct `ApiClient` and `Configuration` setup may break or behave unexpectedly without modification.fixMigrate existing code to use `ApiClientFactory` for all API client instantiation and configuration. Refer to the official SDK documentation for migration guides.
affects: From 2.0.0 onwards
Upgrade
Version history
2.3.129latest on PyPI · released Jun 15, 2026
Audit
Dependencies
No dependency data recorded yet.