GPL-3.0 License
The Obsidian Python lab is just a collection of dumb interfaces to enable python developers to use/test functionality within Obsidian.
Say you have a terrific script to:
And you want to quickly see if it's helpful in Obsidian, just using some python.
That is the purpose of this plugin!.
Sometimes is quicker to experiment in Python and later, if you want, make it work in Javascript. This is especially true when using Natural Language Processing libraries.
The plugin is just a GUI to make calls to a server of your choice. Currently, the plugin has implemented the following operations:
Say your terrific script returns a list of random notes of your vault. Then the plugin does:
With some context data
{
"vaultPath": "/home/cvasquez/obsidian/development",
"notePath": "snippets-plugin/Test1.md"
}
It then returns a JSON response, which the plugin uses to show something in a Widget
Response
{
"contents": [
{
"info": { "score": "0.9820077811564822" },
"path": { "path": "/path/to/the/note 1.md" }
},
{
"info": { "score": "0.9365154046414078" },
"path": { "path": "/path/to/the/note 2.md" }
}
]
}
Install the plugin. (Maybe you already did)
Write a script somewhere
def hello():
return {
'contents': f'Hello world!'
}
I wrote a minimal server, obsidian-lab-py, that exposes some scripts. It might be useful to look at. I use something different each time, like this example.
This is not necessary if the plugin is installed from the store. However, it is built like all the other plugins,
/{vault}/.obsidian/plugins
Install the dependencies
yarn install
build the app
yarn build
This will build the main file; that Obsidian should detect. Activate the plugin from inside Obsidian, in community plugins
This repo has github discussions enabled.
This is still a proof of concept; please send any feedback :)
Pull requests are both welcome and appreciated.