Bowrna commented on code in PR #22713:
URL: https://github.com/apache/airflow/pull/22713#discussion_r841357528
##########
dev/breeze/src/airflow_breeze/breeze.py:
##########
@@ -19,77 +19,414 @@
import shutil
import subprocess
import sys
+from dataclasses import dataclass
from pathlib import Path
-from typing import Optional, Tuple
+from typing import List, Optional, Tuple
+
+from airflow_breeze.shell.shell_params import ShellParams
try:
+ # We handle ImportError so that click autocomplete works
import rich_click as click
+
+ click.rich_click.SHOW_METAVARS_COLUMN = False
+ click.rich_click.APPEND_METAVARS_HELP = True
+ click.rich_click.STYLE_ERRORS_SUGGESTION = "bright_blue italic"
+ click.rich_click.ERRORS_SUGGESTION = "\nTry running the '--help' flag for
more information.\n"
+ click.rich_click.ERRORS_EPILOGUE = (
+ "\nTo find out more, visit
[bright_blue]https://github.com/apache/airflow/blob/main/BREEZE.rst[/]\n"
+ )
+ click.rich_click.OPTION_GROUPS = {
+ "Breeze2": [
+ {
+ "name": "Basic flags for the default (shell) command",
+ "options": [
+ "--python",
+ "--backend",
+ "--use-airflow-version",
+ "--postgres-version",
+ "--mysql-version",
+ "--mssql-version",
+ "--forward-credentials",
+ "--db-reset",
+ ],
+ },
+ {
+ "name": "Advanced flags for the default (shell) command",
+ "options": [
+ "--force-build",
+ "--mount-sources",
+ "--integration",
+ ],
+ },
+ ],
+ "Breeze2 shell": [
+ {
+ "name": "Basic flags",
+ "options": [
+ "--python",
+ "--backend",
+ "--use-airflow-version",
+ "--postgres-version",
+ "--mysql-version",
+ "--mssql-version",
+ "--forward-credentials",
+ "--db-reset",
+ ],
+ },
+ {
+ "name": "Advanced flag for running",
+ "options": [
+ "--force-build",
+ "--mount-sources",
+ "--integration",
+ ],
+ },
+ ],
+ "Breeze2 start-airflow": [
+ {
+ "name": "Basic flags",
+ "options": [
+ "--python",
+ "--backend",
+ "--use-airflow-version",
+ "--postgres-version",
+ "--mysql-version",
+ "--mssql-version",
+ "--load-example-dags",
+ "--load-default-connections",
+ "--forward-credentials",
+ "--db-reset",
+ ],
+ },
+ {
+ "name": "Advanced flag for running",
+ "options": [
+ "--force-build",
+ "--mount-sources",
+ "--integration",
+ ],
+ },
+ ],
+ "Breeze2 build-image": [
+ {
+ "name": "Basic usage",
+ "options": [
+ "--python",
+ "--upgrade-to-newer-dependencies",
+ "--debian-version",
+ "--image-tag",
+ "--docker-cache",
+ "--github-repository",
+ ],
+ },
+ {
+ "name": "Advanced options (for power users)",
+ "options": [
+ "--install-providers-from-sources",
+ "--additional-extras",
+ "--additional-dev-apt-deps",
+ "--additional-runtime-apt-deps",
+ "--additional-python-deps",
+ "--additional-dev-apt-command",
+ "--runtime-apt-command",
+ "--additional-dev-apt-env",
+ "--additional-runtime-apt-env",
+ "--additional-runtime-apt-command",
+ "--dev-apt-command",
+ "--dev-apt-deps",
+ "--runtime-apt-deps",
+ ],
+ },
+ {
+ "name": "Preparing cache (for maintainers)",
+ "options": [
+ "--platform",
+ "--prepare-buildx-cache",
+ ],
+ },
+ ],
+ "Breeze2 build-prod-image": [
+ {
+ "name": "Basic usage",
+ "options": [
+ "--python",
+ "--install-airflow-version",
+ "--upgrade-to-newer-dependencies",
+ "--debian-version",
+ "--image-tag",
+ "--docker-cache",
+ "--github-repository",
+ ],
+ },
+ {
+ "name": "Options for customizing images",
+ "options": [
+ "--install-providers-from-sources",
+ "--extras",
+ "--additional-extras",
+ "--additional-dev-apt-deps",
+ "--additional-runtime-apt-deps",
+ "--additional-python-deps",
+ "--additional-dev-apt-command",
+ "--runtime-apt-command",
+ "--additional-dev-apt-env",
+ "--additional-runtime-apt-env",
+ "--additional-runtime-apt-command",
+ "--dev-apt-command",
+ "--dev-apt-deps",
+ "--runtime-apt-deps",
+ ],
+ },
+ {
+ "name": "Customization options (for specific customization
needs)",
+ "options": [
+ "--install-from-docker-context-files",
+ "--cleanup-docker-context-files",
+ "--disable-mysql-client-installation",
+ "--disable-mssql-client-installation",
+ "--disable-postgres-client-installation",
+ "--disable-airflow-repo-cache",
+ "--disable-pypi",
+ "--install-airflow-reference",
+ "--installation-method",
+ ],
+ },
+ {
+ "name": "Preparing cache (for maintainers)",
+ "options": [
+ "--platform",
+ "--prepare-buildx-cache",
+ ],
+ },
+ ],
+ "Breeze2 static-check": [
+ {
+ "name": "Pre-commit flags",
+ "options": [
+ "--type",
+ "--files",
+ "--all-files",
+ "--show-diff-on-failure",
+ "--last-commit",
+ ],
+ },
+ ],
+ "Breeze2 build-docs": [
+ {
+ "name": "Doc flags",
+ "options": [
+ "--docs-only",
+ "--spellcheck-only",
+ "--package-filter",
+ ],
+ },
+ ],
+ "Breeze2 stop": [
+ {
+ "name": "Stop flags",
+ "options": [
+ "--preserve-volumes",
+ ],
+ },
+ ],
+ "Breeze2 setup-autocomplete": [
+ {
+ "name": "Setup autocomplete flags",
+ "options": [
+ "--force-setup",
+ ],
+ },
+ ],
+ "Breeze2 config": [
+ {
+ "name": "Config flags",
+ "options": [
+ "--python",
+ "--backend",
+ "--cheatsheet",
+ "--asciiart",
+ ],
+ },
+ ],
+ }
+
+ click.rich_click.COMMAND_GROUPS = {
+ "Breeze2": [
+ {
+ "name": "Developer tools",
+ "commands": [
+ "shell",
+ "start-airflow",
+ "stop",
+ "build-image",
+ "build-prod-image",
+ "build-docs",
+ "static-check",
+ ],
+ },
+ {
+ "name": "Configuration & maintenance",
+ "commands": ["cleanup", "setup-autocomplete", "config",
"version"],
+ },
+ ]
+ }
+
Review Comment:
Woah this is really cool :)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]