Skip to content

Commit

Permalink
Establishing short hand argument for apache-airflow-providers rule (a…
Browse files Browse the repository at this point in the history
…pache#34230)

* Establishing short hand argument for apache-airflow-providers rule

* updating docs

* review comments
  • Loading branch information
amoghrajesh authored Sep 9, 2023
1 parent b5057e0 commit 927e8b7
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 5 deletions.
2 changes: 2 additions & 0 deletions BREEZE.rst
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,8 @@ Now with the remaining part, replace every ``dash("-")`` with a ``dot(".")``.
Example:
If the provider name is ``apache-airflow-providers-cncf-kubernetes``, it will be ``cncf.kubernetes``.

Note: For building docs for apache-airflow-providers index, use ``providers-index`` as the short hand operator.

Running static checks
---------------------

Expand Down
4 changes: 2 additions & 2 deletions dev/breeze/src/airflow_breeze/commands/developer_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
from airflow_breeze.utils.cache import read_from_cache_file
from airflow_breeze.utils.coertions import one_or_none_set
from airflow_breeze.utils.common_options import (
argument_packages_plus_all_providers,
argument_packages_plus_all_providers_for_shorthand,
option_airflow_constraints_reference,
option_airflow_extras,
option_answer,
Expand Down Expand Up @@ -357,7 +357,7 @@ def start_airflow(
@main.command(name="build-docs")
@click.option("-d", "--docs-only", help="Only build documentation.", is_flag=True)
@click.option("-s", "--spellcheck-only", help="Only run spell checking.", is_flag=True)
@argument_packages_plus_all_providers
@argument_packages_plus_all_providers_for_shorthand
@option_builder
@click.option(
"--package-filter",
Expand Down
5 changes: 4 additions & 1 deletion dev/breeze/src/airflow_breeze/params/doc_build_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,11 @@
def get_provider_name_from_short_hand(short_form_providers: tuple[str]):
providers = []
for short_form_provider in short_form_providers:
short_form_provider.split(".")
if short_form_provider == "providers-index":
providers.append("apache-airflow-providers")
continue

short_form_provider.split(".")
parts = "-".join(short_form_provider.split("."))
providers.append(providers_prefix + parts)
return tuple(providers)
Expand Down
10 changes: 10 additions & 0 deletions dev/breeze/src/airflow_breeze/utils/common_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,16 @@ def _set_default_from_parent(ctx: click.core.Context, option: click.core.Option,
required=False,
type=BetterChoice(["all-providers"] + get_available_documentation_packages(short_version=True)),
)

argument_packages_plus_all_providers_for_shorthand = click.argument(
"packages_plus_all_providers",
nargs=-1,
required=False,
type=BetterChoice(
["all-providers"] + get_available_documentation_packages(short_version=True) + ["providers-index"]
),
)

option_airflow_constraints_reference = click.option(
"--airflow-constraints-reference",
help="Constraint reference to use. Useful with --use-airflow-version parameter to specify "
Expand Down
2 changes: 2 additions & 0 deletions docs/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ Now with the remaining part, replace every ``dash("-")`` with a ``dot(".")``.
Example:
If the provider name is ``apache-airflow-providers-cncf-kubernetes``, it will be ``cncf.kubernetes``.

Note: For building docs for apache-airflow-providers index, use ``providers-index`` as the short hand operator.

Cross-referencing syntax
========================

Expand Down
2 changes: 1 addition & 1 deletion images/breeze/output-commands-hash.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Please do not solve it but run `breeze setup regenerate-command-images`.
# This command should fix the conflict and regenerate help images that you have conflict with.
main:42493af4045e28dcf52040810fbb7036
build-docs:68f124750a9b83d45e10dec7219b6014
build-docs:c5da2956cfff3989a9699c32aee63a13
ci:find-backtracking-candidates:17fe56b867a745e5032a08dfcd3f73ee
ci:fix-ownership:3e5a73533cc96045e72cb258783cfc96
ci:free-space:49af17b032039c05c41a7a8283f365cc
Expand Down
2 changes: 1 addition & 1 deletion images/breeze/output_build-docs.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 927e8b7

Please sign in to comment.