Пример #1
0
    __file__).resolve().parent.parent.parent.parent.parent

NAME = "Breeze2"
VERSION = "0.0.1"

click_completion.init()


@click.group()
def main():
    find_airflow_sources_root()


option_verbose = click.option(
    "-v",
    "--verbose",
    is_flag=True,
    help="Print verbose information about performed steps",
)

option_python_version = click.option(
    '-p',
    '--python',
    type=click.Choice(ALLOWED_PYTHON_MAJOR_MINOR_VERSIONS),
    help='Choose your python version',
)

option_backend = click.option(
    '-b',
    '--backend',
    type=click.Choice(ALLOWED_BACKENDS),
    help='Choose your backend database',
CHANGELOG_CHANGES_FILE = "changelog-changes.txt"
DOC_ONLY_CHANGES_FILE = "doc-only-changes.txt"
EXCLUDED_CHANGES_FILE = "excluded-changes.txt"


@click.group(context_settings={
    'help_option_names': ['-h', '--help'],
    'max_content_width': 500
})
def cli():
    ...


option_verbose = click.option(
    "--verbose",
    is_flag=True,
    help="Print verbose information about performed steps",
)

option_assume_yes = click.option(
    "--assume-yes",
    is_flag=True,
    help="Assume yes answer to question",
)

option_previous_release = click.option(
    "--previous-release",
    type=str,
    required=True,
    help="commit reference (for example hash or tag) of the previous release.",
)
Пример #3
0
# KIND, either express or implied.  See the License for the
# specific language governing permissions and limitations
# under the License.
import os

import rich_click as click

from airflow import settings
from airflow.utils.cli import ColorMode
from airflow.utils.timezone import parse as parsedate

BUILD_DOCS = "BUILDING_AIRFLOW_DOCS" in os.environ

click_color = click.option(
    '--color',
    type=click.Choice([ColorMode.ON, ColorMode.OFF, ColorMode.AUTO]),
    default=ColorMode.AUTO,
    help="Do emit colored output (default: auto)",
)
click_conf = click.option(
    '-c',
    '--conf',
    help="JSON string that gets pickled into the DagRun's conf attribute")
click_daemon = click.option(
    "-D",
    "--daemon",
    'daemon_',
    is_flag=True,
    help="Daemonize instead of running in the foreground")
click_dag_id = click.argument("dag_id", help="The id of the dag")
click_dag_id_opt = click.option("-d", "--dag-id", help="The id of the dag")
click_debug = click.option(
Пример #4
0
MY_DIR_PATH = Path(os.path.dirname(__file__))
SOURCE_DIR_PATH = MY_DIR_PATH / os.pardir / os.pardir


@click.group(context_settings={
    'help_option_names': ['-h', '--help'],
    'max_content_width': 500
})
def cli():
    ...


option_table = click.option(
    "--table",
    is_flag=True,
    help="Print output as markdown table1",
)

option_github_token = click.option(
    "--github-token",
    type=str,
    required=True,
    help=textwrap.dedent("""
        Github token used to authenticate.
        You can set omit it if you have GITHUB_TOKEN env variable set
        Can be generated with:
        https://github.com/settings/tokens/new?description=Read%20Write%20isssues&scopes=repo"""
                         ),
    envvar='GITHUB_TOKEN',
)
Пример #5
0
    AIRFLOW_SOURCES_ROOT,
    BUILD_CACHE_DIR,
    create_directories,
    find_airflow_sources_root,
)
from airflow_breeze.utils.run_utils import check_pre_commit_installed, run_command
from airflow_breeze.utils.visuals import ASCIIART, ASCIIART_STYLE

NAME = "Breeze2"
VERSION = "0.0.1"

find_airflow_sources_root()

option_verbose = click.option(
    "-v",
    "--verbose",
    is_flag=True,
    help="Print verbose information about performed steps.",
    envvar='VERBOSE')

option_dry_run = click.option(
    "-D",
    "--dry-run",
    is_flag=True,
    help="If dry-run is set, commands are only printed, not executed.",
    envvar='DRY_RUN',
)

option_python = click.option(
    '-p',
    '--python',
    type=click.Choice(ALLOWED_PYTHON_MAJOR_MINOR_VERSIONS),
Пример #6
0
    template = jinja2.Environment(
        loader=BaseLoader(),
        undefined=jinja2.StrictUndefined,
        autoescape=autoescape,
        keep_trailing_newline=keep_trailing_newline,
    ).from_string(template_string)
    content: str = template.render(context)
    return content


option_github_token = click.option(
    "--github-token",
    type=str,
    required=True,
    help=textwrap.dedent("""
        Github token used to authenticate.
        You can omit it if you have GITHUB_TOKEN env variable set
        Can be generated with:
        https://github.com/settings/tokens/new?description=Write%20issues&scopes=repo:status,public_repo"""
                         ),
    envvar='GITHUB_TOKEN',
)

option_verbose = click.option(
    "--verbose",
    is_flag=True,
    help="Print verbose information about performed steps",
)

option_dry_run = click.option(
    "--dry-run",
    is_flag=True,
Пример #7
0
SOURCE_DIR_PATH = os.path.abspath(os.path.join(MY_DIR_PATH, os.pardir))
PR_PATTERN = re.compile(r".*\(#([0-9]+)\)")
ISSUE_MATCH_IN_BODY = re.compile(r" #([0-9]+)[^0-9]")


@click.group(context_settings={
    'help_option_names': ['-h', '--help'],
    'max_content_width': 500
})
def cli():
    ...


option_verbose = click.option(
    "--verbose",
    is_flag=True,
    help="Print verbose information about performed steps",
)

option_previous_release = click.option(
    "--previous-release",
    type=str,
    required=True,
    help="commit reference (for example hash or tag) of the previous release.",
)

option_current_release = click.option(
    "--current-release",
    type=str,
    required=True,
    help="commit reference (for example hash or tag) of the current release.",
Пример #8
0
    __file__).resolve().parent.parent.parent.parent.parent

NAME = "Breeze2"
VERSION = "0.0.1"

click_completion.init()


@click.group()
def main():
    find_airflow_sources_root()


option_verbose = click.option(
    "--verbose",
    is_flag=True,
    help="Print verbose information about performed steps",
)


@main.command()
def version():
    """Prints version of breeze.py."""
    console.print(ASCIIART, style=ASCIIART_STYLE)
    console.print(f"\n[green]{NAME} version: {VERSION}[/]\n")


@option_verbose
@main.command()
def shell(verbose: bool):
    """Enters breeze.py environment. this is the default command use when no other is selected."""
Пример #9
0
# specific language governing permissions and limitations
# under the License.
"""freespace.py for clean environment before start CI"""

import shlex
import subprocess
from typing import List

import rich_click as click
from rich.console import Console

console = Console(force_terminal=True, color_system="standard", width=180)

option_verbose = click.option(
    "--verbose",
    envvar='VERBOSE',
    is_flag=True,
    help="Print verbose information about free space steps",
)

option_dry_run = click.option(
    "--dry-run",
    is_flag=True,
    help="Just prints commands without executing them",
)


@click.command()
@option_verbose
@option_dry_run
def main(verbose, dry_run):
    run_command(["sudo", "swapoff", "-a"], verbose, dry_run)
Пример #10
0
    __file__).resolve().parent.parent.parent.parent.parent

NAME = "Breeze2"
VERSION = "0.0.1"

click_completion.init()


@click.group()
def main():
    find_airflow_sources_root()


option_verbose = click.option(
    "-v",
    "--verbose",
    is_flag=True,
    help="Print verbose information about performed steps",
    envvar='VERBOSE')

option_python_version = click.option(
    '-p',
    '--python',
    type=click.Choice(ALLOWED_PYTHON_MAJOR_MINOR_VERSIONS),
    help='Choose your python version',
    envvar='PYTHON_MAJOR_MINOR_VERSION',
)

option_backend = click.option(
    '-b',
    '--backend',
    type=click.Choice(ALLOWED_BACKENDS),
Пример #11
0
def setup(app):
    """Setup plugin"""
    app.add_directive('operators-hooks-ref', OperatorsHooksReferenceDirective)
    app.add_directive('transfers-ref', TransfersReferenceDirective)
    app.add_directive('airflow-logging', LoggingDirective)
    app.add_directive('airflow-auth-backends', AuthBackendDirective)
    app.add_directive('airflow-secrets-backends', SecretsBackendDirective)
    app.add_directive('airflow-connections', ConnectionsDirective)
    app.add_directive('airflow-extra-links', ExtraLinksDirective)

    return {'parallel_read_safe': True, 'parallel_write_safe': True}


option_tag = click.option(
    '--tag',
    multiple=True,
    help="If passed, displays integrations that have a matching tag",
)

option_header_separator = click.option('--header-separator',
                                       default=DEFAULT_HEADER_SEPARATOR,
                                       show_default=True)


@click.group(context_settings={
    'help_option_names': ['-h', '--help'],
    'max_content_width': 500
})
def cli():
    """Render tables with integrations"""