martibosch / pylandstats

Computing landscape metrics in the Python ecosystem
https://doi.org/10.1371/journal.pone.0225734
GNU General Public License v3.0
82 stars 16 forks source link

Use Transonic #1

Closed paugier closed 4 years ago

paugier commented 5 years ago

It is not a serious PR to be merged. I work on Transonic and I needed a package which uses Pythran (to check that Transonic works fine on real life cases).

Anyway, I open this PR to demonstrate how Transonic can be useful for a project like pylandstats. Since there was only one simple Pythran file with a very simple signature, it is not spectacular!

Warning:

martibosch commented 5 years ago

First of all, thank you very much for your contribution. I actually dropped the Python 2 support in the 1.0.0 release a couple of days ago, so given that your PR passes all checks (I further tested running the example notebooks and everything works), it could actually be merged. The main issue is whether using transonic would fix the issues that I am having to build pylandstats via conda in windows. Any help in such issue would be very welcome and strongly appreciated.

Martí

paugier commented 5 years ago

I am not a great expert in conda-forge. I know that there are sometimes issues difficult to understand and solve! @CyrilleBonamy usually works on our conda builds for the FluidDyn packages.

@CyrilleBonamy can you please confirm that we have some successful conda-forge builds for Windows using Pythran? Do you understand the error with pylandstats (https://github.com/conda-forge/pylandstats-feedstock/pull/) ?

Regarding Transonic and conda-forge:

  1. Transonic is now only a tool to use Pythran very easily. It won't save you magically if Pythran can't compile a function...

  2. We're working on Transonic to make it able to use with the same code Pythran or Cython or Numba. This could help in cases where Pythran is not able to compile a function for a particular OS (for example Windows). It should not be difficult to setup the build such that for a function Cython is used for Windows and Pythran (faster but less mature) for other operative systems.

This is not the best solution and again you would have to wait for the next release of Transonic but it could help in some cases.

CyrilleBonamy commented 5 years ago

I am not a great expert in conda-forge. I know that there are sometimes issues difficult to understand and solve! @CyrilleBonamy usually works on our conda builds for the FluidDyn packages.

@CyrilleBonamy can you please confirm that we have some successful conda-forge builds for Windows using Pythran? Do you understand the error with pylandstats (https://github.com/conda-forge/pylandstats-feedstock/pull/) ?

No ... we did not build conda-forge package for Windows using pythran

martibosch commented 5 years ago

Hello @paugier,

This is not the best solution and again you would have to wait for the next release of Transonic but it could help in some cases.

are there any news regarding this?

I would be happy to merge your PR once we can ensure that conda builds work in Windows (even if not using Pythran but Cython/Numba).

Thank you, Martí

paugier commented 5 years ago

Hi @martibosch

Transonic improved a lot since my last message. It should be possible to use Cython or Numba on Windows for your code.

However, I'm still working on important features and there will be a new release in few days/weeks. I think it is more reasonable to wait for the next release to really use Transonic for your use case (Cython or Numba for Windows for a code where Pythran does not compile on Windows).

I will work on a better way to choose the backend (Pythran or Cython or Numba) at compile time and run time. Currently, this can be done only with the environment variable TRANSONIC_BACKEND (like this https://transonic.readthedocs.io/en/latest/examples/row_sum/txt.html). It is not really convenient for your case!

I'll take your code as a target for next release.

paugier commented 4 years ago

Deprecated by PR #2