Ajay9704 commented on code in PR #60203:
URL: https://github.com/apache/airflow/pull/60203#discussion_r2667773483


##########
devel-common/src/docs/provider_conf.py:
##########
@@ -276,6 +276,18 @@
 if PACKAGE_NAME in ["apache-airflow-providers-google"]:
     intersphinx_mapping.update(get_google_intersphinx_mapping())
 
+# Add task-sdk to intersphinx mapping for proper cross-referencing of SDK 
classes
+# This allows proper linking to BaseSensorOperator and other SDK classes from 
provider docs
+try:
+    import airflow.sdk
+    # Add remote task-sdk inventory for cross-referencing
+    # This enables proper linking to SDK classes like BaseSensorOperator
+    task_sdk_version = parse_version(airflow.sdk.__version__).base_version
+    intersphinx_mapping["task-sdk"] = 
(f"https://airflow.apache.org/docs/task-sdk/{task_sdk_version}/";, None)
+except ImportError:
+    # If task-sdk is not available, don't add the mapping
+    pass

Review Comment:
   @uranusjr You're right Sir , thanks for pointing this out. On reflection, I 
realize the try-except was overly defensive for this specific case. If we're 
building documentation for providers that use BaseSensorOperator, then task-sdk 
must be available since that's where BaseSensorOperator is defined.
   
   I was initially thinking about defensive programming for various build 
environments (CI, local dev, etc.), but you're correct that if someone's 
building docs for providers that inherit from BaseSensorOperator, the task-sdk 
has to be available. 
   
   I'll update the PR to remove the try-except block and just directly add the 
intersphinx mapping. Appreciate the feedback - definitely helps make the code 
cleaner and more straightforward!



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to