Is it possible to target Python using ReScript?

I would like to use a python NLP lib called SpaCy but I don’t know python and I would like type-safety. Is there a way to target python using ReScript ?

It’s not currently possible. I can imagine a theoretical implementation, but I doubt such a project would get enough traction to be maintained.

There are other options, but I suspect none will quite satisfy you requirements.

If you want type safety in Python, you can use type hints with pyright or mypy. Python type hints are more sound than Typescript.

There are also projects such as Cocunut that transpile to Python similarly to how Rescript transpiles to javascript. They would all expect some level of Python knowledge, however, and I don’t think any of them are as actively maintained.

If you’re hell-bent on Rescript, your best bet is probably to use spacy-js and create Rescript bindings to it. However, that project doesn’t appear to be maintained, so you’d likely have to update it as well.

oh wow, I didn’t know about spacy-js, that would be ideal.

Thanks for the overview :ok_hand:

Depending on your motivation and available time it’s also possible to build a custom backend to ReasonML like rehp

1 Like

This doesn’t answer your question directly, but if you are willing to divert ocaml, this might help https://blog.janestreet.com/using-python-and-ocaml-in-the-same-jupyter-notebook/

1 Like