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

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

shrub_py-3.10.0-py3-none-any.whl (40.3 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for shrub_py-3.10.0.tar.gz
Algorithm Hash digest
SHA256 035cb81fabbd72f47792ab4304ce33af262005842fa5886c1e57b7a2a9d53cfa
MD5 4e3723da7ea1236efcbdc0f0c61e2ebf
BLAKE2b-256 76096b6528a84471d432c37ecfb48fd3987cf9b02bba6bca5ef8a406b66822c5

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for shrub_py-3.10.0-py3-none-any.whl
Algorithm Hash digest
SHA256 239ad492819c84f14f4349d3679f5a6218468441861f310a2320ec9683862805
MD5 c4e8ca2c406cc89f7371c14f5fc3e289
BLAKE2b-256 1f080f1d5a935de84c74239b8337c6e215fa8e75c3eb9733c68e9bef88ae9052

See more details on using hashes here.

Supported by

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