Skip to content

Add a more powerful pre-processing before parsing doctypes #114

Closed

Description

@lagru

After talking with @glemaitre on what scikit-learn might need to make use of docstub, we had the idea to allow users to to regex substitution on doctests.

This would be useful to address the following doctype that scikit-learn is using in many places:

{array-like, sparse matrix} of shape (n_samples, n_features)

This should be translated to

array-like of shape (n_samples, n_features) | sparse-matrix of shape (n_samples, n_features)

which could be done with regex substitution and capture groups.

Another way would be to define a proper union type that combines array-like | sparse-matrix but we weren't sure how that should be named to be still expressive.

Activity

  1. added this to the v0.7 milestone on Nov 7, 2025
  2. added
    enhancementNew feature or functionality
    importantImportant or blocking other issues
    on Nov 7, 2025
  3. lagru commented on Nov 4, 2026

    @lagru
    MemberAuthor

    The requested "pre-processing" should be possible now with the new plugin system from #130. 😊

    I explicitly included an example in the plugin writing guide on how to implement an expansion expression like described above: Example: Expansion expression for qualnames.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or functionalityimportantImportant or blocking other issues

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions