-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Cedric
committed
Jun 28, 2024
1 parent
c22fbc0
commit c32b566
Showing
42 changed files
with
2,859 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
*.wasm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
|
||
This directory contains plugins samples for developers. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# Python Plugin Sample | ||
|
||
This is an example plugin using python. | ||
|
||
--- | ||
**Documentation**: <a href="https://docs.logcraft.io" target="_blank">https://docs.logcraft.io</a> | ||
--- | ||
|
||
## Poetry | ||
|
||
This example uses python poetry to manage dependencies but feel free to use your prefered package manager. | ||
|
||
## Build | ||
|
||
Building a plugin is a 2 steps process: | ||
|
||
1. Build the bindings for your IDE. This is optional but advised for development. | ||
|
||
```bash | ||
poetry run componentize-py --wit-path wit --world plugins bindings myplugin | ||
|
||
``` | ||
|
||
2. Build the plugin. This step automatically build the bindings regardless if you did it in the previous step or not. The resulting wasm file is the LogCraft CLI plugin. | ||
|
||
```bash | ||
poetry run componentize-py --wit-path wit --world plugin componentize -p myplugin main -o my-plugin.wasm | ||
``` | ||
|
||
|
||
## Important | ||
|
||
As of june 2024, `componentize-py` uses cpython runtime without `zlib`. This is an issue that has consequences: we cannot use python `requests` library and probably others. | ||
|
||
This is a known and identified problem that will be fixed in the future by the `componentize-py` team. | ||
|
||
To workaround this issue, we created a http library based on `sink`, this is available in this sample python application (`myplugin.client`). | ||
|
||
|
||
## WIT | ||
|
||
The wit files provides from: | ||
|
||
1. `wit/world.wit` and `wit/plugin.wit` are LogCraft specific configuration files. These files define input/outputs of plugins. | ||
2. `wit/deps/` come from [wasi-http](https://github.com/WebAssembly/wasi-http/tree/main/wit/deps) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Copyright (c) 2023 LogCraft, SAS. | ||
# SPDX-License-Identifier: MPL-2.0 |
Empty file.
Oops, something went wrong.