DHARPA-Project / kiara-website

Creative Commons Zero v1.0 Universal
0 stars 2 forks source link

Implement "package contents" docs for plugins #3

Open caro401 opened 10 months ago

caro401 commented 10 months ago

Each plugin needs to be able to publish documentation about what modules, operation, data types it contains. This is equivalent to this overview page and the details pages for each "thing" eg this one for operations in the existing mkdocs-based documentation.

Ideally (pending results of @MariellaCC's survey) internally-developed plugins should be able to host this part of their docs on a single central docs site, to help users be able to find what they need in one place and not get lost. Externally-developed plugins need to be able to host this kind of documentation standalone.

Ideally, we should be able to always provide documentation for all versions of a plugin, with the user seeing the most up-to-date version by default.

A proposed technical solution to this is as follows:

JSON is proposed as the initial file format, because this is easy to work with from javascript, and is what Kiara's API currently produces. This could be changed in future if it turns out these files are too big and a binary format (sqlite/arrow etc) would be a better fit. Static files may also be of use for "environment metadata" within kiara.

This collection of JSON files and minimal sveltekit app, publishable to github pages automatically would replace the current mkdocs solution in plugins. Steps that need to be done are

@makkus have I missed anything obvious here? Which plugin do you think should be used to prototype in?

In the future, we could use this static approach to capture examples and test data from plugins, to record the python code and output for tutorials and guides at specific plugin versions. This avoids any concerns about how to call complex sequences of python code from a javascript context.

makkus commented 10 months ago

I can get started with this, and try to create an initial json file, schema and ideally Typescript model classes for you to use.

Once we have that, we can start thinking about the other questions?

makkus commented 10 months ago

Ok, I implemented a first version of creating a data structure that contains all that info (available in kiara >=0.5.5). I haven't added it to any CI runs yet, but I will do so in the future and probably create a json artefact with it whenever a tagged version is released.

It can be used like so from the commandline:

kiara info plugin explain kiara_plugin.tabular --format json

To get the json-schema for the data, you can do:

kiara info plugin explain kiara_plugin.tabular --format json-schema

Initially I also wanted to auto-create Typescript classes, but the library I used for that broke with the pydantic 2 release. I hope that the json-schema is good enough for now.

For development, I'd suggest you just write some example data into a json file and use that to retrieve any information you need. It should be trivial to convert that to a CI workflow where we first auto-write the json file, then pick it up from the doc render step.

caro401 commented 7 months ago

I've just merged #34 which takes the JSON files from kiara info plugin explain and renders some pages based on that. I'll add automation/documentation of how to generate the JSON files in #30 , and open a separate issue on the plugin template for the remainder of the work for standalone plugin docs for non-core/supported plugins