chaostoolkit / chaostoolkit-lib

The Chaos Toolkit core library
https://chaostoolkit.org/
Apache License 2.0
77 stars 46 forks source link
chaos-engineering chaostoolkit chaostoolkit-core reliability-engineering


Chaos Toolkit - Chaos Engineering for Everyone

Release Build GitHub issues License Python version

CommunityChangeLog


Purpose

The purpose of this library is to provide the core of the Chaos Toolkit model and functions it needs to render its services.

Features

The library provides the followings features:

Install

If you are user of the Chaos Toolkit, you probably do not need to install this package yourself as it comes along with the chaostoolkit cli.

However, should you wish to integrate this library in your own Python code, please install it as usual:

$ pip install -U chaostoolkit-lib

Specific dependencies

In addition to essential dependencies, the package can install a couple of other extra dependencies for specific use-cases. They are not mandatory and the library will warn you if you try to use a feature that requires them.

Vault

If you need Vault support to read secrets from, run the following command:

$ pip install -U chaostoolkit-lib[vault]

To authenticate with Vault, you can either:

JSON Path

If you need JSON Path support for tolerance probes in the hypothesis, also run the following command:

$ pip install -U chaostoolkit-lib[jsonpath]

Contribute

Contributors to this project are welcome as this is an open-source effort that seeks discussions and continuous improvement.

From a code perspective, if you wish to contribute, you will need to run a Python 3.6+ environment. Please, fork this project, write unit tests to cover the proposed changes, implement the changes, ensure they meet the formatting standards set out by black, flake8, and isort, add an entry into CHANGELOG.md, and then raise a PR to the repository for review.

Please refer to the formatting section for more information on the formatting standards.

The Chaos Toolkit projects require all contributors must sign a Developer Certificate of Origin on each commit they would like to merge into the master branch of the repository. Please, make sure you can abide by the rules of the DCO before submitting a PR.

Develop

If you wish to develop on this project, make sure to install the development dependencies. To do so, first install pdm.

$ pdm install --dev

Now, you can edit the files and they will be automatically be seen by your environment, even when running from the chaos command locally.

Test

To run the tests for the project execute the following:

$ pdm run test

Formatting and Linting

We use ruff() to perform linting and code style.

Before raising a Pull Request, we recommend you run formatting against your code with:

$ pdm run format

This will automatically format any code that doesn't adhere to the formatting standards.

As some things are not picked up by the formatting, we also recommend you run:

$ pdm run lint

To ensure that any unused import statements/strings that are too long, etc. are also picked up.