python-neutronclient is a client library for the OpenStack Networking (Neutron) API. It provides Python API bindings and previously included a command-line interface. As of version 11.8.0, the project is deprecated; its CLI code has been removed, and no new features will be added. All new development and migrations under OpenStack governance are directed towards using OpenStackSDK and OpenStack Client.
Install & Compatibility
Where this runs
tested against v12.0.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
muslpy 3.10–3.920 runs
installs and imports cleanly · install 0.0s · import 0.954s · 113.2MB
glibcpy 3.10–3.920 runs
installs and imports cleanly · install 10.1s · import 0.878s · 115MB
122MB installed
● package 122MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
from neutronclient.v2_0 import client
This quickstart demonstrates how to authenticate with OpenStack Keystone using environment variables and then initialize the Neutron client to list networks. It uses `keystoneauth1` for robust session management.
import os
from keystoneauth1 import identity
from keystoneauth1 import session
from neutronclient.v2_0 import client
# Set these environment variables or replace with actual values
OS_AUTH_URL = os.environ.get('OS_AUTH_URL', 'http://auth.example.com:5000/v3')
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_USER_DOMAIN_NAME = os.environ.get('OS_USER_DOMAIN_NAME', 'Default')
OS_PROJECT_DOMAIN_NAME = os.environ.get('OS_PROJECT_DOMAIN_NAME', 'Default')
# Authenticate using Keystone v3 password flow
auth = identity.Password(
auth_url=OS_AUTH_URL,
username=OS_USERNAME,
password=OS_PASSWORD,
project_name=OS_PROJECT_NAME,
user_domain_name=OS_USER_DOMAIN_NAME,
project_domain_name=OS_PROJECT_DOMAIN_NAME
)
sess = session.Session(auth=auth)
# Create a Neutron client instance
neutron_client = client.Client(session=sess)
# Example: List networks
try:
networks = neutron_client.list_networks()
print("Networks:")
for net in networks['networks']:
print(f" - {net['name']} ({net['id']})")
except Exception as e:
print(f"Error listing networks: {e}")
Upgrade
Version history
Breaking-change detection hasn't run for this library yet.
Audit
Security & dependencies
CVE tracking and dependency tree are planned for a later release.