Registry / devops / app-common-python

app-common-python

JSON →
library0.2.9pypypi✓ verified 70d ago

app-common-python is a simple client access library designed to retrieve configuration for applications running within the Red Hat OpenShift Clowder operator environment. It provides Python wrappers and helper functions to easily access details related to Kafka topics, RDS certificate authorities, Kafka broker servers, object storage buckets, and other service dependency endpoints, abstracting away the underlying JSON configuration provided by Clowder. The current version is 0.2.9, with releases occurring periodically to update schemas and introduce new features.

pip install app-common-python
INSTALL
IMPORT
SIG · APP-COMMON-PYTHON
A
app-common-python
devopspythonv0.2.9
Install
1.6s avg
Import
18ms
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.2.9 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.920 runs
installs and imports cleanly · install 0.0s · import 0.021s · 17.8MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 1.6s · import 0.016s · 18MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

LoadedConfig
from app_common_python import LoadedConfig
Provides access to Clowder-injected configuration data.
isClowderEnabled
from app_common_python import isClowderEnabled
Helper function to check if the application is running in a Clowder-enabled environment.

This quickstart demonstrates how to import and use `LoadedConfig` and `isClowderEnabled` to access application configuration provided by the Clowder operator. It includes examples for checking the Clowder environment, retrieving a public port, and accessing Kafka server and topic details.

from app_common_python import LoadedConfig, isClowderEnabled import os def main(): if isClowderEnabled(): print(f"Application running in Clowder environment.") # Access public port, for example if hasattr(LoadedConfig, 'PublicPort'): print(f"Public Port: {LoadedConfig.PublicPort}") else: print("PublicPort attribute not found in LoadedConfig. Check Clowder configuration.") # Example: Get Kafka servers kafka_servers = LoadedConfig.KafkaServers print(f"Kafka Servers: {kafka_servers}") # Example: Get a specific Kafka topic by name # Assuming 'my-topic' is a configured topic if 'my-topic' in LoadedConfig.KafkaTopics: my_topic = LoadedConfig.KafkaTopics['my-topic'] print(f"Kafka Topic 'my-topic': {{'name': {my_topic.Name}, 'hostname': {my_topic.Hostname}}}") else: print("Application not running in Clowder environment or Clowder not enabled.") print("Configuration might need to be provided via environment variables (e.g., ACG_CONFIG).") if __name__ == "__main__": # For local testing without Clowder, you might set ACG_CONFIG # e.g., os.environ['ACG_CONFIG'] = 'path/to/test.json' main()
Debug
Known issues
gotchaThis library is specifically designed to interact with the Red Hat OpenShift Clowder operator for configuration management. It is not a general-purpose configuration library. Usage outside a Clowder-managed environment will result in `isClowderEnabled()` returning `False` and `LoadedConfig` attributes being unavailable or empty.
fix
Ensure your application is deployed within a Clowder-managed OpenShift environment or provide a mock configuration if testing locally (e.g., via `ACG_CONFIG` environment variable).
affects: All versions
gotchaConfiguration values accessed via `LoadedConfig` (e.g., `LoadedConfig.PublicPort`, `LoadedConfig.KafkaServers`) directly reflect the JSON provided by Clowder. If the underlying Clowder configuration for your application is missing or malformed for a specific attribute, accessing that attribute will likely result in an `AttributeError` or an empty value.
fix
Thoroughly review your Clowder `ClowdApp` and `ClowdEnvironment` definitions to ensure all required configuration keys are present and correctly structured for your application. Use `hasattr(LoadedConfig, 'attribute_name')` for robustness.
affects: All versions
gotchaFor local development or testing without a full Clowder deployment, configuration often needs to be supplied via environment variables, such as `ACG_CONFIG` pointing to a local JSON file. Failing to set these variables or providing an invalid file will lead to an unconfigured state.
fix
Set the `ACG_CONFIG` environment variable to the path of a valid Clowder-compatible JSON configuration file for local development or testing. Example: `export ACG_CONFIG="./test.json"`.
affects: All versions
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'app_common_python'
The `app-common-python` library is not installed in the current Python environment or there's a typo in the import statement.
fix
Install the package using `pip install app-common-python`. Double-check the import statement: `from app_common_python import LoadedConfig`.
AttributeError: type object 'LoadedConfig' has no attribute 'PublicPort'
The `PublicPort` attribute is not present in the Clowder configuration loaded by `LoadedConfig`, or the application is not running in a Clowder-enabled environment (`isClowderEnabled()` is False).
fix
Verify that your application's `ClowdApp` configuration in OpenShift explicitly defines a public port. If running locally, ensure `ACG_CONFIG` is set and points to a valid JSON file containing the `PublicPort` entry. Always check `if hasattr(LoadedConfig, 'PublicPort'):` before accessing such attributes.
KeyError: 'my-topic'
The requested Kafka topic 'my-topic' is not defined or available in the Clowder-provided configuration, or it's requested with an incorrect `requestedName`.
fix
Ensure the Kafka topic is correctly configured and referenced by its `requestedName` in your Clowder `ClowdApp` resource. Access Kafka topics robustly using `if 'my-topic' in LoadedConfig.KafkaTopics:`.
Upgrade
Version history
0.2.9latest on PyPI · released Oct 23, 2025
Audit
Dependencies

No dependency data recorded yet.

Agent activity
8 hits · last 30 days
node
6
Resources
app-common-python — pip install app-common-python · libregistry