Metadata-Version: 2.4
Name: golem-cloud
Version: 0.2.0
Summary: A library that helps with writing Golem components in Python 
License-Expression: Apache-2.0
License-File: LICENSE
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Environment :: WebAssembly :: WASI
Classifier: Typing :: Typed
Requires-Python: >=3.12
Project-URL: Documentation, https://github.com/golemcloud/golem-py
Project-URL: Homepage, https://github.com/golemcloud/golem-py
Project-URL: Repository, https://github.com/golemcloud/golem-py
Description-Content-Type: text/markdown

# golem-cloud
A library that helps with writing [Golem](https://www.golem.cloud/) components in Python

## Usage

golem-cloud is built on top of [componentize-py](https://github.com/bytecodealliance/componentize-py) and relies on bindings generated by it to work.
To set up a project begin by creating a wit directory and defining a world that your component will implement:

```wit
package demo-namespace:demo-package;

interface demo-api {
  run: func();
}

world demo-world {
  import wasi:http/types@0.2.0;
  import wasi:http/outgoing-handler@0.2.0;
  import golem:api/host@1.1.6;

  export demo-api;
}
```

To enable usage of golem-cloud with your project you need to tell it about your world and where the bindings will be generated by componentize-py. To do this include
the following code snippet at the top of your python code. Make sure to place it before any other uses of the golem-cloud library.

```python
import golem_py_bindings
golem_py_bindings.register_bindings("demo_world") # Put the name of your world here
```

You can now use golem-cloud in your project:
```python
from golem_py.durability import Durability, DurableFunctionType
from demo_world.imports.oplog import WrappedFunctionType_ReadLocal

durability = Durability("custom", "random-number-generator", WrappedFunctionType_ReadLocal)
```

Note:
golem-cloud is using bindings that are generated by componentize-py for your world. You can only use the modules in golem-cloud for which you have all necessary bindings (by having the appropriate imports and exports in your world). Trying
to use a module for which your don't have all required bindings will fail with an import error (even if the initial register_bindings was successful). Every module in golem-cloud documents which bindings are required for it to work, so please consult the module documentation.
