Python client library to interact with the IBM Cloud Code Engine API.
- Overview
- Prerequisites
- Breaking Changes (March 2026)
- Installation
- Using the SDK
- Questions
- Issues
- Open source @ IBM
- Contributing
- License
The IBM Cloud Code Engine Python SDK allows developers to programmatically interact with the following IBM Cloud services:
| Service Name | Imported Class Name |
|---|---|
| IBM Cloud Code Engine V2 | CodeEngineV2 |
| IBM Cloud Code Engine V1 | IbmCloudCodeEngineV1 |
- An IBM Cloud account.
- An IAM API key to allow the SDK to access your account. Create one here.
- Python 3.9 or above.
-
Service method renames (pluralization) Update list methods and their
operation_ids accordingly:# before ce.list_allowed_outbound_destination(project_id, limit=100, start=token) # after ce.list_allowed_outbound_destinations(project_id, limit=100, start=token)
# before ce.list_persistent_data_store(project_id, limit=100, start=token) # after ce.list_persistent_data_stores(project_id, limit=100, start=token)
-
Pager class renames Use the new pluralized pager classes and doc tag strings:
# before pager = ibm_code_engine_sdk.code_engine_v2.AllowedOutboundDestinationPager(ce, project_id, limit=100) # after pager = ibm_code_engine_sdk.code_engine_v2.AllowedOutboundDestinationsPager(ce, project_id, limit=100)
# before pager = ibm_code_engine_sdk.code_engine_v2.PersistentDataStorePager(ce, project_id, limit=100) # after pager = ibm_code_engine_sdk.code_engine_v2.PersistentDataStoresPager(ce, project_id, limit=100)
-
Allowed outbound destinations: new type & fields; constructor shape changes
- New type supported:
"private_path_service_gateway"(in addition to"cidr_block"). Update any branching/validation ontype. - New optional fields on
AllowedOutboundDestinationand subclasses:name,status,status_details- Private Path specific:
private_path_service_gateway_crn,isolation_policy
- Base classes
AllowedOutboundDestination,AllowedOutboundDestinationPatch,AllowedOutboundDestinationPrototype,AllowedOutboundStatusDetailsare now abstract with expanded subclass sets. Instantiate the specific subclass instead, as before, but note the extended list.
- New type supported:
-
Creation prototypes changed
-
AllowedOutboundDestinationPrototypenow requiresname. -
CIDR prototype constructor order changed:
from ibm_code_engine_sdk.code_engine_v2 import AllowedOutboundDestinationPrototypeCidrBlockDataPrototype # before: (type, cidr_block, name) # after: (type, name, cidr_block) cidr_proto = AllowedOutboundDestinationPrototypeCidrBlockDataPrototype( type="cidr_block", name="allow-egress", cidr_block="10.0.0.0/24", )
-
New prototype for Private Path service:
from ibm_code_engine_sdk.code_engine_v2 import ( AllowedOutboundDestinationPrototypePrivatePathServiceGatewayDataPrototype as PPSGProto ) ppsg_proto = PPSGProto( type="private_path_service_gateway", name="pps-to-service-x", private_path_service_gateway_crn="<pps_gateway_crn>", isolation_policy="shared", # optional: "shared" | "dedicated" )
-
-
Patch models changed (do not send
type)-
Remove
typefrom CIDR patch payloads; field and serialization removed:from ibm_code_engine_sdk.code_engine_v2 import AllowedOutboundDestinationPatchCidrBlockDataPatch patch = AllowedOutboundDestinationPatchCidrBlockDataPatch(cidr_block="10.0.1.0/24")
-
New patch model for Private Path destinations:
from ibm_code_engine_sdk.code_engine_v2 import AllowedOutboundDestinationPatchPrivatePathServiceGatewayDataPatch pp_patch = AllowedOutboundDestinationPatchPrivatePathServiceGatewayDataPatch( isolation_policy="dedicated" # "shared" | "dedicated" )
-
-
Probe model:
typeis now required When constructingProbe, set the protocol explicitly:from ibm_code_engine_sdk.code_engine_v2 import Probe # before (omitted `type`) # after (required) probe = Probe( type="http", # "http" or "tcp" initial_delay=5, timeout=2, )
-
Secret model:
formatis now required If you buildSecretinstances (e.g., in replace flows), you must setformat:from ibm_code_engine_sdk.code_engine_v2 import Secret secret = Secret( entity_tag=etag, format="generic", # set the appropriate format value name="my-secret", data={"key": "value"}, )
-
Previously-optional fields are now required in several response models (affects re-use of response as request) These fields are validated as required in model deserialization; if you reuse response objects to send updates, you must provide them:
App:computed_env_variables,run_service_account,run_volume_mountsAppRevision:computed_env_variables,run_service_account,run_volume_mountsBuild:run_build_paramsBuildRun:run_build_params,service_account,source_type,strategy_size,strategy_typeFunction:computed_env_variablesFunctionRuntimeList:function_runtimesJob:computed_env_variables,run_service_account,run_volume_mountsJobRun:computed_env_variables
Example (BuildRun)
from ibm_code_engine_sdk.code_engine_v2 import BuildRun, BuildParam build_run = BuildRun( build_name="my-build", name="run-1", run_build_params=[BuildParam(name="ARG1", value="v")], service_account="default", source_type="git", strategy_size="small", strategy_type="buildpacks", source_url="https://github.com/org/repo", )
-
Allowed outbound destination CIDR model loosened & enriched
entity_tagandnameare no longer required at construction time; they may be absent in incoming JSON.- New status fields added (
status,status_details). Update your parsing/logic if you inspect readiness.
-
New status details and helper models (if you consume detailed status)
AllowedOutboundStatusDetailsbase plus:AllowedOutboundStatusDetailsPrivatePathServiceGatewayStatusDetails
- Helper models:
EndpointGatewayDetailsPrivatePathServiceGatewayDetailsIf you serialize/deserialize status detail trees, include these types.
-
Volume mount doc clarifications (no code changes)
read_onlydescription now explicitly applies to mounts of type'persistent_data_store'.- Name generation references
reference(wasrefin docstring).
-
Storage data enum expansion & doc update
StorageData/StorageDataObjectStorageDatanow enumerate morebucket_locationvalues (regional/zone shorthands). If you validate these values client-side, include the new options.StorageDataObjectStorageDatadoc now specifies key/value constraints.
Migration checklist
- Rename
list_allowed_outbound_destination→list_allowed_outbound_destinations.- Rename
list_persistent_data_store→list_persistent_data_stores.- Switch pagers to pluralized classes.
- Update API
versionupper bound if you set it.- For outbound destination create:
- Provide
namein prototypes.- For CIDR prototype, adjust constructor order to
(type, name, cidr_block).- Use new Private Path prototype when needed.
- For outbound destination patch: remove
type; use CIDR/Private Path specific patch models.- Set required fields now enforced in models (
Probe.type,Secret.format, and the required lists/fields inApp,Build,BuildRun,Function,Job,JobRun, etc.).- Include handling for new enum values:
private_path_service_gateway,statusvalues (ready|failed|deploying), andisolation_policy(shared|dedicated).
To install, use pip or easy_install:
pip install --upgrade "ibm_code_engine_sdk>=5.0.0"or
easy_install --upgrade "ibm_code_engine_sdk>=5.0.0"Examples and a demo are available in the examples folder.
For general SDK usage information, please see this link
If you are having difficulties using this SDK or have a question about the IBM Cloud services, please ask a question Stack Overflow.
If you encounter an issue with the project, you are welcome to submit a bug report. Before that, please search for similar issues. It's possible that someone has already reported the problem.
Find more open source projects on the IBM Github Page
See CONTRIBUTING.md.
This SDK is released under the Apache 2.0 license. The license's full text can be found in LICENSE.