Bioprocess Intelligence Python Client
This is the official Python client for interacting with Bioprocess Intelligence – a comprehensive platform for digital bioprocess development and operation.
The client provides programmatic access to the Bioprocess Intelligence API, enabling users to integrate, manage, and analyze bioprocess data. It supports common operations such as managing teams, collections, and processes, and importing structured data from various formats.
As the platform evolves, the client will be extended to cover additional capabilities including real-time data integration, statistical analysis, mechanistic modeling, and more.
Features
- Authenticate using environment variables.
- List teams and collections.
- Create, retrieve, update, and delete processes.
- Import process data from YAML and JSON content.
- Monitor background tasks.
Installation
pip install bioprocess-intelligence
Getting Started
Authentication Methods
The client supports multiple authentication methods:
1. Username/Password Authentication
- Create a
.envfile in your project root:
BPI_API_URL=https://your-api-url
BPI_USERNAME=your_username
BPI_PASSWORD=your_password
- Initialize the client:
from bioprocess_intelligence.client import BioprocessIntelligenceClient
import os
from dotenv import load_dotenv
from pathlib import Path
load_dotenv(Path(__file__).parent / ".env")
client = BioprocessIntelligenceClient(
api_url=os.getenv("BPI_API_URL"),
username=os.getenv("BPI_USERNAME"),
password=os.getenv("BPI_PASSWORD")
)
2. Microsoft Azure Active Directory (AAD) Authentication
For applications using Microsoft authentication, you can authenticate using either a Microsoft ID token or access token:
# Using Microsoft ID token (OAuth2/OIDC flow)
client = BioprocessIntelligenceClient(
api_url="https://your-api-url",
microsoft_id_token="eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIs..."
)
# Using Microsoft access token (API access flow)
client = BioprocessIntelligenceClient(
api_url="https://your-api-url",
microsoft_access_token="eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIs..."
)
Example Usage
List Teams
teams = client.list_teams()
print("Teams:", teams)
Get Collections in a Team
collections = client.list_collections(team_id=5)
Get or Create a Process
try:
process = client.get_process(name="New process", collection_id=123)
except:
process = client.create_process(
name="New process",
collection_id=123
)
Update a Process
process = client.update_process(
process_id=process['id'],
name="Updated name",
description="Updated description",
start_time="2024-01-01T10:00:00+01:00",
end_time="2024-01-07T15:00:00+01:00"
)
Delete a Process
client.delete_process(process['id'])
Importing Process Data
From YAML Content
from pathlib import Path
script_dir = Path(__file__).parent
yaml_file = script_dir / "files/process_import_template_v1.yaml"
try:
content = yaml_file.read_text(encoding="utf-8")
result = client.import_process_from_yaml(
collection_id=123,
content=content,
timezone="UTC"
)
print("Import result:", result)
client.monitor_background_task(result["backgroundTaskId"])
except Exception as e:
print(f"Error importing process from YAML: {e}")
From JSON Content
import json
# Sample JSON data for import
json_data = {
"process": {
"MetaData": [
{"name": "ProcessName", "value": "P_20250101_JSON"},
{"name": "ProcessDescription", "value": "Process imported from JSON"},
{"name": "Timezone", "value": "UTC"},
{"name": "StartTime", "value": "01.01.2025-10:00:00"}
],
"Parameters": [
{"name": "Temperature", "value": 37.0, "units": "°C", "description": "Incubation temperature"},
{"name": "Agitation", "value": 150, "units": "rpm"}
],
"Variable_Group_1": [{
"Timestamp": ["01.01.2025-10:00:00", "01.01.2025-11:00:00", "01.01.2025-12:00:00"],
"Variables": [
{
"name": "OD600",
"units": "AU",
"data": [0.1, 0.2, 0.35],
"description": "Optical density at 600nm"
}
]
}]
}
}
try:
# Convert to JSON string
json_string = json.dumps(json_data)
# Import JSON data (with async mode)
result = client.import_process_from_json(
json_data=json_string,
collection_id=123,
timezone="UTC",
async_mode=True
)
print("JSON Import result:", result)
if 'backgroundTaskId' in result:
# Monitor the background task
client.monitor_background_task(result["backgroundTaskId"])
elif 'processId' in result:
print(f"Process created synchronously with ID: {result['processId']}")
except Exception as e:
print(f"Error importing process from JSON: {e}")
Background Task Monitoring
Many operations like data imports run as background tasks. You can monitor their progress:
# Import data (returns background task info)
result = client.import_process_from_yaml(
collection_id=123,
content=yaml_content,
timezone="UTC"
)
# Or import JSON data
result = client.import_process_from_json(
json_data=json_string,
collection_id=123,
timezone="UTC",
async_mode=True
)
# Monitor the background task until completion
task_id = result["backgroundTaskId"]
status_info = client.monitor_background_task(task_id)
print("Task completed:", status_info)
Process Retrieval
Get Process by ID
process = client.get_process(process_id="456")
Get Process by Name and Collection
# Retrieve a process by its name within a specific collection
process = client.get_process(
name="P_20250101_A02",
collection_id=123
)
print("Found process:", process['id'])
This is particularly useful after importing YAML data when you know the process name but need to retrieve the generated process ID for further operations.
Error Handling
Make sure to wrap API calls in try-except blocks to handle errors gracefully, especially when importing data or querying resources.
License
This client is proprietary software distributed in binary form.
- Free for academic and non-commercial research use
- A commercial license is required for any commercial or for-profit use
To request a commercial license, please contact us at support@wisdomengine.de.
Metadata
Release files for bioprocess-intelligence 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| bioprocess_intelligence-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Release files / bioprocess_intelligence-0.2.0-py3-none-any.whl
| Download URL | bioprocess_intelligence-0.2.0-py3-none-any.whl |
|---|---|
| Size | 19.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
06fee56e508c6517b6f12ba59dd345986a87ec753b4ed128d6bd8e0fae80a7a9
|
|
BLAKE2b-256 checksum How to use checksums |
97d6690d44fa206ea9dabe522ec5ce78e4f28c6561841301e81cf0724e54a6da
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 13, 2025.
Transparency log