apache-airflow-ctl 1.0.0b1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. apache_airflow_ctl-1.0.0b1/.gitignore +1 -0
  2. apache_airflow_ctl-1.0.0b1/PKG-INFO +90 -0
  3. apache_airflow_ctl-1.0.0b1/README.md +69 -0
  4. apache_airflow_ctl-1.0.0b1/RELEASE_NOTES.rst +27 -0
  5. apache_airflow_ctl-1.0.0b1/docs/changelog.rst +31 -0
  6. apache_airflow_ctl-1.0.0b1/docs/cli-and-env-variables-ref.rst +55 -0
  7. apache_airflow_ctl-1.0.0b1/docs/conf.py +297 -0
  8. apache_airflow_ctl-1.0.0b1/docs/howto/index.rst +180 -0
  9. apache_airflow_ctl-1.0.0b1/docs/images/command_hashes.txt +14 -0
  10. apache_airflow_ctl-1.0.0b1/docs/images/output_assets.svg +165 -0
  11. apache_airflow_ctl-1.0.0b1/docs/images/output_auth.svg +105 -0
  12. apache_airflow_ctl-1.0.0b1/docs/images/output_auth_login.svg +122 -0
  13. apache_airflow_ctl-1.0.0b1/docs/images/output_backfills.svg +125 -0
  14. apache_airflow_ctl-1.0.0b1/docs/images/output_config.svg +109 -0
  15. apache_airflow_ctl-1.0.0b1/docs/images/output_connections.svg +142 -0
  16. apache_airflow_ctl-1.0.0b1/docs/images/output_dag.svg +145 -0
  17. apache_airflow_ctl-1.0.0b1/docs/images/output_dagrun.svg +105 -0
  18. apache_airflow_ctl-1.0.0b1/docs/images/output_jobs.svg +97 -0
  19. apache_airflow_ctl-1.0.0b1/docs/images/output_main.svg +157 -0
  20. apache_airflow_ctl-1.0.0b1/docs/images/output_pools.svg +121 -0
  21. apache_airflow_ctl-1.0.0b1/docs/images/output_providers.svg +97 -0
  22. apache_airflow_ctl-1.0.0b1/docs/images/output_variables.svg +121 -0
  23. apache_airflow_ctl-1.0.0b1/docs/images/output_version.svg +81 -0
  24. apache_airflow_ctl-1.0.0b1/docs/index.rst +39 -0
  25. apache_airflow_ctl-1.0.0b1/docs/installation/index.rst +132 -0
  26. apache_airflow_ctl-1.0.0b1/docs/installation/installing-from-pypi.rst +63 -0
  27. apache_airflow_ctl-1.0.0b1/docs/installation/installing-from-sources.rst +163 -0
  28. apache_airflow_ctl-1.0.0b1/docs/installation/prerequisites.rst +63 -0
  29. apache_airflow_ctl-1.0.0b1/docs/redirects.txt +27 -0
  30. apache_airflow_ctl-1.0.0b1/docs/security.rst +30 -0
  31. apache_airflow_ctl-1.0.0b1/docs/start.rst +52 -0
  32. apache_airflow_ctl-1.0.0b1/docs/static/exampleinclude.css +86 -0
  33. apache_airflow_ctl-1.0.0b1/docs/static/gh-jira-links.js +36 -0
  34. apache_airflow_ctl-1.0.0b1/docs/static/redirects.js +29 -0
  35. apache_airflow_ctl-1.0.0b1/docs/templates/footer.html +29 -0
  36. apache_airflow_ctl-1.0.0b1/newsfragments/config.toml +50 -0
  37. apache_airflow_ctl-1.0.0b1/pyproject.toml +193 -0
  38. apache_airflow_ctl-1.0.0b1/src/airflowctl/__init__.py +22 -0
  39. apache_airflow_ctl-1.0.0b1/src/airflowctl/__main__.py +38 -0
  40. apache_airflow_ctl-1.0.0b1/src/airflowctl/api/__init__.py +16 -0
  41. apache_airflow_ctl-1.0.0b1/src/airflowctl/api/client.py +340 -0
  42. apache_airflow_ctl-1.0.0b1/src/airflowctl/api/datamodels/__init__.py +16 -0
  43. apache_airflow_ctl-1.0.0b1/src/airflowctl/api/datamodels/auth_generated.py +47 -0
  44. apache_airflow_ctl-1.0.0b1/src/airflowctl/api/datamodels/generated.py +1924 -0
  45. apache_airflow_ctl-1.0.0b1/src/airflowctl/api/operations.py +690 -0
  46. apache_airflow_ctl-1.0.0b1/src/airflowctl/ctl/__init__.py +22 -0
  47. apache_airflow_ctl-1.0.0b1/src/airflowctl/ctl/cli_config.py +859 -0
  48. apache_airflow_ctl-1.0.0b1/src/airflowctl/ctl/cli_parser.py +170 -0
  49. apache_airflow_ctl-1.0.0b1/src/airflowctl/ctl/commands/__init__.py +16 -0
  50. apache_airflow_ctl-1.0.0b1/src/airflowctl/ctl/commands/auth_command.py +77 -0
  51. apache_airflow_ctl-1.0.0b1/src/airflowctl/ctl/commands/config_command.py +825 -0
  52. apache_airflow_ctl-1.0.0b1/src/airflowctl/ctl/commands/connection_command.py +74 -0
  53. apache_airflow_ctl-1.0.0b1/src/airflowctl/ctl/commands/pool_command.py +122 -0
  54. apache_airflow_ctl-1.0.0b1/src/airflowctl/ctl/commands/variable_command.py +102 -0
  55. apache_airflow_ctl-1.0.0b1/src/airflowctl/ctl/commands/version_command.py +38 -0
  56. apache_airflow_ctl-1.0.0b1/src/airflowctl/ctl/console_formatting.py +146 -0
  57. apache_airflow_ctl-1.0.0b1/src/airflowctl/ctl/utils/__init__.py +16 -0
  58. apache_airflow_ctl-1.0.0b1/src/airflowctl/ctl/utils/yaml.py +74 -0
  59. apache_airflow_ctl-1.0.0b1/src/airflowctl/exceptions.py +42 -0
  60. apache_airflow_ctl-1.0.0b1/src/airflowctl/utils/__init__.py +16 -0
  61. apache_airflow_ctl-1.0.0b1/src/airflowctl/utils/helpers.py +30 -0
  62. apache_airflow_ctl-1.0.0b1/src/airflowctl/utils/module_loading.py +39 -0
  63. apache_airflow_ctl-1.0.0b1/tests/airflow_ctl/__init__.py +16 -0
  64. apache_airflow_ctl-1.0.0b1/tests/airflow_ctl/api/__init__.py +16 -0
  65. apache_airflow_ctl-1.0.0b1/tests/airflow_ctl/api/test_client.py +165 -0
  66. apache_airflow_ctl-1.0.0b1/tests/airflow_ctl/api/test_operations.py +1233 -0
  67. apache_airflow_ctl-1.0.0b1/tests/airflow_ctl/ctl/__init__.py +16 -0
  68. apache_airflow_ctl-1.0.0b1/tests/airflow_ctl/ctl/commands/__init__.py +16 -0
  69. apache_airflow_ctl-1.0.0b1/tests/airflow_ctl/ctl/commands/test_auth_command.py +108 -0
  70. apache_airflow_ctl-1.0.0b1/tests/airflow_ctl/ctl/commands/test_config_command.py +363 -0
  71. apache_airflow_ctl-1.0.0b1/tests/airflow_ctl/ctl/commands/test_connections_command.py +127 -0
  72. apache_airflow_ctl-1.0.0b1/tests/airflow_ctl/ctl/commands/test_pool_command.py +188 -0
  73. apache_airflow_ctl-1.0.0b1/tests/airflow_ctl/ctl/commands/test_variable_command.py +125 -0
  74. apache_airflow_ctl-1.0.0b1/tests/airflow_ctl/ctl/commands/test_version_command.py +66 -0
  75. apache_airflow_ctl-1.0.0b1/tests/airflow_ctl/ctl/test_cli_config.py +360 -0
  76. apache_airflow_ctl-1.0.0b1/tests/conftest.py +79 -0
@@ -0,0 +1 @@
1
+ ./test_command.py
@@ -0,0 +1,90 @@
1
+ Metadata-Version: 2.4
2
+ Name: apache-airflow-ctl
3
+ Version: 1.0.0b1
4
+ Summary: Apache Airflow command line tool for communicating with an Apache Airflow, using the API.
5
+ Classifier: Framework :: Apache Airflow
6
+ Requires-Python: >=3.10
7
+ Requires-Dist: argcomplete>=1.10
8
+ Requires-Dist: httpx>=0.27.0
9
+ Requires-Dist: keyring>=25.6.0
10
+ Requires-Dist: lazy-object-proxy>=1.2.0
11
+ Requires-Dist: methodtools>=0.4.7
12
+ Requires-Dist: platformdirs>=4.3.6
13
+ Requires-Dist: pydantic>=2.11.0
14
+ Requires-Dist: rich-argparse>=1.0.0
15
+ Requires-Dist: structlog>=25.2.0
16
+ Requires-Dist: tabulate>=0.9.0
17
+ Requires-Dist: uuid6>=2024.7.10
18
+ Provides-Extra: dev
19
+ Requires-Dist: keyrings-alt>=5.0.2; extra == 'dev'
20
+ Description-Content-Type: text/markdown
21
+
22
+ <!--
23
+ Licensed to the Apache Software Foundation (ASF) under one
24
+ or more contributor license agreements. See the NOTICE file
25
+ distributed with this work for additional information
26
+ regarding copyright ownership. The ASF licenses this file
27
+ to you under the Apache License, Version 2.0 (the
28
+ "License"); you may not use this file except in compliance
29
+ with the License. You may obtain a copy of the License at
30
+
31
+ http://www.apache.org/licenses/LICENSE-2.0
32
+
33
+ Unless required by applicable law or agreed to in writing,
34
+ software distributed under the License is distributed on an
35
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
36
+ KIND, either express or implied. See the License for the
37
+ specific language governing permissions and limitations
38
+ under the License.
39
+ -->
40
+
41
+ # airflowctl
42
+
43
+ A command-line tool for interacting with Apache Airflow instances through the Airflow REST API. It offers a convenient interface for performing common operations remotely without direct access to the Airflow scheduler or webserver.
44
+
45
+ ## Features
46
+
47
+ - Communicates with Airflow instances through the REST API
48
+ - Supports authentication using Airflow API tokens
49
+ - Executes commands against remote Airflow deployments
50
+ - Provides intuitive command organization with group-based structure
51
+ - Includes detailed help documentation for all commands
52
+
53
+ ## Requirements
54
+
55
+ - Python 3.10 or later (compatible with Python >= 3.10 and < 3.13)
56
+ - Network access to an Apache Airflow instance with REST API enabled
57
+ - Keyring backend installed in operating system for secure token storage
58
+
59
+ ## Usage
60
+
61
+ Access the tool from your terminal:
62
+
63
+ ### Command Line
64
+
65
+ ```bash
66
+ airflowctl --help
67
+ ```
68
+
69
+ ## Contributing
70
+
71
+ Want to help improve Apache Airflow? Check out our [contributing documentation](https://github.com/apache/airflow/blob/main/contributing-docs/README.rst).
72
+
73
+ ### Additional Contribution Guidelines
74
+
75
+ - Please ensure API is running while doing development testing.
76
+ - There are two ways to have a CLI command,
77
+ - Auto Generated Commands
78
+ - Implemented Commands
79
+
80
+ #### Auto Generated Commands
81
+
82
+ Auto generation of commands directly from operations methods under `airflow-ctl/src/airflowctl/api/operations.py`.
83
+ Whenever operation is mapped with proper datamodel and response model, it will be automatically added to the command.
84
+
85
+ You can check each command with `airflowctl <command> --help` to see the available options.
86
+
87
+ #### Implemented Commands
88
+
89
+ Implemented commands are the ones which are not auto generated and need to be implemented manually.
90
+ You can check the implemented commands under `airflow-ctl/src/airflowctl/clt/commands/`.
@@ -0,0 +1,69 @@
1
+ <!--
2
+ Licensed to the Apache Software Foundation (ASF) under one
3
+ or more contributor license agreements. See the NOTICE file
4
+ distributed with this work for additional information
5
+ regarding copyright ownership. The ASF licenses this file
6
+ to you under the Apache License, Version 2.0 (the
7
+ "License"); you may not use this file except in compliance
8
+ with the License. You may obtain a copy of the License at
9
+
10
+ http://www.apache.org/licenses/LICENSE-2.0
11
+
12
+ Unless required by applicable law or agreed to in writing,
13
+ software distributed under the License is distributed on an
14
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15
+ KIND, either express or implied. See the License for the
16
+ specific language governing permissions and limitations
17
+ under the License.
18
+ -->
19
+
20
+ # airflowctl
21
+
22
+ A command-line tool for interacting with Apache Airflow instances through the Airflow REST API. It offers a convenient interface for performing common operations remotely without direct access to the Airflow scheduler or webserver.
23
+
24
+ ## Features
25
+
26
+ - Communicates with Airflow instances through the REST API
27
+ - Supports authentication using Airflow API tokens
28
+ - Executes commands against remote Airflow deployments
29
+ - Provides intuitive command organization with group-based structure
30
+ - Includes detailed help documentation for all commands
31
+
32
+ ## Requirements
33
+
34
+ - Python 3.10 or later (compatible with Python >= 3.10 and < 3.13)
35
+ - Network access to an Apache Airflow instance with REST API enabled
36
+ - Keyring backend installed in operating system for secure token storage
37
+
38
+ ## Usage
39
+
40
+ Access the tool from your terminal:
41
+
42
+ ### Command Line
43
+
44
+ ```bash
45
+ airflowctl --help
46
+ ```
47
+
48
+ ## Contributing
49
+
50
+ Want to help improve Apache Airflow? Check out our [contributing documentation](https://github.com/apache/airflow/blob/main/contributing-docs/README.rst).
51
+
52
+ ### Additional Contribution Guidelines
53
+
54
+ - Please ensure API is running while doing development testing.
55
+ - There are two ways to have a CLI command,
56
+ - Auto Generated Commands
57
+ - Implemented Commands
58
+
59
+ #### Auto Generated Commands
60
+
61
+ Auto generation of commands directly from operations methods under `airflow-ctl/src/airflowctl/api/operations.py`.
62
+ Whenever operation is mapped with proper datamodel and response model, it will be automatically added to the command.
63
+
64
+ You can check each command with `airflowctl <command> --help` to see the available options.
65
+
66
+ #### Implemented Commands
67
+
68
+ Implemented commands are the ones which are not auto generated and need to be implemented manually.
69
+ You can check the implemented commands under `airflow-ctl/src/airflowctl/clt/commands/`.
@@ -0,0 +1,27 @@
1
+ .. Licensed to the Apache Software Foundation (ASF) under one
2
+ or more contributor license agreements. See the NOTICE file
3
+ distributed with this work for additional information
4
+ regarding copyright ownership. The ASF licenses this file
5
+ to you under the Apache License, Version 2.0 (the
6
+ "License"); you may not use this file except in compliance
7
+ with the License. You may obtain a copy of the License at
8
+
9
+ .. http://www.apache.org/licenses/LICENSE-2.0
10
+
11
+ .. Unless required by applicable law or agreed to in writing,
12
+ software distributed under the License is distributed on an
13
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ KIND, either express or implied. See the License for the
15
+ specific language governing permissions and limitations
16
+ under the License.
17
+
18
+ airflowctl 1.0.0b1 (2025-08-25)
19
+ ------------------------------
20
+
21
+ Beta Release of airflowctl, a command-line tool. There are lots of great features to use from start.
22
+ Please check the documentation for quick start and usage instructions.
23
+
24
+ Please visit quick start guide: :doc:`/start`
25
+
26
+ A new way of using Apache Airflow using CLI. Enhanced security is provided by using the Apache Airflow API to provide similar functionality to the Apache Airflow CLI.
27
+ Integrated with Keyring to enhance password security.
@@ -0,0 +1,31 @@
1
+ .. Licensed to the Apache Software Foundation (ASF) under one
2
+ or more contributor license agreements. See the NOTICE file
3
+ distributed with this work for additional information
4
+ regarding copyright ownership. The ASF licenses this file
5
+ to you under the Apache License, Version 2.0 (the
6
+ "License"); you may not use this file except in compliance
7
+ with the License. You may obtain a copy of the License at
8
+
9
+ .. http://www.apache.org/licenses/LICENSE-2.0
10
+
11
+ .. Unless required by applicable law or agreed to in writing,
12
+ software distributed under the License is distributed on an
13
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ KIND, either express or implied. See the License for the
15
+ specific language governing permissions and limitations
16
+ under the License.
17
+
18
+
19
+ .. NOTE TO CONTRIBUTORS:
20
+ Please, only add notes to the Changelog just below the "Changelog" header when there are some breaking changes
21
+ and you want to add an explanation to the users on how they are supposed to deal with them.
22
+ The changelog is updated and maintained semi-automatically by release manager.
23
+
24
+ ``apache-airflow-ctl``
25
+
26
+ Changelog
27
+ ---------
28
+
29
+ 1.0.0
30
+ .....
31
+ Initial version of the airflowctl.
@@ -0,0 +1,55 @@
1
+ .. Licensed to the Apache Software Foundation (ASF) under one
2
+ or more contributor license agreements. See the NOTICE file
3
+ distributed with this work for additional information
4
+ regarding copyright ownership. The ASF licenses this file
5
+ to you under the Apache License, Version 2.0 (the
6
+ "License"); you may not use this file except in compliance
7
+ with the License. You may obtain a copy of the License at
8
+
9
+ .. http://www.apache.org/licenses/LICENSE-2.0
10
+
11
+ .. Unless required by applicable law or agreed to in writing,
12
+ software distributed under the License is distributed on an
13
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ KIND, either express or implied. See the License for the
15
+ specific language governing permissions and limitations
16
+ under the License.
17
+
18
+ Command Line Interface and Environment Variables Reference
19
+ ==========================================================
20
+
21
+ CLI
22
+ '''
23
+
24
+ airflowctl has a very rich command line interface that allows for
25
+ many types of operation on a DAG, starting services, and supporting
26
+ development and testing.
27
+
28
+ .. note::
29
+ For more information on usage CLI, see :doc:`cli-and-env-variables-ref`
30
+
31
+ .. contents:: Content
32
+ :local:
33
+ :depth: 2
34
+
35
+ .. argparse::
36
+ :module: airflowctl.ctl.cli_parser
37
+ :func: get_parser
38
+ :prog: airflowctl
39
+
40
+ Environment Variables
41
+ '''''''''''''''''''''
42
+
43
+ .. envvar:: AIRFLOW_CLI_TOKEN
44
+
45
+ The token used to authenticate with the Airflow API. This is only
46
+ required if you are using the Airflow API and have not set up
47
+ authentication using a different method. If username and password hasn't been used.
48
+
49
+ .. envvar:: AIRFLOW_CLI_ENVIRONMENT
50
+
51
+ Environment name to use for the CLI. This is used to determine
52
+ which environment to use when running the CLI. This is only
53
+ required if you have multiple environments set up and want to
54
+ specify which one to use. If not set, the default environment
55
+ will be used which is production.
@@ -0,0 +1,297 @@
1
+ # Disable Flake8 because of all the sphinx imports
2
+ #
3
+ # Licensed to the Apache Software Foundation (ASF) under one
4
+ # or more contributor license agreements. See the NOTICE file
5
+ # distributed with this work for additional information
6
+ # regarding copyright ownership. The ASF licenses this file
7
+ # to you under the Apache License, Version 2.0 (the
8
+ # "License"); you may not use this file except in compliance
9
+ # with the License. You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing,
14
+ # software distributed under the License is distributed on an
15
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16
+ # KIND, either express or implied. See the License for the
17
+ # specific language governing permissions and limitations
18
+ # under the License.
19
+ """Configuration of Providers docs building."""
20
+
21
+ from __future__ import annotations
22
+
23
+ import logging
24
+ import os
25
+ import pathlib
26
+ import re
27
+ from typing import Any
28
+
29
+ from docs.utils.conf_constants import (
30
+ AIRFLOW_CTL_DOC_STATIC_PATH,
31
+ AIRFLOW_CTL_SRC_PATH,
32
+ AIRFLOW_FAVICON_PATH,
33
+ AUTOAPI_OPTIONS,
34
+ BASIC_AUTOAPI_IGNORE_PATTERNS,
35
+ BASIC_SPHINX_EXTENSIONS,
36
+ REDOC_SCRIPT_URL,
37
+ SMARTQUOTES_EXCLUDES,
38
+ SPELLING_WORDLIST_PATH,
39
+ SPHINX_DESIGN_STATIC_PATH,
40
+ SPHINX_REDOC_EXTENSIONS,
41
+ SUPPRESS_WARNINGS,
42
+ filter_autoapi_ignore_entries,
43
+ get_autodoc_mock_imports,
44
+ get_configs_and_deprecations,
45
+ get_google_intersphinx_mapping,
46
+ get_html_context,
47
+ get_html_sidebars,
48
+ get_html_theme_options,
49
+ get_intersphinx_mapping,
50
+ get_rst_epilogue,
51
+ get_rst_filepath_from_path,
52
+ skip_util_classes_extension,
53
+ )
54
+ from packaging.version import Version, parse as parse_version
55
+
56
+ import airflowctl
57
+ from airflow.configuration import retrieve_configuration_description
58
+
59
+ PACKAGE_NAME = "apache-airflow-ctl"
60
+ PACKAGE_VERSION = airflowctl.__version__
61
+ SYSTEM_TESTS_DIR: pathlib.Path | None
62
+ # SYSTEM_TESTS_DIR = AIRFLOW_REPO_ROOT_PATH / "airflow-ctl" / "tests" / "system" / "core"
63
+
64
+ os.environ["AIRFLOW_PACKAGE_NAME"] = PACKAGE_NAME
65
+
66
+ # Disable color output for documentation generation
67
+ os.environ["NO_COLOR"] = "1"
68
+
69
+ # Hack to allow changing for piece of the code to behave differently while
70
+ # the docs are being built. The main objective was to alter the
71
+ # behavior of the utils.apply_default that was hiding function headers
72
+ os.environ["BUILDING_AIRFLOW_DOCS"] = "TRUE"
73
+
74
+ # General information about the project.
75
+ project = PACKAGE_NAME
76
+ # # The version info for the project you're documenting
77
+ version = PACKAGE_VERSION
78
+ # The full version, including alpha/beta/rc tags.
79
+ release = PACKAGE_VERSION
80
+
81
+ rst_epilog = get_rst_epilogue(PACKAGE_VERSION, False)
82
+
83
+ # The language for content autogenerated by Sphinx. Refer to documentation
84
+ smartquotes_excludes = SMARTQUOTES_EXCLUDES
85
+
86
+ # Add any Sphinx extension module names here, as strings. They can be
87
+ # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
88
+ # ones.
89
+ extensions = BASIC_SPHINX_EXTENSIONS
90
+
91
+ # -- Options for sphinxcontrib.redoc -------------------------------------------
92
+ # See: https://sphinxcontrib-redoc.readthedocs.io/en/stable/
93
+
94
+ extensions.extend(SPHINX_REDOC_EXTENSIONS)
95
+ redoc_script_url = REDOC_SCRIPT_URL
96
+
97
+ extensions.extend(
98
+ [
99
+ "autoapi.extension",
100
+ "sphinx_jinja",
101
+ "sphinx.ext.graphviz",
102
+ "sphinxcontrib.httpdomain",
103
+ "extra_files_with_substitutions",
104
+ ]
105
+ )
106
+
107
+ exclude_patterns = [
108
+ # We only link to selected subpackages.
109
+ "_api/airflowctl/index.rst",
110
+ "_api/airflowctl/api/*",
111
+ "_api/airflowctl/api/datamodels/*",
112
+ "_api/airflowctl/ctl/*",
113
+ "_api/airflowctl/exceptions/index.rst",
114
+ "_api/airflowctl/utils/*",
115
+ "README.rst",
116
+ ]
117
+
118
+ # Exclude top-level packages
119
+ # do not exclude these top-level modules from the doc build:
120
+ ALLOWED_TOP_LEVEL_FILES = ("exceptions.py",)
121
+
122
+
123
+ def add_airflow_ctl_exclude_patterns_to_sphinx(exclude_patterns: list[str]):
124
+ """
125
+ Add excluded files to Sphinx exclude patterns.
126
+
127
+ Excludes all files from autoapi except the ones we want to allow.
128
+
129
+ :param root: The root directory of the package.
130
+ :param allowed_top_level_files: Tuple of allowed top-level files.
131
+ :param browsable_packages: Set of browsable packages.
132
+ :param browsable_utils: Set of browsable utils.
133
+ :param models_included: Set of included models.
134
+ """
135
+ # first - excluded everything that is not allowed or browsable
136
+ root = AIRFLOW_CTL_SRC_PATH / "airflowctl"
137
+ for path in root.iterdir():
138
+ if path.is_file() and path.name not in ALLOWED_TOP_LEVEL_FILES:
139
+ exclude_patterns.append(get_rst_filepath_from_path(path, root.parent))
140
+ print(f"Excluding {path} from Sphinx docs")
141
+
142
+
143
+ add_airflow_ctl_exclude_patterns_to_sphinx(exclude_patterns)
144
+
145
+ # Add any paths that contain templates here, relative to this directory.
146
+ templates_path = ["templates"]
147
+
148
+ # If true, keep warnings as "system message" paragraphs in the built documents.
149
+ keep_warnings = True
150
+
151
+ # The theme to use for HTML and HTML Help pages. See the documentation for
152
+ # a list of builtin themes.
153
+ html_theme = "sphinx_airflow_theme"
154
+
155
+ html_title = "airflowctl Documentation"
156
+
157
+ # A shorter title for the navigation bar. Default is the same as html_title.
158
+ html_short_title = ""
159
+
160
+ # given, this must be the name of an image file that is the favicon of the docs
161
+ html_favicon = AIRFLOW_FAVICON_PATH.as_posix()
162
+
163
+ # Custom static files (such as style sheets) here,
164
+ html_static_path = [AIRFLOW_CTL_DOC_STATIC_PATH.as_posix(), SPHINX_DESIGN_STATIC_PATH.as_posix()]
165
+
166
+ # A list of JavaScript filenames.
167
+ html_js_files = ["gh-jira-links.js", "redirects.js"]
168
+
169
+ # Substitute in links
170
+ manual_substitutions_in_generated_html = [
171
+ "installation/installing-from-pypi.html",
172
+ "installation/installing-from-sources.html",
173
+ "installation/prerequisites.html",
174
+ ]
175
+
176
+ html_css_files = ["custom.css"]
177
+
178
+ html_sidebars = get_html_sidebars(PACKAGE_VERSION)
179
+
180
+ # If false, no index is generated.
181
+ html_use_index = True
182
+
183
+ # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
184
+ html_show_copyright = False
185
+
186
+ # html theme options
187
+ html_theme_options: dict[str, Any] = get_html_theme_options()
188
+
189
+ conf_py_path = "/airflow-ctl/docs/"
190
+ # A dictionary of values to pass into the template engine's context for all pages.
191
+ html_context = get_html_context(conf_py_path)
192
+
193
+ # -- Options for sphinx_jinja ------------------------------------------
194
+ # See: https://github.com/tardyp/sphinx-jinja
195
+ airflowctl_version: Version = parse_version(
196
+ re.search( # type: ignore[union-attr,arg-type]
197
+ r"__version__ = \"([0-9.]*)(\.dev[0-9]*|b[0-9])?\"",
198
+ (AIRFLOW_CTL_SRC_PATH / "airflowctl" / "__init__.py").read_text(),
199
+ ).groups(0)[0]
200
+ )
201
+
202
+
203
+ config_descriptions = retrieve_configuration_description(include_providers=False)
204
+ configs, deprecated_options = get_configs_and_deprecations(airflowctl_version, config_descriptions)
205
+
206
+ jinja_contexts = {
207
+ "config_ctx": {"configs": configs, "deprecated_options": deprecated_options},
208
+ "quick_start_ctx": {"doc_root_url": f"https://airflow.apache.org/docs/apache-airflow/{PACKAGE_VERSION}/"},
209
+ "official_download_page": {
210
+ "base_url": f"https://downloads.apache.org/airflow/{PACKAGE_VERSION}",
211
+ "closer_lua_url": f"https://www.apache.org/dyn/closer.lua/airflow/{PACKAGE_VERSION}",
212
+ "airflow_version": PACKAGE_VERSION,
213
+ },
214
+ }
215
+
216
+ # -- Options for sphinx.ext.autodoc --------------------------------------------
217
+ # See: https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html
218
+
219
+ # This value contains a list of modules to be mocked up. This is useful when some external dependencies
220
+ # are not met at build time and break the building process.
221
+ autodoc_mock_imports = get_autodoc_mock_imports()
222
+ # The default options for autodoc directives. They are applied to all autodoc directives automatically.
223
+ autodoc_default_options = {"show-inheritance": True, "members": True}
224
+
225
+ autodoc_typehints = "description"
226
+ autodoc_typehints_description_target = "documented"
227
+ autodoc_typehints_format = "short"
228
+
229
+
230
+ # -- Options for sphinx.ext.intersphinx ----------------------------------------
231
+ # See: https://www.sphinx-doc.org/en/master/usage/extensions/intersphinx.html
232
+
233
+ # This config value contains names of other projects that should
234
+ # be linked to in this documentation.
235
+ # Inventories are only downloaded once by exts/docs_build/fetch_inventories.py.
236
+ intersphinx_mapping = get_intersphinx_mapping()
237
+ intersphinx_mapping.update(get_google_intersphinx_mapping())
238
+
239
+ # -- Options for sphinx.ext.viewcode -------------------------------------------
240
+ # See: https://www.sphinx-doc.org/es/master/usage/extensions/viewcode.html
241
+
242
+ # If this is True, viewcode extension will emit viewcode-follow-imported event to resolve the name of
243
+ # the module by other extensions. The default is True.
244
+ viewcode_follow_imported_members = True
245
+
246
+ # -- Options for sphinx-autoapi ------------------------------------------------
247
+ # See: https://sphinx-autoapi.readthedocs.io/en/latest/config.html
248
+
249
+ # your API documentation from.
250
+ autoapi_dirs = [AIRFLOW_CTL_SRC_PATH.as_posix()]
251
+
252
+ # A directory that has user-defined templates to override our default templates.
253
+ autoapi_template_dir = "autoapi_templates"
254
+
255
+ # A list of patterns to ignore when finding files
256
+ autoapi_ignore = BASIC_AUTOAPI_IGNORE_PATTERNS
257
+
258
+ # filter logging
259
+ autoapi_log = logging.getLogger("sphinx.autoapi.mappers.base")
260
+ autoapi_log.addFilter(filter_autoapi_ignore_entries)
261
+
262
+ # Keep the AutoAPI generated files on the filesystem after the run.
263
+ # Useful for debugging.
264
+ autoapi_keep_files = True
265
+
266
+ # Relative path to output the AutoAPI files into. This can also be used to place the generated documentation
267
+ # anywhere in your documentation hierarchy.
268
+ autoapi_root = "_api"
269
+
270
+ # Whether to insert the generated documentation into the TOC tree. If this is False, the default AutoAPI
271
+ # index page is not generated and you will need to include the generated documentation in a
272
+ # TOC tree entry yourself.
273
+ autoapi_add_toctree_entry = False
274
+
275
+ # By default autoapi will include private members -- we don't want that!
276
+ autoapi_options = AUTOAPI_OPTIONS
277
+
278
+ suppress_warnings = SUPPRESS_WARNINGS
279
+
280
+ # -- Options for ext.exampleinclude --------------------------------------------
281
+ exampleinclude_sourceroot = os.path.abspath("..")
282
+
283
+ # -- Options for ext.redirects -------------------------------------------------
284
+ redirects_file = "redirects.txt"
285
+
286
+ # -- Options for sphinxcontrib-spelling ----------------------------------------
287
+ spelling_word_list_filename = [SPELLING_WORDLIST_PATH.as_posix()]
288
+ spelling_exclude_patterns = ["project.rst", "changelog.rst"]
289
+
290
+ spelling_ignore_contributor_names = False
291
+ spelling_ignore_importable_modules = True
292
+
293
+ graphviz_output_format = "svg"
294
+
295
+
296
+ def setup(sphinx):
297
+ sphinx.connect("autoapi-skip-member", skip_util_classes_extension)