Registry / devops / duplocloud-client

duplocloud-client

JSON →
library0.4.3pypypiunverified

The `duplocloud-client` library provides a Python SDK for programmatically interacting with DuploCloud portals, enabling management of infrastructure, tenants, services, and various cloud resources. It serves as the underlying library for the `duploctl` command-line interface. Currently at version 0.4.3, the library maintains a frequent release cadence with minor updates and fixes, often coinciding with new feature introductions in the DuploCloud platform.

pip install duplocloud-client
INSTALL
IMPORT
SIG · DUPLOCLOUD-CLIENT
D
duplocloud-client
devopspythonv0.4.3
Install
2.6s avg
Import
514ms
Disk
23MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.4.3 · 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 0.117s · 25.3MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 2.6s · import 0.089s · 26MB
23MB installed
● package 23MB
Code
Verified usage

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

DuploClient
from duplocloud import DuploClient
from duplocloud import DuploClient

This quickstart demonstrates how to initialize the `DuploClient` using environment variables for authentication and then attempts to list tenants. Ensure `DUPLO_HOST`, `DUPLO_TOKEN`, and optionally `DUPLO_TENANT` are set in your environment. The example also shows how to use the `DuploCtl.from_env()` for a CLI-like callable interface to interact with resources.

import os from duplocloud.client import DuploClient # Ensure DUPLO_HOST and DUPLO_TOKEN are set in your environment duplo_host = os.environ.get('DUPLO_HOST', 'https://example.duplocloud.net') # Replace with your DuploCloud portal URL duplo_token = os.environ.get('DUPLO_TOKEN', '') # Replace with your DuploCloud API token duplo_tenant = os.environ.get('DUPLO_TENANT', 'default') # Optional: your target tenant if not duplo_token: print("Error: DUPLO_TOKEN environment variable not set.") exit(1) if not duplo_host: print("Error: DUPLO_HOST environment variable not set.") exit(1) try: # Initialize the client client = DuploClient(host=duplo_host, token=duplo_token, tenant_name=duplo_tenant) print(f"Successfully initialized DuploClient for host: {duplo_host}, tenant: {duplo_tenant}") # Example: List tenants (assuming the token has appropriate permissions) # The client often exposes resources as attributes or methods following CLI patterns. # Direct programmatic access might vary, but a common pattern is to access resource managers. # For this example, we'll assume a 'tenant' resource is accessible for listing. # Note: Specific resource methods might require exploration of the DuploClient object. print("\nAttempting to list tenants...") try: # This is an illustrative example. Actual resource access might be via client.get('tenant') # or client.tenant.list(). Refer to DuploCloud's SDK documentation for exact methods. # The `duploctl` CLI uses `duplocloud.controller.DuploCtl.from_env()` for a callable interface. from duplocloud.controller import DuploCtl duplo_cli_callable, _ = DuploCtl.from_env() # Reads from env vars for convenience tenants = duplo_cli_callable("tenant", "list") print("Tenants:") for tenant in tenants: print(f" - {tenant.get('Name')} (ID: {tenant.get('TenantId')})") except Exception as e: print(f"Could not list tenants (this might be due to permissions or API structure): {e}") except Exception as e: print(f"An error occurred during client initialization or operation: {e}")
duploctl --version
Debug
Known issues
breakingVersion 0.4.0 introduced a significant architectural change with a new decorator-based scope system (`@Resource`). This release removed previous deep inheritance hierarchies like `DuploTenantResourceV2` and `DuploTenantResourceV3`. Code relying on these older class structures will break and needs to be refactored to use the new decorator pattern.
fix
Review classes extending `DuploTenantResourceV2` or `DuploTenantResourceV3`. Update them to use the `@Resource(name, scope="portal"|"tenant")` decorator and adapt to the mixin pattern for dynamic tenant functionality.
affects: >=0.4.0
gotchaPrior to version 0.4.1, the `aws_secret find` command/method could incorrectly return 'Resource not found' even when the secret existed, especially if the full prefixed name was not initially provided. This required manual prefixing or retrying with different names.
fix
Upgrade to version 0.4.1 or newer. For older versions, ensure you provide the `duploservices-<tenant>-<name>` prefix when searching for AWS secrets, or implement retry logic.
affects: <0.4.1
gotchaAs of version 0.4.3, the `apply()` method now specifically catches `DuploNotFound` errors (HTTP 404) instead of the broader `DuploError`. If your code had a generic `except DuploError` block for 404 scenarios within `apply()`, it might now need to explicitly catch `DuploNotFound` or adjust its error handling for more granular control.
fix
Review error handling for `apply()` operations. Consider catching `DuploNotFound` specifically for 404 errors, or ensure your general `DuploError` handler still covers the desired cases if `DuploNotFound` inherits from `DuploError` (which is likely).
affects: >=0.4.3
Upgrade
Version history
0.4.3latest on PyPI · released Mar 18, 2026
Audit
Dependencies
pythonrequiredRequired for execution
Agent activity
29 hits · last 30 days
node
26
OpenAI (training)
1
Resources
duplocloud-client — pip install duplocloud-client · libregistry