Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@geographika
Copy link
Collaborator

What does this PR do?

Adds in a new ctest check to ensure docstub annotations can be correctly generated. If errors are introduced, the docs CI action will fail.

This will prevent invalid annotations being added to the Python docstrings, in preparation for creating stubs as part of the Python bindings.

If the CI fails then the errors will be reported in the logs similar to below:

2025-10-22T19:03:34.7781906Z 1392 matched annotations
2025-10-22T19:03:34.7782232Z 1 syntax errors
2025-10-22T19:03:34.7782538Z 30 unknown type names
2025-10-22T19:03:34.7782851Z   SpatialReference (x10)
..
2025-10-22T19:03:34.7784938Z   Feature (x1)
2025-10-22T19:03:34.7785237Z   datetime.datetime (x1)
2025-10-22T19:03:34.7785575Z   Transformer (x1)
2025-10-22T19:03:34.7785859Z 31 total errors
2025-10-22T19:03:34.7786030Z 
2025-10-22T19:03:34.7786152Z Finished in 11.006 s
2025-10-22T19:03:34.7786345Z 
2025-10-22T19:03:34.7786480Z Errors while running CTest
2025-10-22T19:03:34.7786700Z 
2025-10-22T19:03:34.7786861Z 0% tests passed, 1 tests failed out of 1
2025-10-22T19:03:34.7787144Z 
2025-10-22T19:03:34.7787235Z Total Test time (real) =  11.63 sec
2025-10-22T19:03:34.7787387Z 
2025-10-22T19:03:34.7787471Z The following tests FAILED:
2025-10-22T19:03:34.7787684Z 	  3 - docstub-annotations (Failed)

A few errors were introduced since #13198 was merged, and these have also been fixed.

What are related issues/pull requests?

#13198

@geographika geographika added funded through GSP Work funded through the GDAL Sponsorship Program Continuous integration documentation Issues and contributions to the documentation content labels Oct 22, 2025
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})

# Check docstub annotations
add_test(NAME docstub-annotations
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This command is actually generating the annotations, right? Would it make sense to register a custom target for the stub files, rather than going through ctest ? CI would still fail if the target cannot be built.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct - it will generate the stub files. I saw this PR as an intermediate step to ensure valid annotations until we are ready to package the stub files. The custom target would be better suited to gdal\swig\python\CMakeLists.txt rather than the gdal\doc\CMakeLists.txt one used here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd lean towards going straight for gdal/swig/python/CMakeLists.txt, yes.

The stub files aren't terribly useful until #13145 is done but they are at least able to provide return types. Should we go ahead and package them once 3.12 is separated from the master branch?

@coveralls
Copy link
Collaborator

Coverage Status

coverage: 71.343% (+0.01%) from 71.33%
when pulling 6ed7446 on geographika:docstub-checks
into 76318b2 on OSGeo:master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Continuous integration documentation Issues and contributions to the documentation content funded through GSP Work funded through the GDAL Sponsorship Program

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants