A Python client for interacting with the Lightdash API.
pip install lightdashSee the SDK Guide for full documentation on the query builder, filters, and other features.
For an interactive tutorial, check out the example notebook.
from lightdash import Client
client = Client(
instance_url="https://your-instance.lightdash.com",
access_token="your-access-token",
project_uuid="your-project-uuid"
)- Clone the repository:
git clone https://github.com/lightdash/python-sdk.git
cd python-sdk- Create and activate a virtual environment:
uv venv- Set up your environment variables by copying the example file:
cp .env.example .env- Edit
.envwith your Lightdash credentials:
LIGHTDASH_INSTANCE_URL="https://your-instance.lightdash.com"
LIGHTDASH_ACCESS_TOKEN="your-access-token"
LIGHTDASH_PROJECT_UUID="your-project-uuid"- Install development dependencies:
just installView all available commands:
justCommon commands:
just install- Install development dependenciesjust test- Run acceptance testsjust build- Build package distributionsjust clean- Remove build artifacts
Create a ~/.pypirc file with your PyPI API tokens:
[pypi]
username = __token__
password = your-pypi-token-here
[testpypi]
username = __token__
password = your-testpypi-token-hereMake sure to:
- Use API tokens instead of your actual username/password
- Keep the file secure (
chmod 600 ~/.pypirc) - Never commit this file to version control
- Use different tokens for TestPyPI and PyPI
- Generate tokens with minimal required permissions
First, test your package on TestPyPI:
just publish-testIf everything looks good on TestPyPI, publish to PyPI:
just publishNote: The package version in pyproject.toml must be incremented for each new release.
MIT