You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@sedona.apache.org by "zhangfengcdt (via GitHub)" <gi...@apache.org> on 2025/07/30 14:37:30 UTC

[PR] [CI] Fix the python api build failed to import module errors [sedona]

zhangfengcdt opened a new pull request, #2196:
URL: https://github.com/apache/sedona/pull/2196

   ## Did you read the Contributor Guide?
   
   - Yes, I have read the [Contributor Rules](https://sedona.apache.org/latest/community/rule/) and [Contributor Development Guide](https://sedona.apache.org/latest/community/develop/)
   
   ## Is this PR related to a ticket?
   
   - No:
     - this is a CI update. The PR name follows the format `[CI] my subject`
   
   ## What changes were proposed in this PR?
   
   The last doc build shows:
   
   WARNING: autodoc: failed to import class 'geopandas.GeoSeries' from module 'sedona'; the following exception was raised:
   ['Traceback (most recent call last):\n', '  File "/opt/hostedtoolcache/Python/3.13.5/x64/lib/python3.13/site-packages/sphinx/ext/autodoc/importer.py", line 269, in import_object\n    module = import_module(modname, try_reload=True)\n', '  File "/opt/hostedtoolcache/Python/3.13.5/x64/lib/python3.13/site-packages/sphinx/ext/autodoc/importer.py", line 175, in import_module\n    module = importlib.import_module(modname)\n', '  File "/opt/hostedtoolcache/Python/3.13.5/x64/lib/python3.13/importlib/__init__.py", line 88, in import_module\n    return _bootstrap._gcd_import(name[level:], package, level)\n           ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n', '  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import\n', '  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load\n', '  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked\n', '  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked\n', '  File "<frozen import
 lib._bootstrap_external>", line 1026, in exec_module\n', '  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed\n', '  File "/home/runner/work/sedona/sedona/python/sedona/geopandas/__init__.py", line 23, in <module>\n    from sedona.geopandas.geoseries import GeoSeries\n', '  File "/home/runner/work/sedona/sedona/python/sedona/geopandas/geoseries.py", line 22, in <module>\n    import geopandas as gpd\n', "ModuleNotFoundError: No module named 'geopandas'\n"] [autodoc.import_object]
   
   WARNING: autodoc: failed to import module 'spark.core.SpatialRDD.spatial_rdd_factory' from module 'sedona'
   
   ...
   
   ## How was this patch tested?
   make doc build
   
   ## Did this PR include necessary documentation updates?
   
   - No, this PR does not affect any public API so no need to change the documentation.
   


-- 
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: issues-unsubscribe@sedona.apache.org

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


Re: [PR] [CI] Fix the python api build failed to import module errors [sedona]

Posted by "jiayuasu (via GitHub)" <gi...@apache.org>.
jiayuasu merged PR #2196:
URL: https://github.com/apache/sedona/pull/2196


-- 
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: issues-unsubscribe@sedona.apache.org

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


Re: [PR] [CI] Fix the python api build failed to import module errors [sedona]

Posted by "jiayuasu (via GitHub)" <gi...@apache.org>.
jiayuasu commented on code in PR #2196:
URL: https://github.com/apache/sedona/pull/2196#discussion_r2244099281


##########
python/sedona/doc/sedona.maps.rst:
##########
@@ -0,0 +1,32 @@
+sedona.maps package
+===================
+
+.. deprecated:: 1.7.0

Review Comment:
   These should be `1.8.0`?



-- 
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: issues-unsubscribe@sedona.apache.org

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


Re: [PR] [CI] Fix the python api build failed to import module errors [sedona]

Posted by "jiayuasu (via GitHub)" <gi...@apache.org>.
jiayuasu commented on code in PR #2196:
URL: https://github.com/apache/sedona/pull/2196#discussion_r2244108569


##########
.github/workflows/docs.yml:
##########
@@ -67,8 +67,15 @@ jobs:
           working-directory: './R'
       - run: Rscript -e 'pkgdown::build_site(pkg = "./R", preview = FALSE, override = list(destination = "../docs/api/rdocs"))'
       - name: Install Python documentation dependencies
-        run: pip install sphinx sphinx_rtd_theme
+        run: |
+          pip install sphinx sphinx_rtd_theme pyspark==3.5.4 pystac==1.13.0

Review Comment:
   @zhangfengcdt For Spark version, please don't hard code it. Use this command to infer versions from Pom.xml instead `SPARK_VERSION=$(mvn help:evaluate -Dexpression=spark.version -q -DforceStdout)`



-- 
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: issues-unsubscribe@sedona.apache.org

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


Re: [PR] [CI] Fix the python api build failed to import module errors [sedona]

Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #2196:
URL: https://github.com/apache/sedona/pull/2196#discussion_r2244100529


##########
python/sedona/doc/conf.py:
##########
@@ -61,16 +70,74 @@
     # Suppress warnings about multiple targets for cross-references
     # This is expected due to shapely1/shapely2 compatibility layer
     "ref.python",
+    # Suppress docstring formatting warnings
+    "docutils",
+    # Suppress autodoc import errors that may occur in CI
+    "autodoc.import_object",
+    "autodoc",

Review Comment:
   [nitpick] Consider using more specific warning suppression instead of broadly suppressing all 'autodoc' warnings. This could mask legitimate documentation issues.
   ```suggestion
   
   ```



##########
python/sedona/doc/conf.py:
##########
@@ -61,16 +70,74 @@
     # Suppress warnings about multiple targets for cross-references
     # This is expected due to shapely1/shapely2 compatibility layer
     "ref.python",
+    # Suppress docstring formatting warnings
+    "docutils",
+    # Suppress autodoc import errors that may occur in CI
+    "autodoc.import_object",
+    "autodoc",
 ]
 
+# Don't treat warnings as errors to avoid IndexError issues
+warning_is_error = False
+# Be less strict about references to avoid import errors
+nitpicky = False
+
 autodoc_default_options = {
     "members": True,
     "undoc-members": True,
     "private-members": False,
     "special-members": "__init__",
     "show-inheritance": True,
+    "ignore-module-all": False,
 }
 
+# Configure autodoc to be more forgiving with import errors
+autodoc_inherit_docstrings = True
+autodoc_preserve_defaults = True
+
+
+# Add error handling for problematic imports in CI
+def skip_member(app, what, name, obj, skip, options):
+    """Skip problematic members that cause IndexError."""

Review Comment:
   The function docstring should explain the parameters, especially 'what', 'obj', and 'options' which are not immediately clear from context.
   ```suggestion
       """
       Determine whether to skip a member during autodoc processing.
   
       This function is connected to the "autodoc-skip-member" event in Sphinx
       and is used to skip specific members that are known to cause issues
       during documentation generation.
   
       Parameters:
           app (Sphinx): The Sphinx application object.
           what (str): The type of the object being documented (e.g., "module", "class", "method").
           name (str): The name of the member being documented.
           obj (object): The actual object being documented.
           skip (bool): A boolean indicating whether autodoc would skip this member by default.
           options (object): The options given to the directive, as an instance of `autodoc.Options`.
   
       Returns:
           bool: True if the member should be skipped, False otherwise.
       """
   ```



##########
python/sedona/doc/conf.py:
##########
@@ -61,16 +70,74 @@
     # Suppress warnings about multiple targets for cross-references
     # This is expected due to shapely1/shapely2 compatibility layer
     "ref.python",
+    # Suppress docstring formatting warnings
+    "docutils",
+    # Suppress autodoc import errors that may occur in CI
+    "autodoc.import_object",
+    "autodoc",
 ]
 
+# Don't treat warnings as errors to avoid IndexError issues
+warning_is_error = False
+# Be less strict about references to avoid import errors
+nitpicky = False
+
 autodoc_default_options = {
     "members": True,
     "undoc-members": True,
     "private-members": False,
     "special-members": "__init__",
     "show-inheritance": True,
+    "ignore-module-all": False,
 }
 
+# Configure autodoc to be more forgiving with import errors
+autodoc_inherit_docstrings = True
+autodoc_preserve_defaults = True
+
+
+# Add error handling for problematic imports in CI
+def skip_member(app, what, name, obj, skip, options):
+    """Skip problematic members that cause IndexError."""
+    # Skip members that are known to cause import issues
+    problematic_patterns = ["raster_serde", "sedona_raster", "shapely1", "shapely2"]
+    if any(pattern in name for pattern in problematic_patterns):

Review Comment:
   [nitpick] The problematic patterns list should be configurable or documented with explanations for why each pattern is problematic to avoid confusion for future maintainers.
   ```suggestion
   # List of problematic patterns that cause import issues or errors
   # - "raster_serde" and "sedona_raster": Known to cause serialization issues in CI.
   # - "shapely1" and "shapely2": Compatibility layers for different Shapely versions.
   PROBLEMATIC_PATTERNS = ["raster_serde", "sedona_raster", "shapely1", "shapely2"]
   
   # Add error handling for problematic imports in CI
   def skip_member(app, what, name, obj, skip, options):
       """Skip problematic members that cause IndexError."""
       if any(pattern in name for pattern in PROBLEMATIC_PATTERNS):
   ```



##########
.github/workflows/docs.yml:
##########
@@ -67,8 +67,15 @@ jobs:
           working-directory: './R'
       - run: Rscript -e 'pkgdown::build_site(pkg = "./R", preview = FALSE, override = list(destination = "../docs/api/rdocs"))'
       - name: Install Python documentation dependencies
-        run: pip install sphinx sphinx_rtd_theme
+        run: |
+          pip install sphinx sphinx_rtd_theme pyspark==3.5.4 pystac==1.13.0

Review Comment:
   Hard-coding specific versions like pyspark==3.5.4 and pystac==1.13.0 may cause compatibility issues over time. Consider using version ranges or moving these to a requirements file.



-- 
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: issues-unsubscribe@sedona.apache.org

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


Re: [PR] [CI] Fix the python api build failed to import module errors [sedona]

Posted by "zhangfengcdt (via GitHub)" <gi...@apache.org>.
zhangfengcdt commented on PR #2196:
URL: https://github.com/apache/sedona/pull/2196#issuecomment-3137754922

   @jiayuasu The fix is ready to review now. Basically the issue was that sphinx needs to properly imports all dependencies for the sedona python packages to generate documents. The previous pr does not install all package and also the default 3.13 python version is not compatible with keplergl build so we have to use 3.11 to build the document. 
   
   Also, I have added deprecation messages to all sedona.* packages since they are all now migrated to sedona.spark.* packages.
   
   In addition to the python dependency fix, I also make some changes to the documents color scheme and structure to be more clear and easy to read. Let me know if this is good to you and we can test this once it is deployted to the website repo and we can fix small document issues for specific apis using following PRs.
   


-- 
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: issues-unsubscribe@sedona.apache.org

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


Re: [PR] [CI] Fix the python api build failed to import module errors [sedona]

Posted by "zhangfengcdt (via GitHub)" <gi...@apache.org>.
zhangfengcdt commented on code in PR #2196:
URL: https://github.com/apache/sedona/pull/2196#discussion_r2245751630


##########
.github/workflows/docs.yml:
##########
@@ -67,8 +67,15 @@ jobs:
           working-directory: './R'
       - run: Rscript -e 'pkgdown::build_site(pkg = "./R", preview = FALSE, override = list(destination = "../docs/api/rdocs"))'
       - name: Install Python documentation dependencies
-        run: pip install sphinx sphinx_rtd_theme
+        run: |
+          pip install sphinx sphinx_rtd_theme pyspark==3.5.4 pystac==1.13.0

Review Comment:
   It should be fixed now.



-- 
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: issues-unsubscribe@sedona.apache.org

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