DNAnexus Python SDK (dxpy)

raw JSON →
0.408.2 verified Mon Apr 27 auth: no python

DNAnexus Platform API bindings for Python (dxpy). Current version 0.408.2, requires Python >=3.8. Used to interact with the DNAnexus platform for managing genomic data, workflows, and analyses. Actively maintained with frequent releases.

pip install dxpy
error ImportError: No module named dxpy
cause dxpy not installed or not in the current Python environment.
fix
Run pip install dxpy in the target environment.
error dxpy.exceptions.DXAPIError: Authentication required
cause Auth token missing or expired.
fix
Set DX_AUTH_TOKEN environment variable or use dxpy.set_security_context({'auth_token': '...'}).
error AttributeError: module 'dxpy' has no attribute 'DXJob'
cause Outdated dxpy version (<0.300) or incorrect import.
fix
Upgrade dxpy: pip install --upgrade dxpy and ensure you use import dxpy.
breaking Python 2 support dropped in dxpy >=0.300. Upgrade your code to Python 3.8+.
fix Use Python 3.8+ and update any deprecated API calls.
gotcha Don't import individual submodules (e.g., `from dxpy import DXHTTPRequest`). Always use `import dxpy` and access attributes via `dxpy.`.
fix Use `import dxpy` and call `dxpy.DXHTTPRequest()`.
gotcha Environment vars `DX_AUTH_TOKEN` and `DX_PROJECT_ID` must be set or authentication will fail silently.
fix Set environment variables or call `dxpy.set_security_context()` with explicit credentials.

Sets authentication and lists accessible projects.

import os
import dxpy

dxpy.set_security_context({
    'auth_token': os.environ.get('DX_AUTH_TOKEN', ''),
    'project_id': os.environ.get('DX_PROJECT_ID', '')
})

# List projects
for p in dxpy.find_projects():
    print(p.name)