Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Extend plugin configuration#1062

FabioRosado started this conversation inProposals
Dec 21, 2022· 2 comments· 1 reply
Discussion options

Python plugins are a bit of a hidden feature since they are still a WIP, but we can fetch a python plugin like this:

<py-config>                plugins = ["http://my-awesome-python-plugin.com/plugin/my-plugin.py"]</py-config>

Under the hood, we use the same logic as[[fetch]] to try to import the python plugin; providing that we have access, the plugin should be available and usable.

Using a list for plugins is a good and easy way to get plugins into a pyscript app. We could also allow users to use an extended plugin configuration.

Plugin configuration proposed

<py-config>              [[plugins]]                [plugins.hello-world]                  path = "http://my-awesome-python-plugin.com/plugin/my-plugin.py"</py-config>

Or using json

<py-configtype="json">plugins": [    {      "hello-world": {        "path": "http://my-awesome-python-plugin.com/plugin/my-plugin.py"      }    }  ],</py-config>

This could be a good way to allow users to pass specific configurations to the plugins, for example:

<py-config>   [[plugins]]      [plugins.hello-world]         path = "http://my-awesome-python-plugin.com/plugin/my-plugin.py"         coffee = "Yes please"</py-config>

Pyscript could then use those extra configurations available as hooks for the plugin itself (which I think is the idea of theplugins.configuration.

Some concerns

Using this extended configuration does bring some issues. For once, it will be easier to have a bad config if you don't know toml/json.

The code that ingests the config and looks over the plugins will have to be more complex to handle the more complex structure.

You must be logged in to vote

Replies: 2 comments 1 reply

Comment options

I like this plugin configuration quite a lot! Keeping the plugin attributes out of the root level of <py-config> is swell, and prevents us from running into naming collisions for plugin attributes down the road. +1 from me.

One small comment on the proposed format - it feels slightly awkward thatplugins is a list of objects, each of which has but a single key/value pair, which references the object data. If we do away with the initial "Array of Table" syntax, this becomes:

[plugins.dog-facts]path ="site/dogs.py"goodpet =true[plugins.alligator-warning]path ="site/gator.py"goodpet =false

or in JSON

{"plugins": {"dog-facts": {"goodpet":true,"path":"site/dogs.py"    },"alligator-warning": {"goodpet":false,"path":"site/gator.py"    }  }}
You must be logged in to vote
1 reply
@FabioRosado
Comment options

Oh that's much better! I don't really know how toml works that well that's why I thought we had to do the[[plugins]] first 😄

+1 on this one!

Comment options

Got to have a big ole conversation last week about Plugin metadata configuration at the February offsite - here's anupdated proposal for plugin configuration and what theplugins key in <py-config> does.

You must be logged in to vote
0 replies
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Labels
None yet
2 participants
@FabioRosado@JeffersGlass

[8]ページ先頭

©2009-2025 Movatter.jp