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.8
  • Install poetry
  • poetry install
  • make test

Metadata

Release files for deckhouse 0.4.12

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.12
File Size Uploaded Provenance Actions
deckhouse-0.4.12.tar.gz 13.2 kB With provenance Details for deckhouse-0.4.12.tar.gz

Built distribution (wheel)

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

Total release size: 29.5 kB

Release files / deckhouse-0.4.12.tar.gz

Download URL deckhouse-0.4.12.tar.gz
Size 13.2 kB
Tags Source
SHA-256 checksum
How to use checksums
dffa9f763cd8f670c65414791f49e87bd27d96e371a0c32148366e56e9abb53c
BLAKE2b-256 checksum
How to use checksums
49d7ef4455bdf298ff23b31ba28ff01f92184a02269fb33ed5051fe8a5c079d5
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.12-py3-none-any.whl

Download URL deckhouse-0.4.12-py3-none-any.whl
Size 16.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b057090973bdaaefdf22cb8121b9dd641ad99b9eb2c95a779b49baba96e956e9
BLAKE2b-256 checksum
How to use checksums
1d1e8388c10d87f305b960f9b73429e0dab35b4bc539df8a34a5e1cae14c7092
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.12

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.12.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