Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add command to regenerate breeze command output images #24216

Merged
merged 1 commit into from
Jun 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -225,3 +225,7 @@ licenses/LICENSES-ui.txt

# Packaged breeze on Windows
/breeze.exe

# Generated out dir

/out
11 changes: 11 additions & 0 deletions BREEZE.rst
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,17 @@ of help of the commands only when they change.
:width: 100%
:alt: Breeze command-hash-export

Regenerating images for documentation
=====================================

This documentation contains exported images with "help" of their commands and parameters. You can
regenerate all those images (which might be needed in case new version of rich is used) via
``regenerate-breeze-images`` command.

.. image:: ./images/breeze/output-regenerate-command-images.svg
:width: 100%
:alt: Breeze regenerate-command-images


Starting complete Airflow installation
======================================
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
)
from airflow_breeze.utils.recording import output_file_for_recording
from airflow_breeze.utils.reinstall import ask_to_reinstall_breeze, reinstall_breeze, warn_non_editable
from airflow_breeze.utils.run_utils import run_command
from airflow_breeze.utils.run_utils import assert_pre_commit_installed, run_command
from airflow_breeze.utils.visuals import ASCIIART, ASCIIART_STYLE

CONFIGURATION_AND_MAINTENANCE_COMMANDS = {
Expand All @@ -75,6 +75,7 @@
"resource-check",
"free-space",
"fix-ownership",
"regenerate-command-images",
"command-hash-export",
"version",
],
Expand Down Expand Up @@ -533,3 +534,27 @@ def remove_autogenerated_code(script_path: str):

def backup(script_path_file: Path):
shutil.copy(str(script_path_file), str(script_path_file) + ".bak")


@main.command(name="regenerate-command-images", help="Regenerate breeze command images.")
@option_verbose
@option_dry_run
def regenerate_command_images(verbose: bool, dry_run: bool):
assert_pre_commit_installed(verbose=verbose)
perform_environment_checks(verbose=verbose)
try:
(AIRFLOW_SOURCES_ROOT / "images" / "breeze" / "output-commands-hash.txt").unlink()
except FileNotFoundError:
# when we go to Python 3.8+ we can add missing_ok = True instead of try/except
pass
command_to_execute = [sys.executable, "-m", "pre_commit", 'run', 'update-breeze-file', '--all-files']
potiuk marked this conversation as resolved.
Show resolved Hide resolved
env = os.environ.copy()
run_command(
command_to_execute,
verbose=verbose,
dry_run=dry_run,
check=False,
no_output_dump_on_exception=True,
text=True,
env=env,
)
2 changes: 1 addition & 1 deletion images/breeze/output-commands-hash.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5f6d42eb170dba8f19b375f8e7c588b3
4741c257cb7cb98fd268d443cfa12135
Loading