Skip to main content

Deckhouse python library

Simplifies writing module hooks for Kubernetes operators:

NOTE:

  • The API is in alpha stage

Install

pip install deckhouse

Sample hook

# hello.py
from deckhouse import hook

def main(ctx: hook.Context):
    # Manipulate kubernetes state
    # ... object = { "kind" : "Pod", "apiVersion" : "v1", ... }
    ctx.kubernetes.create_or_update(object)

    # Export metrics
    # ... metric = { "name" : "power", "group": "my_hook", "set" : 9000, ... }
    ctx.metrics.collect(metric)

    # Use in-memory values for helm chart. Shell Operator does not support values, but Addon Operator and Deckhouse do.
    ctx.values.myModule.deployment.replicas = 5


if __name__ == "__main__":
    hook.run(main, configpath="hello.yaml") # 'config' arg is also supported for raw string
# hello.yaml
configVersion: v1
onStartup: 10

How to test

An example for pytest

# hello_test.py

from hello import main
from deckhouse import hook

# Inputs
#   initial_values = { ... }
#   binding_context = [ { ... } ]
# Outputs
#   expected_metrics = [ ... ]
#   expected_kube_operations = [ ... ]
#   expected_values_patches = [ ... ]
#   expected_values = { ... }

def test_hello():
    out = hook.testrun(main, binding_context, initial_values)

    assert out.metrics.data == expected_metrics
    assert out.kube_operations.data == expected_kube_operations
    assert out.values_patches.data == expected_values_patches

    assert out.values.myModule.deployment.replicas == 5

Development

  • Create virtual environment with python >= 3.12
  • Install poetry
  • poetry install
  • make test

Metadata

Release files for deckhouse 0.4.13

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for deckhouse 0.4.13
File Size Uploaded Provenance Actions
deckhouse-0.4.13.tar.gz 14.8 kB With provenance Details for deckhouse-0.4.13.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for deckhouse 0.4.13
File Interpreter ABI Platform Actions
deckhouse-0.4.13-py3-none-any.whl Python 3 none any Details for deckhouse-0.4.13-py3-none-any.whl

Total release size: 33.0 kB

Release files / deckhouse-0.4.13.tar.gz

Download URL deckhouse-0.4.13.tar.gz
Size 14.8 kB
Tags Source
SHA-256 checksum
How to use checksums
46156f97a9c2f347462483ffe66466b6ec682a3277bc27acc0621d2248c7065a
BLAKE2b-256 checksum
How to use checksums
bb6b1005c9056e739757860b55105a82c8da404747458da0d4070d728dea528a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 12, 2026.

Transparency log

Release files / deckhouse-0.4.13-py3-none-any.whl

Download URL deckhouse-0.4.13-py3-none-any.whl
Size 18.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
69ad3e53cca0e95a587a49b8a3c359c3fdc150586dfb1cf8e5acff62bc950bbb
BLAKE2b-256 checksum
How to use checksums
45e0cdb399b115a055d7f4c2d4b6131db0418941c1306c6989d94a90b1512a3b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 12, 2026.

Transparency log

Security for deckhouse 0.4.13

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for deckhouse-0.4.13.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 12, 2026.

Transparency log

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page