osclient
OpenStack client library with simplified authentication and client management.
Features
- Simplified OpenStack authentication using environment variables or direct parameters
- Support for multiple OpenStack services (Nova, Keystone, Cinder, Neutron, Glance, Allocation)
- Two authentication approaches:
OpenStack(using keystoneauth1) andOpenStack2(direct REST API) - Lazy loading of service clients
Installation
pip install osclient
Usage
Using OpenStack class (keystoneauth1-based)
from osclient import OpenStack
# Using environment variables
os_client = OpenStack()
# Or with explicit parameters
os_client = OpenStack(
auth_url='https://keystone.example.com:5000/v3',
project_id='your-project-id',
username='your-username',
password='your-password'
)
# Access service clients
servers = os_client.nova.servers.list()
images = os_client.glance.images.list()
Using OpenStack2 class (REST API-based)
from osclient import OpenStack2
os_client = OpenStack2(
auth_url='https://keystone.example.com:5000/v3',
project_name='your-project-name',
username='your-username',
password='your-password'
)
# Query services directly
servers = os_client.query('compute', 'servers')
Environment Variables
The library supports standard OpenStack environment variables:
OS_AUTH_URLOS_PROJECT_IDorOS_TENANT_IDOS_PROJECT_NAMEorOS_TENANT_NAMEOS_USERNAMEOS_PASSWORDOS_USER_DOMAIN_ID(defaults to 'default')OS_PROJECT_DOMAIN_ID(defaults to 'default')
Requirements
- Python 3.6+
- keystoneauth1
- python-novaclient
- python-keystoneclient
- python-cinderclient
- python-neutronclient
- nectarallocationclient
- python-glanceclient
- requests
Development
Building
To build the package, install the build dependencies and run:
# Install build dependencies
pip install build wheel
# Build source and wheel distributions
python -m build
This will create dist/ directory with both source distribution (.tar.gz) and wheel (.whl) files.
Alternatively, you can install the package in development mode:
pip install -e .
Testing
Install the development dependencies:
pip install -e ".[dev]"
Run the tests:
# Run all tests
pytest
# Run tests with coverage
pytest --cov=osclient --cov-report=html
# Run specific test file
pytest test/test_v1.py
pytest test/test_v2.py
Publishing
To publish the package to PyPI:
-
Build the package (see Building section above)
-
Install twine (if not already installed):
pip install twine
-
Upload to TestPyPI (recommended for first-time publishing):
twine upload --repository testpypi dist/*
-
Upload to PyPI:
twine upload dist/*
You will be prompted for your PyPI credentials. Alternatively, you can use an API token by setting:
export TWINE_USERNAME=__token__ export TWINE_PASSWORD=your_pypi_api_token
Note: Make sure to update the version number in both setup.py and pyproject.toml before publishing a new release.
License
MIT
Metadata
Release files for osclient 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| osclient-0.1.1.tar.gz | 8.5 kB | Without provenance | Details for osclient-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| osclient-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for osclient-0.1.1-py3-none-any.whl |
Total release size: 15.8 kB
Release files / osclient-0.1.1.tar.gz
| Download URL | osclient-0.1.1.tar.gz |
|---|---|
| Size | 8.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
af2afc13e630f39339909d1858a6a21a7419a127d528d58695162539775cb280
|
|
BLAKE2b-256 checksum How to use checksums |
e7677d0b2214221fc39b8cc465e27c51a8810f972c3f82c5494980e3a49d1c8b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.5
|
Release files / osclient-0.1.1-py3-none-any.whl
| Download URL | osclient-0.1.1-py3-none-any.whl |
|---|---|
| Size | 7.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
157e8c31fa5b159ecd03b646adab021bb4614ce49809985f9a6f55d10e00b1f8
|
|
BLAKE2b-256 checksum How to use checksums |
746b7c86af5c0c45433d2a4f0fe25395f2053c453b052c75273a5130da1704ed
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.5
|
Security for osclient 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.