用于 Sphinx 的 Airflow 主题
项目描述
Sphinx 主题用于 Airflow
Sphinx 主题用于 Apache Airflow 文档。
从源安装
为了开始使用此主题,请按照以下说明操作。
-
确保
python
命令执行 Python3 解释器。如果需要,请使用虚拟环境mkvirtualenv -p python3 <name_of_environment>
-
为了使主题中的JavaScript和CSS代码可用,请在根目录下运行以下命令:
./site.sh build-site && ./site.sh prepare-theme
-
要安装所需的Python包,请在
<ROOT DIRECTORY>/sphinx_airflow_theme
中运行:pip install -e .
-
要启动示例文档页面,请在
<ROOT DIRECTORY>/sphinx_airflow_theme/demo
中运行:./docs.sh build && ./docs.sh preview
使用Sphinx主题更改生成Airflow文档
如果您对Sphinx主题进行了某些修改,并想生成Airflow文档以检查最终结果,请按照以下步骤操作:
-
在
airflow-site
存储库中构建Airflow网站./site.sh build-site
-
将Sphinx主题打包成
whl
文件cd ./sphinx_airflow_theme python3 setup.py sdist bdist_wheel
-
(可选) 再次检查您的Sphinx主题修改是否已包含在
whl
文件中pip install wheel wheel unpack ./sphinx_airflow_theme-0.0.11-py3-none-any.whl
-
将
whl
文件复制到airflow
存储库中的files
目录cp ./sphinx_airflow_theme-0.0.11-py3-none-any.whl ${AIRFLOW_REPO}/files/
-
在
airflow
存储库中,初始化一个新的breeze环境breeze
-
在breeze容器中,安装主题后再生成文档
pip install /files/sphinx_airflow_theme-0.0.11-py3-none-any.whl --force-reinstall # Generate Airflow documentation only. If you need to generate the whole documentation (all providers), # you can do it using `/opt/airflow/scripts/in_container/run_docs_build.sh`. It takes longer to execute. /opt/airflow/scripts/in_container/run_docs_build.sh --package-filter apache-airflow
-
验证生成的文档是否正确,并包含您的修改。文档生成在
docs/_build/docs/
中。如果您仅生成了Airflow文档,您可以在docs/_build/docs/apache-airflow/latest/
中检查结果。
安装开发版本
要安装主题的最新开发版本,请运行:
THEME_VERSION="$(curl -s https://api.github.com/repos/apache/airflow-site/releases/latest | grep '"tag_name":' | cut -d '"' -f 4)"
pip install "https://github.com/apache/airflow-site/releases/download/${THEME_VERSION}/sphinx_airflow_theme-${THEME_VERSION}-py3-none-any.whl"
您的PR的Python包作为GitHub Actions中CI构建后的可下载工件提供。
配置
该主题支持在项目的 conf.py
中的 html_theme_options
字典下的以下配置选项:
navbar_links
应在页面顶部的导航栏中可用的链接列表。项目顺序不会改变。
示例值
html_theme_options = {
'navbar_links': [
{'href': '/docs/', 'text': 'Documentation'}
]
}
(这是默认值)
hide_website_buttons
如果 True
,则将隐藏指向此主题页面的同一域名上的所有链接(例如,/community/
)。
示例值
html_theme_options = {
'hide_website_buttons': False,
}
sidebar_collapse
sidebar_includehidden
控制侧边栏中的目录显示。有关更多信息,请参阅 https://sphinx-doc.cn/en/master/templating.html#toctree
主题源文件
<ROOT DIRECTORY>/sphinx_airflow_theme/sphinx_airflow_theme
- HTML文件<ROOT DIRECTORY>/landing-pages/site/assets/scss
- SCSS文件<ROOT DIRECTORY>/landing-pages/src/js
- Javascript文件。如果您创建了新的JS文件,请确保将其包括在 `/landing-pages/src/docs-index.js` 中
项目详细信息
下载文件
下载适用于您的平台的文件。如果您不确定要选择哪个,请了解有关 安装包 的更多信息。
源分发
构建分发
哈希值 用于 sphinx_airflow_theme-0.0.12-py3-none-any.whl
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 41a2bcf3027d104d3e90306ae13759433a8423b7439976461096a4a10c37c325 |
|
MD5 | 3a778e0fcb47b266ec68da29dfca23a1 |
|
BLAKE2b-256 | ff0a7fee15c8d703acb1ea54a3a05dacd861c30022285c8040eb6d9271d2a49e |