potiuk commented on code in PR #24216:
URL: https://github.com/apache/airflow/pull/24216#discussion_r890970796
##########
dev/breeze/src/airflow_breeze/commands/configuration_and_maintenance_commands.py:
##########
@@ -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")
+
+
[email protected](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']
Review Comment:
It does not have to. Breeze is always installed with `pipx` (it's a
prerequisite) and `pre-commit` is installed there as dependency.
https://github.com/apache/airflow/blob/4482eaefb02535317bc0d2378eba6bfcef3c45ff/dev/breeze/setup.cfg#L60
So by running `sys.executable -m pre_commit` we are sure it is installed.
This is one of the positive "side-effects` of requring breeze to be
installed with `pipx` (As documented in
https://github.com/apache/airflow/blob/main/dev/breeze/doc/adr/0010-use-pipx-to-install-breeze.md
Following `python zen` - there is only one way to install breeeze - `pipx -e
./dev/breeze` (and we even have protection in case it is not done this way).
--
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]