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

Establishing short hand argument for apache-airflow-providers rule #34230

Merged
merged 3 commits into from
Sep 9, 2023
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
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
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.