Skip to content

Make it possible to specify host functions from the Python source #4

Description

@zshipko

Python doesn't have a clear way to specify these, I am considering a couple different approaches:

  • Python decorator
@extism.import("extism:host/env", "my_func")
def my_func(x: str) -> str:
    pass
  • Import comments, something like
# import: extism:host/env my_func
def my_func(x: str) -> str:
    pass
  • Putting imports into a separate JSON file - this is not a great option since it makes imports appear out of nowhere in the source

I'm currently leaning toward using a decorator since it seems like the cleanest integration, and should be pretty easy to parse.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions