PureScript-Python v0.1.0.0 released

The getting started instructions are available here: Getting Started.

I now want to share my design of FFI support for alternative backends, which I’m now thinking to be sufficiently extensible and customizable to solve any other backends’ FFI problems.

I use 2 components only, which’re all standarding for a Git repo:

An FFI Provider,

for a pursuit library.

For example, given purescript-prelude, we can have a Git repo purescript-prelude.py to provide all Python FFI files. I now made 3 correspondences:

A mirror index

for searching a Python FFI provider repo from a pursuit library’s name and version. I just made one now, at here:
https://github.com/purescript-python/purescript-python-ffi-index

When compiling, spago build with pspy backend will use the auto-generated configuration file to decide the mirror to use, e.g., in this auto-generated configuration, "index-mirror": "default" means we will use the git repo locally stored at ~/.pspy/mirrors/default to look up Python FFI providers, and there’s an instruction in Getting Started about making a default mirror by

  git clone https://github.com/purescript-python/purescript-python-ffi-inde ~/.pspy/mirrors/default

The implementation of a mirror has such an entry point function, tell us which git repo will used for a given pursuit package.

11 Likes

@thautwarm congrats on releasing this! :clap:

I’d just like to bring to your attention this issue in the Spago repo, which lately seems to be a gathering point for all the alternate backends in active development:

The issue is about how to make the UX for alternate backends as smooth as possible, and concerns itself with things like standardizing the CLI/behaviour for backends, how to deal with FFI, and if/how Spago should do anything to better support what backends need, so I though it’s highly relevant in this case.

3 Likes

Hi, I’ve got involved in the discussion, with the my proposal of handling FFI for alternative backends. Also, like author of psgo/pscpp, I’m okay to change pspy accordingly with spago.

This is so exciting. Thanks!

1 Like

Great timing! I’m giving a talk on mypy and PureScript in 2 days. This will be great to help tie it all together…! Also, looking forward to using this!

2 Likes

This is quite amazing. I tried some basic NumPy code and everything went smoothly.

1 Like

Great concern! I’m also a mypy(and PyCharm) user who wrote quite a lot of type hints.

I think you’d like to refer one of my future plan: generating fully type hinted python package from PureScript libraries/projects.

This is totally feasible but needs quite an amount of tasks.

2 Likes

Haha, if you want I’m requesting people to make purescript libraries for working with existing Python packages.

If you have interests, I’d like to invite you to work for this project together, and we can make a purescript-numpy.

I’m also invesgiating how to achieve stronger static safety in linear algebra libraries, because I found that purescript does have capability to do type level computations, hence dependent types for tensor dimension checking, inference and even auto completion might be possible via PureScript.

4 Likes

Sounds great! I may have some time to direct towards it in the coming months, as I plan to get back into the Python world a bit more again.

1 Like