{"id":3728,"library":"os-service-types","title":"OpenStack Service Types Authority Client","description":"Python library for consuming OpenStack sevice-types-authority data. It provides easy consumption of official OpenStack service types and their historical aliases, including a built-in version of the data for offline use. Current version is 1.8.2. Being an OpenStack project, its releases typically align with OpenStack development cycles.","status":"active","version":"1.8.2","language":"en","source_language":"en","source_url":"https://github.com/openstack/os-service-types","tags":["openstack","cloud","service-types","api-client"],"install":[{"cmd":"pip install os-service-types","lang":"bash","label":"Install stable version"}],"dependencies":[{"reason":"Build system requirement.","package":"pbr","optional":false},{"reason":"Required for Python versions older than 3.8 to support typing features.","package":"typing-extensions","optional":true},{"reason":"Required if a remote session is used to fetch service types; otherwise, built-in data is used. (Can also be keystoneauth1.session.Session).","package":"requests","optional":true}],"imports":[{"symbol":"ServiceTypes","correct":"from os_service_types import ServiceTypes"}],"quickstart":{"code":"from os_service_types import ServiceTypes\n\n# Initialize with built-in data (no network access required)\nservice_types = ServiceTypes()\n\n# Get data for an official service type\ncompute_service = service_types.get_official_service_data(\"compute\")\n\nif compute_service:\n    print(f\"Official compute service name: {compute_service.name}\")\n    print(f\"Compute project: {compute_service.project}\")\n    print(f\"Aliases for compute: {service_types.get_aliases('compute')}\")\nelse:\n    print(\"Compute service not found in built-in data.\")\n\n# Check if a type is an alias\nif service_types.is_alias(\"nova\"): # 'nova' is an alias for 'compute'\n    print(\"'nova' is an alias.\")\n\n# To fetch remote data, pass a requests.Session or keystoneauth1.session.Session instance:\n# import requests\n# session = requests.Session()\n# remote_service_types = ServiceTypes(session=session)\n# remote_image_service = remote_service_types.get_official_service_data(\"image\")\n# if remote_image_service:\n#     print(f\"Remote image service name: {remote_image_service.name}\")","lang":"python","description":"The primary class is `ServiceTypes`, which can be initialized without arguments to use embedded service type data or with a `session` object (e.g., `requests.Session`) to fetch the latest data remotely. After initialization, you can query for service data, aliases, and check service type properties."},"warnings":[{"fix":"Handle `IOError` or `ValueError` for remote fetching, or omit `only_remote=True` to allow fallback to built-in data. Ensure a valid `session` is passed if `only_remote=True`.","message":"When initializing `ServiceTypes`, if `only_remote=True` is set, the library will not fall back to built-in data upon network failures. This can lead to an `IOError` if remote data cannot be fetched or a `ValueError` if no session object is provided.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Set `warn=True` during initialization (`ServiceTypes(warn=True)`) to enable these warnings and monitor console/logs for non-official type usage.","message":"The `ServiceTypes` constructor accepts a `warn=True` parameter. If enabled, the library will emit warnings when a non-official service type is provided to its methods. This is useful for identifying deprecated or custom service types that might not conform to the official registry.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Always use the official service types where possible. Refer to `service_types.get_official_service_data()` to ensure you are using the correct primary service type. Understand that aliases are for historical compatibility, not active development of new type names.","message":"The OpenStack Service Types Authority strongly discourages changing official `service-type` names due to the significant breaking implications for users and existing deployments. While the library handles aliases, relying on new alias additions or changes to existing official types can lead to instability. A requested alias cannot match a different alias directly because of historical versioning implications.","severity":"breaking","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}