Registry / devops / python-novaclient

python-novaclient

JSON →
library18.13.0pypypi✓ verified 85d ago

python-novaclient is a client library for the OpenStack Compute (Nova) API, enabling Python applications to programmatically interact with OpenStack's compute resources. It provides a comprehensive Python API (the `novaclient` module) to manage virtual servers, images, flavors, and other Nova-related services. This library is actively developed as part of the OpenStack ecosystem, with releases typically synchronized with OpenStack major versions, and the current version is 18.12.0.

pip install python-novaclient
INSTALL
IMPORT
SIG · PYTHON-NOVACLIENT
P
python-novaclient
devopspythonv18.13.0
Install
4.9s avg
Import
1209ms
Disk
56MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v18.13.0 · 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 1.245s · 53.8MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 4.9s · import 1.174s · 55MB
56MB installed
● package 56MB
Code
Verified usage

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

Client
from novaclient.client import Client
from novaclient import client

This quickstart demonstrates how to initialize the Nova client and perform basic operations like listing available compute flavors and running servers. It uses environment variables for authentication, which is a common practice in OpenStack CLI tools and scripts. For production applications, using `keystoneauth1.session.Session` is the recommended and more robust authentication method.

import os from novaclient import client # OpenStack credentials (often sourced from an 'openrc' file) OS_USERNAME = os.environ.get('OS_USERNAME', 'your_username') OS_PASSWORD = os.environ.get('OS_PASSWORD', 'your_password') OS_PROJECT_NAME = os.environ.get('OS_PROJECT_NAME', 'your_project_name') OS_AUTH_URL = os.environ.get('OS_AUTH_URL', 'http://your_keystone_ip:5000/v3') OS_REGION_NAME = os.environ.get('OS_REGION_NAME', 'RegionOne') OS_USER_DOMAIN_NAME = os.environ.get('OS_USER_DOMAIN_NAME', 'Default') OS_PROJECT_DOMAIN_NAME = os.environ.get('OS_PROJECT_DOMAIN_NAME', 'Default') # Initialize the Nova client # For robust authentication, consider using keystoneauth1.session.Session # and passing it to the client for 'session' parameter. # Example: from keystoneauth1.identity import v3; from keystoneauth1 import session # auth = v3.Password(auth_url=OS_AUTH_URL, username=OS_USERNAME, ...) # sess = session.Session(auth=auth) # nova = client.Client(api_version='2.latest', session=sess, region_name=OS_REGION_NAME) # Using direct parameters for simplicity in quickstart, but keystoneauth1 is better for production nova = client.Client( api_version='2.latest', username=OS_USERNAME, password=OS_PASSWORD, project_name=OS_PROJECT_NAME, auth_url=OS_AUTH_URL, region_name=OS_REGION_NAME, user_domain_name=OS_USER_DOMAIN_NAME, project_domain_name=OS_PROJECT_DOMAIN_NAME ) # List available flavors (instance types) try: flavors = nova.flavors.list() print(f"Available Flavors ({len(flavors)}):") for flavor in flavors: print(f" - {flavor.name} (ID: {flavor.id}, RAM: {flavor.ram}MB, VCPUs: {flavor.vcpus})") # List available servers servers = nova.servers.list() print(f"\nRunning Servers ({len(servers)}):") if not servers: print(" No servers found.") for server in servers: print(f" - {server.name} (ID: {server.id}, Status: {server.status})") except Exception as e: print(f"An error occurred: {e}") print("Please ensure your OpenStack credentials (environment variables) are correctly set.")
nova --version
Debug
Known issues
deprecatedThe `nova` command-line script, which is installed alongside `python-novaclient`, is deprecated. Users are encouraged to use the Python API directly or the unified `openstackclient` for command-line interactions.
fix
Migrate command-line usage to `openstackclient` or write Python scripts using the `novaclient` API.
affects: All recent versions
gotchaOpenStack authentication, especially with Keystone v3, can be complex due to varying required parameters (e.g., domain IDs/names). Directly passing credentials to `novaclient.client.Client` can be brittle.
fix
Utilize the `keystoneauth1` library to manage authentication sessions (`keystoneauth1.identity.v3.Password` or similar) and pass the `session` object to `novaclient.client.Client`. This provides a more robust and flexible authentication mechanism.
affects: All versions supporting Keystone v3 (typically Nova API v2.0 and newer).
gotchaOpenStack Nova API extensively uses microversions to introduce new features and changes without incrementing the major API version (e.g., API v2.0 has many microversions like 2.53, 2.94). Client behavior can differ significantly based on the microversion negotiated or specified.
fix
Be explicit about the `api_version` when initializing the client (e.g., `api_version='2.latest'` or a specific version like `'2.94'`). Consult the Nova API Reference for microversion-specific changes and capabilities. Code should ideally handle expected microversion ranges or capabilities.
affects: All versions supporting Nova API v2.0+.
deprecatedThe `nova x509-create-cert` and `nova x509-get-root-cert` commands and the `novaclient.v2.certs` API binding are deprecated and scheduled for removal in future major releases after Nova server 16.0.
fix
Avoid using these x509 certificate management features within the Nova client. Look for alternative OpenStack services or direct API interactions if certificate management is required.
affects: Pike series (9.x) onwards.
Upgrade
Version history
18.13.0latest on PyPI · released May 13, 2026
Audit
Dependencies
keystoneauth1requiredRecommended for robust authentication against OpenStack Identity (Keystone) services, especially with Keystone v3. While not a direct `install_requires` for `python-novaclient`, it's a critical operational dependency for most real-world usage.
Agent activity
19 hits · last 30 days
node
18
Amazon
1
Resources
python-novaclient — pip install python-novaclient · libregistry