crystal-community / crystal-libraries-needed

A list of libraries that are needed or wanted for the Crystal-Language
141 stars 4 forks source link

Python to Crystal converter #116

Closed alexanderadam closed 2 years ago

alexanderadam commented 4 years ago

I just stumbled over py2rb and thought that it might be especially helpful for people who're coming from a scientific background if there would be a Python to Crystal converter, too.

This issue is more meant as an idea.

Disclaimer: I'm pretty sure that it will be more difficult to create Crystal converter than a Ruby converter (typing alone…).

nanobowers commented 2 years ago

I'm playing with this right now as a work-in-progress based on my variant of py2rb with fixes and type annotation support for Crystal. These types of code translators are never going to be 100%, but might be useful in mapping over code or tests.

Unfortunately python's unitTest isn't a great 1:1 mapping for Crystal's stdlib Spec. And I'm not sure a NumPy equivalent exists in Crystal, so those mappings from py2rb will have to go on hiatus.

nanobowers commented 2 years ago

An early version with some rudimentary type support is here: https://github.com/nanobowers/py2cr

Would welcome any feedback or contributions.

alexanderadam commented 2 years ago

Awesome, I'll close this issue then since all further things should be done on issues on that project.

Thank you so much! 🙌