Skip to content

Make the "additional docs" customizable #30

Open

Description

@seberg

I suspect that different libraries will want a different way to include docs from backends.
It would be nice to develop a common pattern, but overall, I am not convinced that it is a priority.

It seems fine to do some default here (i.e. what we currently have), but I think it would make sense to just allow to customize this and just pass on the full metadata defined in the .toml file.
(Or just the additional_docs field, but allow it to be anything and not just a string.)

Adding such a function, begs the question whether it wouldn't be nicer to define a backend as a subclass:

class _BS(spatch.backend_system.BackendSystem):
    def documentation_hook():

(or fake class) just to make it less weird to pass functions (but passing a function is also not a big deal for now).

Activity

  1. seberg commented on Oct 13, 2025

    @seberg
    ContributorAuthor

    I want to look into this, I wonder if you have thoughts on it @eriknw or @Schefflera-Arboricola?
    (The reason is that SciPy already has fancy docs, and whatever they do, for now the easiest is to do nothing, I think. And long-term it'll be something project specific there.)

    I could even see a fake class:

    @spatch.backend_system.BackendSystem
    class _bs:
        entry_point = ...
        def documentation_hook(...):
            ...
    

    although, I suppose I can just go with a lot of kwargs for now, i.e. just add BackendSystem(documentation_hook=function|None). This can always be a small alternative spelling (both the decorator or an inheritance style).

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions