openshift-client
OpenShift python client
What it is and what it does
openshift-client is a Python wrapper around the OpenShift oc command-line tool that lets you programmatically query and manage cluster resources. Instead of making direct REST API calls, it invokes oc commands and parses their output, making it accessible to anyone familiar with the CLI. The library centers on selectors—a concept for querying collections of resources by kind, name, or label—and APIObject instances that represent individual resources and expose convenience methods for common operations like reading logs or modifying metadata.
The package is designed for automation scripts and tools that need to interact with OpenShift clusters without adding external dependencies to the cluster itself. It trades some capabilities (like watch functionality or fine-grained error codes) for simplicity and portability. If your use case fits within CLI-level interactions—querying resources, applying changes, gathering logs—this library provides a readable, fluent API. If you need controller-like behavior or precise HTTP error handling, the documentation suggests looking elsewhere.
Use it for:
- Automate pod log collection and analysis across multiple projects in a cluster.
- Write deployment or scaling scripts that query and modify OpenShift resources by selector.
- Build monitoring or reporting tools that gather resource metadata and status from a running cluster.
- Manage custom resources (CRDs) without needing to generate or maintain Python bindings.
- Run cluster administration tasks from a bastion host via SSH without installing additional cluster software.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides a Python API for interacting with OpenShift clusters by wrapping the oc command-line tool, enabling programmatic resource selection, querying, and management without requiring direct REST API calls.
Yes, if you need to automate OpenShift cluster operations from Python and already have oc installed and configured. The low install friction, permissive license, and stable API make it a practical choice for scripting and one-off automation. No, if you need watch functionality, precise HTTP error codes, or expect active maintenance—the package is dormant and explicitly not designed for controller-like workloads.
Install
openshift-client on PyPI
pip
pip install openshift-clientuv
uv add openshift-clientpoetry
poetry add openshift-clientInstalling openshift-client
Before you install
Low install friction with three lightweight runtime dependencies (build, six, pyyaml). Maintenance is dormant—last release was 617 days ago, though the repository remains active with a recent commit on 2025-01-09 and 86 stars. Suitable for stable use cases but expect no rapid updates.
License in practice
Licensed under Apache License 2.0 (permissive). You may use, modify, and distribute the package freely in commercial and private projects, provided you include a copy of the license and note any changes you make.
Quickstart
pip install openshift-client
import openshift_client as oc
with oc.project('my-project'):
pods = oc.selector('pods').qnames()
print(f'Found pods: {pods}')
Requires the oc command-line tool to be installed and accessible in your system PATH, and a configured connection to an OpenShift cluster (typically via prior `oc login`).
Verify before relying
- Whether the package supports watch functionality or only one-shot CLI invocations as documented.
- Performance characteristics when selecting or operating on large numbers of resources.
- Compatibility with OpenShift versions released after the last package update in December 2024.
Package facts
| License | Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for… (full text in the JSON record) (permissive) |
| Python support | supports the current Python release (>=3.0) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 3 — build, six, pyyaml |
| Maintenance | dormant — 617 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 184,086/month — #10,045 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: openshift_client-2.0.5-py3-none-any.whl
Keywords: OpenShift
Tags
More Utilities packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
charset-normalizerDetects and normalizes text encoding from…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
PygmentsPygments is a syntax highlighter that colorizes…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
openshiftPython client library for interacting with…
permissive · top 15,000 on PyPI
kr8sA Python client library for Kubernetes that…
permissive · top 5,000 on PyPI
azure-mgmt-redhatopenshiftProvides Python bindings to manage Red Hat…
permissive · top 5,000 on PyPI
kubernetesProvides a Python interface to the Kubernetes…
permissive · top 1,000 on PyPI
kubernetes-asyncioAsynchronous Python client for the Kubernetes…
permissive · top 5,000 on PyPI
livyA Python client for Apache Livy that enables…
permissive · top 15,000 on PyPI
runpodRunpod is a Python SDK and API client library…
permissive · top 5,000 on PyPI
portforwardProvides Python bindings for Kubernetes…
permissive · top 15,000 on PyPI
k8s-agent-sandboxA Python client library for creating and…
permissive · top 15,000 on PyPI
osc-placementProvides a command-line interface to the…
permissive · top 15,000 on PyPI