示例#1
0
def setup_sentry(treebeard_env: TreebeardEnv):
    sentry_sdk.init(  # type: ignore
        "https://[email protected]/2846147",
        environment=env)

    with configure_scope() as scope:  # type: ignore
        scope.set_tag("treebeard_version", get_version())  # type: ignore
        scope.set_tag("user_name",
                      str(treebeard_env.user_name))  # type: ignore
        scope.set_tag("treebeard_repo_short_name",
                      str(treebeard_env.repo_short_name))  # type: ignore
示例#2
0
def setup_sentry():
    sentry_sdk.init(  # type: ignore
        "https://[email protected]/2846147",
        environment=env)

    with configure_scope() as scope:  # type: ignore
        scope.set_tag("treebeard_version", get_version())  # type: ignore
        scope.set_tag("treebeard_project_id",
                      str(treebeard_env.project_id))  # type: ignore
        scope.set_tag("treebeard_notebook_id",
                      str(treebeard_env.notebook_id))  # type: ignore
示例#3
0
def check_for_updates():
    version = get_version()

    pypi_data = requests.get("https://pypi.org/pypi/treebeard/json")
    latest_version = json.loads(pypi_data.text)["info"]["version"]

    if latest_version != version:
        click.echo(
            click.style(
                "🌲 Warning: you are not on the latest version of Treebeard, update with `pip install --upgrade treebeard`",
                fg="yellow",
            ),
            err=True,
        )
示例#4
0
def version():
    """Shows treebeard package version"""
    click.echo(get_version())
示例#5
0
import configparser
import json
import os
from pathlib import Path
from typing import Optional

import click
import requests
from pydantic import BaseModel

from treebeard.conf import config_path
from treebeard.version import get_version

version = get_version()


def set_credentials(email: str, key: str, project_id: str):
    """Create user credentials"""
    config = configparser.RawConfigParser()
    config.add_section("credentials")
    config.set("credentials", "TREEBEARD_EMAIL", email)
    config.set("credentials", "TREEBEARD_PROJECT_ID", project_id)
    config.set("credentials", "TREEBEARD_API_KEY", key)
    with open(config_path, "w") as configfile:
        config.write(configfile)
    click.echo(f"🔑  Config saved in {config_path}")
    return project_id


def check_for_updates():
    pypi_data = requests.get(