-
-
Notifications
You must be signed in to change notification settings - Fork 703
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Documented internals API for use in plugins #576
Comments
I wrote about this a bit here: https://simonwillison.net/2020/Jan/6/sitemap-xml/ |
Also made a start on the Datasette class documentation, refs #576
OK, I've made a start on this now in 3ffb8f3 - still plenty more methods to document. More importantly that class has a LOT of junk methods on that no-one should ever call from a plugin, so I need to decide what to do about those. |
Also improved parameter documentation for other methods, refs #576
I need to document the Idea: |
Need to document |
There's a bunch of methods on that class which I could add a |
__init__(self, files, immutables=None, cache_headers=True, cors=False, inspect_data=None, metadata=None, sqlite_extensions=None, template_dir=None, plugins_dir=None, static_mounts=None, memory=False, config=None, version_note=None, config_dir=None)
absolute_url(self, request, path) add_database(self, name, db) app(self)
app_css_hash(self) config(self, key) config_dict(self) connected_databases(self) execute(self, db_name, sql, params=None, truncate=False, custom_time_limit=None, page_size=None, log_sql_errors=True) expand_foreign_keys(self, database, table, column, values)
get_canned_queries(self, database_name) get_canned_query(self, database_name, query_name) metadata(self, key=None, database=None, table=None, fallback=True)
plugin_config(self, plugin_name, database=None, table=None, fallback=True)
plugins(self, show_all=False) prepare_connection(self, conn, database) register_custom_units(self)
register_renderers(self)
remove_database(self, name) render_template(self, templates, context=None, request=None, view_name=None) table_metadata(self, database, table)
threads(self) update_with_inherited_metadata(self, metadata) versions(self) |
I should also think about the class properties (as opposed to methods) that are setup in the Datasette constructor. Many of these should be private, some should be documented.
|
I'm happy with how this has evolved, so I'm closing the issue. |
Quite a few of the plugin hooks make a
datasette”
instance of the Datasette class available to the plugins, so that they can look up configuration settings and execute database queries.This means it should provide a documented, stable API so that plugin authors can rely on it.
The text was updated successfully, but these errors were encountered: