Write your own Ocean integration
After scaffolding, implement the third-party logic, configuration, and deployment for your custom-coded Ocean integration.
Your code should return raw objects from the third-party API. Keep those objects mapping-agnostic so users can change how data appears in Port without changing your Python code. Port applies the mapping configuration and updates the catalog.
Build flow
- Define configuration files -
.port/spec.yaml, optional blueprints and default mapping. - Implement an API client - authenticate and paginate with Ocean's async HTTP client.
- Handle resyncs -
@ocean.on_resynchandlers that yield batches of raw data. - Implement incremental sync - optional
@ocean.on_incremental_resynchandlers for changed-since fetches. - Kinds and selectors - optional custom mapping fields in
integration.py. - Implement live events - optional webhook processors.
- Test and run locally - env vars,
make run, and resync triggers. - Development guidelines - httpx, logging, performance, and raw-data practices.
- Deploy - Docker and Helm with your private image.
Reference
- Ocean and event contexts -
oceanandeventglobals. - Configuration validation - types in
spec.yaml. - Ocean framework - event listeners, live events runtime, actions, probe, and advanced configuration.