How to use the chaostoolkit.__version__ function in chaostoolkit

To help you get started, we’ve selected a few chaostoolkit examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github chaostoolkit / chaostoolkit / tests / test_check.py View on Github external
def test_version_is_not_newer(requests):
    requests.get.return_value = FakeResponse(
        200,
        "https://releases.chaostoolkit.org/latest",
        {"version": __version__, "up_to_date": True}
    )

    latest_version = check_newer_version(command="init")
    assert latest_version is None
github chaostoolkit / chaostoolkit / chaostoolkit / cli.py View on Github external
@click.version_option(version=__version__)
@click.option('--verbose', is_flag=True, help='Display debug level traces.')
@click.option('--no-version-check', is_flag=True,
              help='Do not search for an updated version of the chaostoolkit.')
@click.option('--change-dir',
              help='Change directory before running experiment.')
@click.option('--no-log-file', is_flag=True,
              help='Disable logging to file entirely.')
@click.option('--log-file', default="chaostoolkit.log", show_default=True,
              help="File path where to write the command's log.")
@click.option('--log-format', default="string", show_default=False,
              help="Console logging format: string, json.",
              type=click.Choice(['string', 'json']))
@click.option('--settings', default=CHAOSTOOLKIT_CONFIG_PATH,
              show_default=True, help="Path to the settings file.")
@click.pass_context
def cli(ctx: click.Context, verbose: bool = False,
github chaostoolkit / chaostoolkit / chaostoolkit / check.py View on Github external
def check_newer_version(command: str):
    """
    Query for the latest release of the chaostoolkit to compare it
    with the current's version. If the former is higher then issue a warning
    inviting the user to upgrade its environment.
    """
    try:
        command = command.strip()
        r = requests.get(LATEST_RELEASE_URL, timeout=(2, 30),
                         params={"current": __version__, "command": command})
        if r.status_code == 200:
            payload = r.json()
            latest_version = payload["version"]
            if payload.get("up_to_date") is False:
                options = '--pre -U' if 'rc' in latest_version else '-U'
                logger.warning(
                    "\nThere is a new version ({v}) of the chaostoolkit "
                    "available.\n"
                    "You may upgrade by typing:\n\n"
                    "$ pip install {opt} chaostoolkit\n\n"
                    "Please review changes at {u}\n".format(
                        u=CHANGELOG_URL, v=latest_version, opt=options))
                return latest_version
    except Exception:
        pass
github chaostoolkit / chaostoolkit / chaostoolkit / cli.py View on Github external
* core: display the information about your version of the Chaos Toolkit

    * extensions: display the list of installed extensions and plugins

    * settings: display your current full settings
    """
    if target not in ["core", "settings", "extensions"]:
        raise click.BadArgumentUsage("Invalid target")

    if target == "core":
        fmt = "{:<20}{:<10}"
        click.secho(
            fmt.format("NAME", "VERSION"),
            fg='bright_blue')
        click.echo(fmt.format("CLI", __version__))
        click.echo(fmt.format("Core library", chaoslib_version))
    elif target == "extensions":
        fmt = "{:<40}{:<10}{:30}{:50}"
        click.secho(
            fmt.format("NAME", "VERSION", "LICENSE", "DESCRIPTION"),
            fg='bright_blue')
        extensions = list_extensions()
        for extension in extensions:
            summary = extension.summary.replace(
                "Chaos Toolkit Extension for ", "")[:50]
            click.echo(
                fmt.format(
                    extension.name, extension.version, extension.license,
                    summary))
    elif target == "settings":
        settings_path = ctx.obj["settings_path"]