Registry / http-networking / os-service-types

os-service-types

JSON →
library1.9.0pypypi✓ verified 22d ago

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.

pip install os-service-types
INSTALL
IMPORT
SIG · OS-SERVICE-TYPES
O
os-service-types
http-networkingpythonv1.9.0
Install
1.9s avg
Import
59ms
Disk
20MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.8.2 · 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.95 runs
installs and imports cleanly · install 0.0s · import 0.064s · 19.2MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.9s · import 0.054s · 20MB
20MB installed
● package 20MB
Code
Verified usage

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

ServiceTypes
from os_service_types import ServiceTypes

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.

from os_service_types import ServiceTypes # Initialize with built-in data (no network access required) service_types = ServiceTypes() # Get data for an official service type compute_service = service_types.get_official_service_data("compute") if compute_service: print(f"Official compute service name: {compute_service.name}") print(f"Compute project: {compute_service.project}") print(f"Aliases for compute: {service_types.get_aliases('compute')}") else: print("Compute service not found in built-in data.") # Check if a type is an alias if service_types.is_alias("nova"): # 'nova' is an alias for 'compute' print("'nova' is an alias.") # To fetch remote data, pass a requests.Session or keystoneauth1.session.Session instance: # import requests # session = requests.Session() # remote_service_types = ServiceTypes(session=session) # remote_image_service = remote_service_types.get_official_service_data("image") # if remote_image_service: # print(f"Remote image service name: {remote_image_service.name}")
Debug
Known issues
gotchaWhen 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.
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`.
affects: All versions
gotchaThe `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.
fix
Set `warn=True` during initialization (`ServiceTypes(warn=True)`) to enable these warnings and monitor console/logs for non-official type usage.
affects: All versions
breakingThe 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.
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.
affects: All versions
Errors
Common errors & fixes
ValueError: If session is None and only_remote is True
The ServiceTypes constructor was initialized with only_remote=True, but no session object was provided to enable remote data fetching.
fix
Initialize ServiceTypes with a valid session object (e.g., from `requests` or `keystoneauth1`) when `only_remote` is `True`, or omit `only_remote=True` to use the built-in data. Example: `from os_service_types import ServiceTypes; from requests import Session; services = ServiceTypes(session=Session(), only_remote=True)` or `services = ServiceTypes()`.
IOError: If session is given and only_remote is True and there is an error fetching remote data
The library attempted to fetch service type data from a remote source, but a network issue or an error with the remote API prevented the data from being retrieved.
fix
Ensure network connectivity and verify the accessibility of the remote OpenStack Service Types Authority. If remote fetching is not critical, remove `only_remote=True` from the `ServiceTypes` constructor to allow the library to fall back to its built-in data.
ModuleNotFoundError: No module named 'os_service_types'
The `os-service-types` Python package is either not installed or not correctly installed in the current Python environment, or the import statement uses the incorrect module name.
fix
Install the package using pip: `pip install os-service-types`. Ensure your import statement is `from os_service_types import ServiceTypes`.
ERROR: os-service-types X.Y.Z has requirement pbr!=A.B.C,>=D.E.F, but you'll have pbr G.H.I which is incompatible.
There is a version conflict with the `pbr` package, a dependency of `os-service-types`, where another installed package requires an incompatible version of `pbr`.
fix
Attempt to upgrade `os-service-types` and its dependencies: `pip install --upgrade os-service-types`. If conflicts persist, consider creating a new virtual environment or manually identifying and installing compatible versions of `pbr` and other conflicting packages.
Upgrade
Version history
1.9.0latest on PyPI · released Aug 4, 2026
Audit
Dependencies
pbrrequiredBuild system requirement.
typing-extensionsoptionalRequired for Python versions older than 3.8 to support typing features.
requestsoptionalRequired if a remote session is used to fetch service types; otherwise, built-in data is used. (Can also be keystoneauth1.session.Session).
Agent activity
12 hits · last 30 days
node
10
Amazon
1
Resources
os-service-types — pip install os-service-types · libregistry