Skip to main content

Library for creating evergreen configurations

Project description

shrub.py

A python based Evergreen project config generation library

PyPI - Python Version PyPI version

Overview

Based on shrub, shrub.py is a library for programatically building Evergreen project configurations described here.

Example

The following snippet will create a set of parallel tasks reported under a single display task. It would generate json used by generate.tasks:

from shrub.v3.evg_task import EvgTask, EvgTaskDependency
from shrub.v3.evg_build_variant import BuildVariant, DisplayTask
from shrub.v3.evg_command import FunctionCall
from shrub.v3.evg_project import EvgProject
from shrub.v3.shrub_service import ShrubService


n_tasks = 10
def define_task(index):
    name = f"task_name_{index}"

    return EvgTask(
        name=name,
        commands=[
            FunctionCall(func="do setup"),
            FunctionCall(
                func="run test generator",
                vars={"parameter_1": "value 1", "parameter_2": "value 2"}
            ),
            FunctionCall(func="run tests")
        ],
        depends_on=[EvgTaskDependency(name="compile")]
    )

tasks = [define_task(i) for i in range(n_tasks)]
display_task = DisplayTask(name="test_suite", execution_tasks=[t.name for t in tasks])
variant = BuildVariant(name="linux-64", tasks=[], display_tasks=[display_task])
project = EvgProject(buildvariants=[variant], tasks=tasks)

print(ShrubService.generate_json(project))

Run tests

poetry run pytest

Project details


Download files

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

Source Distribution

shrub_py-3.4.0.tar.gz (33.6 kB view details)

Uploaded Source

Built Distribution

shrub_py-3.4.0-py3-none-any.whl (40.0 kB view details)

Uploaded Python 3

File details

Details for the file shrub_py-3.4.0.tar.gz.

File metadata

  • Download URL: shrub_py-3.4.0.tar.gz
  • Upload date:
  • Size: 33.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.9.2 Linux/5.15.0-1021-aws

File hashes

Hashes for shrub_py-3.4.0.tar.gz
Algorithm Hash digest
SHA256 57b1c32a91fa0c4ce7f506178f72d38f7bf2691e76c75a66683e72354b9cd600
MD5 21859881b72f259268098ab94de5c995
BLAKE2b-256 6e28b0a6c4bb6136b6a0c30b9a1f689198c38a7f6661a33ae807a3a68605318d

See more details on using hashes here.

Provenance

File details

Details for the file shrub_py-3.4.0-py3-none-any.whl.

File metadata

  • Download URL: shrub_py-3.4.0-py3-none-any.whl
  • Upload date:
  • Size: 40.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.9.2 Linux/5.15.0-1021-aws

File hashes

Hashes for shrub_py-3.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3b04498bf37b58d42052db11ffd0b5c8ff324a277b826a2f6591282fe227ac99
MD5 8538de448e260b39ee91770a546f986c
BLAKE2b-256 17fa4d1141a958854f8a7d3fe27703141cfa2100ba0515872d95d11f9245e30f

See more details on using hashes here.

Provenance

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