Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin hook: actors_from_ids() #2180

Closed
simonw opened this issue Sep 8, 2023 · 6 comments
Closed

Plugin hook: actors_from_ids() #2180

simonw opened this issue Sep 8, 2023 · 6 comments

Comments

@simonw
Copy link
Owner

simonw commented Sep 8, 2023

In building Datasette Cloud we realized that a bunch of the features we are building need a way of resolving an actor ID to the actual actor, in order to display something more interesting than just an integer ID.

Social plugins in particular need this - comments by X, CSV uploaded by X, that kind of thing.

I think the solution is a new plugin hook: actors_from_ids(datasette, ids) which can return a list of actor dictionaries.

The default implementation can return [{"id": "..."}] for the IDs passed to it.

Pluggy has a firstresult=True option which is relevant here, since this is the first plugin hook we will have implemented where only one plugin should provide an answer.

@simonw
Copy link
Owner Author

simonw commented Sep 8, 2023

I think this is both a plugin hook and a await datasette.actors_from_ids(actor_ids) internal API function that calls it.

@simonw
Copy link
Owner Author

simonw commented Sep 8, 2023

I shipped the first version of

When I land this plugin in a Datasette release I need to update that repo to depend on the new alpha.

@simonw
Copy link
Owner Author

simonw commented Sep 8, 2023

I've implemented this hook once now in:

And built and tested a debug tool for it in:

I'm now confident in the design of this plugin hook, I'm going to land it.

simonw added a commit that referenced this issue Sep 8, 2023
…2181)

* Prototype of actors_from_ids plugin hook, refs #2180
* datasette-remote-actors example plugin, refs #2180
@simonw
Copy link
Owner Author

simonw commented Sep 10, 2023

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

No branches or pull requests

1 participant