@fitzgen (he/him) one step we'll need to take at some point is to implement reference types in the embeddings of wasmtime (Go/Python/.NET/...), and I was curious if you're interested in doing that in one of them? No worries if not, just curious if you were interested in doing so
I hadn't thought too much about them, but I've added check boxes to the tracking issue: https://github.com/bytecodealliance/wasmtime/issues/929
I'm happy to do it, but maybe with some guidance around how we test these APIs, since I haven't touched them at all
ok cool, if you're curious to give it a shot I'd probably recomend doing the Python one
that should be easy enough to get up and running
that has some basic docs of how to get started but they may need some tewaking too
but I also don't mind doing this to be clear
fitzgen@erdos :: (main) :: ~/wasmtime-py
$ pytest
ERROR: usage: pytest [options] [file_or_dir] [file_or_dir] [...]
pytest: error: unrecognized arguments: --flake8 --mypy
inifile: /home/fitzgen/wasmtime-py/pytest.ini
rootdir: /home/fitzgen/wasmtime-py
do I need to pip install
flake8 and mpy too?
also, I'm assuming this is all python3?
it's all python3 yeah
pip3 install -e ".[testing]"
run that and that'll install all the dev-deps effectively
or so I'm led to believe
https://github.com/bytecodealliance/wasmtime-py/pull/38
@Alex Crichton is there a reason why Val
's raw repr is __raw__
and not _raw
? I thought that double under was stylistically reserved for python builtins
that's b/c I don't know python idioms
no reason other than that
oh I htink this is a python builtin thing
it may be but not intentionally
@Alex Crichton thoughts on the representation for externref
and funcref
in the python API should be? it is tempting to use None
for null refs, but then that doesn't discriminate between the type of ref. but maybe this is fine? worked ok for wasm_ref_t
in C...
yeah I think we should prolly use None
and do w/e is necessary to get it work on the python side
python's in general "this feels very nice" rather than "this is the fastest it can be"
/me nods
@Alex Crichton do you know how to handle circular module imports with mypy types? trying to add def funcref(self, f: Optional[Func])
method to Val
, but I can't import Func
because Func
's module imports Val
and so I get None
when I try to import Func
from Val
's module, etc
@fitzgen (he/him) 'Optional[Func]'
if you make it a string it can help with forward references
although it doesn't fix everything, you'll still have to import it
we may need to rejigger things
I'm not too well versted in mypy and forward references, if it's too onerous feel free to disable mypy and I can help figure it out before landing
ah, I was trying Optional["Func"]
and it wasn't working; will try this
oh that may or may not be supposed to work
hm, nope I'm getting this error:
ImportError: cannot import name 'Func' from 'wasmtime' (/home/fitzgen/wasmtime-py/wasmtime/__init__.py)
when I add from wasmtime import Func
which is just a straight python error, not even at mypy yet
bah
I'd just disable it for now and I can try to help poke at it later
disable mypy that is (it's a flag in pytest.ini)
@Peter Huene would you happen to be interested in implementing support for reference types in the .NET api? I've never written a line of .NET code in my life, so it would probably take me quite a while longer to implement than I suspect it would for you.
Sure, I'd be happy to. There's some .NET GC interactions we'd need to do to implement ref types, which isn't difficult but not commonly done in .NET so probably not a great place to start if learning about .NET.
I've opened https://github.com/bytecodealliance/wasmtime-dotnet/issues/27 to track.
I've opened https://github.com/bytecodealliance/wasmtime-dotnet/pull/29 to implement extern refs, func refs, and table imports of either reference type in .NET. @Yury Delendik no rush at all, but whenever you get a chance to review, I'd appreciate it!
Last updated: Nov 22 2024 at 16:03 UTC