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.1.5.tar.gz (32.4 kB view details)

Uploaded Source

Built Distribution

shrub_py-3.1.5-py3-none-any.whl (38.8 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for shrub_py-3.1.5.tar.gz
Algorithm Hash digest
SHA256 f60241c65baee4f1f66c91c34bc5f755ec4aa7fe75956ad6d7de94b6b42596e6
MD5 9502922b860c21b25f3b5db77237ed9d
BLAKE2b-256 581f7ee59487d5c2042fb59f17c0a49cb871fd7219169ed707cbd2e24d09c78e

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for shrub_py-3.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 91e3addc93c1b54ee191148f85ec6eb6354e1d4ef27d663868e97b00186f48ae
MD5 6dd80fada1810c8b917af6f921231f64
BLAKE2b-256 ce567c3d86b78bfbc22bf547a9eee354ec7e5d327060597a3ab8c9c3230947fe

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