Skip to main content

No project description provided

Project description

kraken-core

The kraken.core package provides the primitives of describing a build and deriving build tasks.

Aside from the kraken.core package, this package also provides the kraken.api module that is used only at runtime by Kraken build scripts and the kraken.testing module for Pytest fixtures.

How does it work?

Kraken uses tasks to describe units of work that can be chained and establish dependencies between each other. Each task has a schema that defines its input and output properties. When an output property is linked to the input property of another task, this established as dependency between the tasks.

from kraken.std.docker_gen import generate_dockerfile
from kraken.std.docker_build import build_docker_image
dockerfile = generate_dockerfile(source_file="Dockerfile.yml")
build_docker_image(dockerfile=dockerfile.path, tags=["example:latest"], load=True)

This populates the project with two tasks and connects the computed output property of one to the other, allowing the tasks that will run for build_docker_image() to pick up the dynamically generated Dockerfile that is written into a location in the build directory by the generate_dockerfile() task.

Core API

Kraken tasks are described with a schema. Each schema field has a type and may be an input or output parameter. Output parameters are only available once a resource is executed; Kraken will that a proper execution order is established such that output properties are hydrated before another resource tries to access them as an input.

from kraken.core.task import Context, Task, Property, Output, task_factory
from typing_extensions import Annotated

class GenerateDockerfileTask(Task):
    source_file: Property[str]
    path: Annotated[Property[str], Output]

    def execute(self, ctx: Context) -> None:
        path = Path(self.path.setdefault(str(ctx.build_directory / "Dockerfile")))
        path.write_text(render_dockerfile(Path(self.source_file.get()).read_text()))

generate_dockerfile = task_factory(GenerateDockerfileTask)

Project details


Release history Release notifications | RSS feed

This version

0.2.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kraken-core-0.2.0.tar.gz (14.3 kB view details)

Uploaded Source

Built Distribution

kraken_core-0.2.0-py3-none-any.whl (17.2 kB view details)

Uploaded Python 3

File details

Details for the file kraken-core-0.2.0.tar.gz.

File metadata

  • Download URL: kraken-core-0.2.0.tar.gz
  • Upload date:
  • Size: 14.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.3 readme-renderer/35.0 requests/2.28.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.64.0 importlib-metadata/4.12.0 keyring/23.6.0 rfc3986/2.0.0 colorama/0.4.5 CPython/3.10.2

File hashes

Hashes for kraken-core-0.2.0.tar.gz
Algorithm Hash digest
SHA256 e1bc0b5471bda9e327807272516d7d31e59ae44540b7701cdb1a81cd0839d54b
MD5 dbe79a32259c4ed727497397b60ec05c
BLAKE2b-256 2d7baab1b18f861bffedfc7c0516db1b46539868321dc35beebc014078b5c1c8

See more details on using hashes here.

File details

Details for the file kraken_core-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: kraken_core-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 17.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.3 readme-renderer/35.0 requests/2.28.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.64.0 importlib-metadata/4.12.0 keyring/23.6.0 rfc3986/2.0.0 colorama/0.4.5 CPython/3.10.2

File hashes

Hashes for kraken_core-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 284594351b8afaf279376429f47ed55d7c71476e1404182bde30c2861226f041
MD5 ae8f2d51f95630759c47beec1da76c16
BLAKE2b-256 d7fba58fc1926a7f22fdc308b93bc69e6fd9ac791e431e5b01a96eebd2e174c9

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page