You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2020/11/07 15:01:26 UTC

[GitHub] [airflow] mik-laj opened a new pull request #12161: Fix docs build on RTD

mik-laj opened a new pull request #12161:
URL: https://github.com/apache/airflow/pull/12161


   The docs/build_docs.py file is not used by RTD, so we need to use  sphinx extensions.  I tested this change locally, but didn't test it on RTD as there is no easy way to run build locally.
   <!--
   Thank you for contributing! Please make sure that your code changes
   are covered with tests. And in case of new features or big changes
   remember to adjust the documentation.
   
   Feel free to ping committers for the review!
   
   In case of existing issue, reference it using one of the following:
   
   closes: #ISSUE
   related: #ISSUE
   
   How to write a good git commit message:
   http://chris.beams.io/posts/git-commit/
   -->
   
   ---
   **^ Add meaningful description above**
   
   Read the **[Pull Request Guidelines](https://github.com/apache/airflow/blob/master/CONTRIBUTING.rst#pull-request-guidelines)** for more information.
   In case of fundamental code change, Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvements+Proposals)) is needed.
   In case of a new dependency, check compliance with the [ASF 3rd Party License Policy](https://www.apache.org/legal/resolved.html#category-x).
   In case of backwards incompatible changes please leave a note in [UPDATING.md](https://github.com/apache/airflow/blob/master/UPDATING.md).
   


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] potiuk commented on a change in pull request #12161: Fix docs build on RTD

Posted by GitBox <gi...@apache.org>.
potiuk commented on a change in pull request #12161:
URL: https://github.com/apache/airflow/pull/12161#discussion_r519189754



##########
File path: docs/conf.py
##########
@@ -424,6 +425,7 @@ def _get_rst_filepath_from_path(filepath: str):
     '*/airflow/kubernetes/kubernetes_request_factory/*',
     '*/_internal*',
     '*/node_modules/*',
+    '*/example_dags/*,',

Review comment:
       It does not stop to amaze me how unrelated changes trigger new warnings in sphinx autoapi. I have no trust in that software :)




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] mik-laj commented on a change in pull request #12161: Fix docs build on RTD

Posted by GitBox <gi...@apache.org>.
mik-laj commented on a change in pull request #12161:
URL: https://github.com/apache/airflow/pull/12161#discussion_r519191739



##########
File path: docs/build_docs.py
##########
@@ -608,6 +603,7 @@ def check_spelling() -> None:
     :return:
     """
     extensions_to_use = [
+        'provider_init_hack',

Review comment:
       For spell checking, we should also load this plugin.




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] potiuk commented on a change in pull request #12161: Fix docs build on RTD

Posted by GitBox <gi...@apache.org>.
potiuk commented on a change in pull request #12161:
URL: https://github.com/apache/airflow/pull/12161#discussion_r519186787



##########
File path: docs/exts/provider_init_hack.py
##########
@@ -0,0 +1,58 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+"""
+Bugs in sphinx-autoapi using metaclasses prevent us from upgrading to 1.3
+which has implicit namespace support. Until that time, we make it look
+like a real package for building docs
+"""
+import os
+import shutil
+
+from sphinx.application import Sphinx
+
+ROOT_PROJECT_DIR = os.path.abspath(
+    os.path.join(os.path.dirname(os.path.realpath(__file__)), os.pardir, os.pardir)
+)
+
+PROVIDER_INIT_FILE = os.path.join(ROOT_PROJECT_DIR, "airflow", "providers", "__init__.py")
+
+
+def _create_init_py(app, config):
+    del app
+    del config
+    with open(PROVIDER_INIT_FILE, "wt"):
+        pass
+
+
+def _delete_init_py(app, exception):
+    del app
+    del exception
+    shutil.rmtree(PROVIDER_INIT_FILE, ignore_errors=True)

Review comment:
        Rmtree does not remove the file (it only removes directories). There was a bug in the original code which I fixed here https://github.com/apache/airflow/pull/12082/files#diff-7cfad0a0b04e44c6f6e568cfd6bce073202306ce4c0fb0c285ee1b7fce55836dR747. Not removing the __init__file now causes rather strange problems with imports.




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] mik-laj merged pull request #12161: Fix docs build on RTD

Posted by GitBox <gi...@apache.org>.
mik-laj merged pull request #12161:
URL: https://github.com/apache/airflow/pull/12161


   


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] mik-laj commented on a change in pull request #12161: Fix docs build on RTD

Posted by GitBox <gi...@apache.org>.
mik-laj commented on a change in pull request #12161:
URL: https://github.com/apache/airflow/pull/12161#discussion_r519188899



##########
File path: docs/exts/provider_init_hack.py
##########
@@ -0,0 +1,58 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+"""
+Bugs in sphinx-autoapi using metaclasses prevent us from upgrading to 1.3
+which has implicit namespace support. Until that time, we make it look
+like a real package for building docs
+"""
+import os
+import shutil
+
+from sphinx.application import Sphinx
+
+ROOT_PROJECT_DIR = os.path.abspath(
+    os.path.join(os.path.dirname(os.path.realpath(__file__)), os.pardir, os.pardir)
+)
+
+PROVIDER_INIT_FILE = os.path.join(ROOT_PROJECT_DIR, "airflow", "providers", "__init__.py")
+
+
+def _create_init_py(app, config):
+    del app
+    del config
+    with open(PROVIDER_INIT_FILE, "wt"):
+        pass
+
+
+def _delete_init_py(app, exception):
+    del app
+    del exception
+    shutil.rmtree(PROVIDER_INIT_FILE, ignore_errors=True)

Review comment:
       Fixed. Thanks.




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] mik-laj commented on pull request #12161: Fix docs build on RTD

Posted by GitBox <gi...@apache.org>.
mik-laj commented on pull request #12161:
URL: https://github.com/apache/airflow/pull/12161#issuecomment-723472212


   All works: https://airflow.readthedocs.io/en/latest/_api/index.html


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] github-actions[bot] commented on pull request #12161: Fix docs build on RTD

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on pull request #12161:
URL: https://github.com/apache/airflow/pull/12161#issuecomment-723462465


   [The Workflow run](https://github.com/apache/airflow/actions/runs/351242707) is cancelling this PR. It has some failed jobs matching ^Pylint$,^Static checks,^Build docs$,^Spell check docs$,^Backport packages$,^Provider packages,^Checks: Helm tests$,^Test OpenAPI*.


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] mik-laj commented on a change in pull request #12161: Fix docs build on RTD

Posted by GitBox <gi...@apache.org>.
mik-laj commented on a change in pull request #12161:
URL: https://github.com/apache/airflow/pull/12161#discussion_r519189219



##########
File path: docs/conf.py
##########
@@ -424,6 +425,7 @@ def _get_rst_filepath_from_path(filepath: str):
     '*/airflow/kubernetes/kubernetes_request_factory/*',
     '*/_internal*',
     '*/node_modules/*',
+    '*/example_dags/*,',

Review comment:
       For unknown reasons, a new warning started popping up, so I had to fix it as well.
   See: https://github.com/apache/airflow/runs/1367944822




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] potiuk commented on pull request #12161: Fix docs build on RTD

Posted by GitBox <gi...@apache.org>.
potiuk commented on pull request #12161:
URL: https://github.com/apache/airflow/pull/12161#issuecomment-723474588


   cool!


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] github-actions[bot] commented on pull request #12161: Fix docs build on RTD

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on pull request #12161:
URL: https://github.com/apache/airflow/pull/12161#issuecomment-723460929


   The PR is ready to be merged. No tests are needed!


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org