Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/extism/python-sdk
Extism Python Host SDK
https://github.com/extism/python-sdk
Last synced: 2 months ago
JSON representation
Extism Python Host SDK
- Host: GitHub
- URL: https://github.com/extism/python-sdk
- Owner: extism
- License: bsd-3-clause
- Created: 2023-09-13T15:06:28.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-03-19T02:49:02.000Z (10 months ago)
- Last Synced: 2024-05-18T20:43:18.131Z (8 months ago)
- Language: Python
- Size: 3.1 MB
- Stars: 13
- Watchers: 5
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-wasm-runtimes - `Python`
README
# Extism Python Host SDK
This repo contains the Python package for integrating with the
[Extism](https://extism.org/) Webassembly framework. Install this library into
your Python application host to run Extism WebAssembly guest plug-ins.```python
import extism
import jsonmanifest = {"wasm": [{"url": "https://github.com/extism/plugins/releases/latest/download/count_vowels.wasm"}]}
with extism.Plugin(manifest, wasi=True) as plugin:
wasm_vowel_count = plugin.call(
"count_vowels",
"hello world",
parse = lambda output: json.loads(bytes(output).decode('utf-8'))
)
print(wasm_vowel_count) # {'count': 3, 'total': 3, 'vowels': 'aeiouAEIOU'}
```## Installation
Install this package from [PyPI](https://pypi.org/project/extism/):
```shell
# using pip
$ pip install extism==1.0.0# using poetry
$ poetry add extism=^1.0.0
```The `extism` package should install an appropriate `extism_sys` dependency
containing a prebuilt shared object for your system. We support the following
targets:- MacOS 11.0+, `arm64`
- MacOS 10.7+, `x86_64`
- Manylinux 2.17+, `aarch64`
- Manylinux 2.17+, `x86_64`
- MUSL Linux 1.2+, `aarch64`
- Windows (MSVC), `x86_64`If you need support for a different platform or architecture, please [let us know][let-us-know]!
[let-us-know]: https://github.com/extism/extism/issues/new?title=Please+support+extism_sys+on+my+platform&labels=python&body=Hey%21+Could+you+support+%24PLATFORM+and%2For+%24ARCH%3F
## Documentation
Check out the docs:
- [Getting Started](https://extism.readthedocs.io/en/latest/usage.html)
- [API docs](https://extism.readthedocs.io/en/latest/api.html)## Development
### Local dev
Install [just](https://just.systems). Running `just test` should install all
other prerequisites.### Release workflow
1. Create a semver-formatted git tag (`git tag v1.0.0`).
2. Push that tag to the repository (`git push origin v1.0.0`.)
3. Wait for [the Build workflow to run](https://github.com/extism/python-sdk/actions/workflows/build.yaml).
4. Once the build workflow finishes, go to the [releases](https://github.com/extism/python-sdk/releases) page. You should
see a draft release.
5. Edit the draft release. Publish the release.
6. Wait for [the Release workflow to run](https://github.com/extism/python-sdk/actions/workflows/release.yaml).
7. Once the release workflow completes, you should be able to `pip install extism==${YOUR_TAG}` from PyPI.## LICENSE
[BSD-3-Clause](./LICENSE)