with one click
c8y-python-microservice
Standard practices for developing, testing, and building Python microservices in the Cumulocity ecosystem. Use when creating or refactoring Python microservices.
Menu
Standard practices for developing, testing, and building Python microservices in the Cumulocity ecosystem. Use when creating or refactoring Python microservices.
| name | c8y-python-microservice |
| description | Standard practices for developing, testing, and building Python microservices in the Cumulocity ecosystem. Use when creating or refactoring Python microservices. |
This rule outlines the standard practices for developing, testing, and building Python microservices for Cumulocity.
A standard project should follow this structure:
.
├── .agent/ # AI Agent rules and workflows
├── src/ # Application source code
├── tests/ # Test suite (pytest)
├── cumulocity.json # Microservice manifest
├── Dockerfile # Container definition
├── requirements.txt # Python dependencies
├── build.sh # Build and package script
└── run_local.sh # Local execution script
cumulocity.json)The manifest defines the microservice identity and resource requirements.
PER_TENANT.Use a slim Python base image and ensure the src directory is copied correctly.
In Cumulocity microservices, authentication depends on the isolation mode:
C8Y_USER, C8Y_PASSWORD, and C8Y_TENANT credentials. This user has all roles specified in the requiredRoles section of cumulocity.json already assigned. Microservices should prioritize these variables for API requests.C8Y_BOOTSTRAP_USER, C8Y_BOOTSTRAP_PASSWORD, and C8Y_BOOTSTRAP_TENANT to listen for bootstrap notifications and manage tenant-specific service users.For local development, copy the .env values or export the variables:
export C8Y_BASEURL="https://tenant.cumulocity.com"
export C8Y_USER="your-user"
export C8Y_PASSWORD="your-password"
export C8Y_TENANT="t12345"
build.sh)The build process must build the Docker image, export to image.tar, and create a .zip package. It also needs to increment the version in cumulocity.json. By default the bugfix version but there should be a way with a flag to increase to minor or major version.
REST API documentation and guidance for interacting with the Cumulocity AI service. Use when sending messages to the AI agent.
Multi-scope expert for Cumulocity IoT. Accesses live OpenAPI specs for Core API and Digital Twin Manager (DTM).
Setup the local testing environment for Cumulocity applications to test UI and microservices.
Critical implementation patterns for building Cumulocity microservices that act as MCP (Model Context Protocol) servers. Use when developing MCP servers.
Guidelines for developing microfrontends, plugins, and blueprints in Cumulocity, including manifest configuration and package structure. Use when working with microfrontends.
Guidelines for what needs to be ensured if you want to create a new open source repository in the Cumulocity organization.