[SciPy-Dev] Pythran 0.8.5

Serge Guelton serge.guelton at telecom-bretagne.eu
Tue Apr 24 03:09:31 EDT 2018


(sorry for the double posting if any)

It is my pleasure to announce a new version of the Pythran compiler.

Pythran is an Ahead of Time compiler for a subset of the Python
language, with a focus on scientific kernels.

It can turn code like the one below:

    #pythran export weights(uint8[:,:])

    import numpy as np
    def weights(input_data, threshold=0.3):
        n_seq, length = input_data.shape
        weights = np.zeros(n_seq, dtype=np.float32)

        for i in range(n_seq):
            vector = input_data[i, None, :]
            count_matches = np.sum(vector == input_data, axis=1)
            over_threshold = count_matches > (threshold * length)
            total = np.sum(over_threshold)
            weights[i] = 1 / total

        return weights

into a native module that runs roughly 10 times faster than when
interpreted by cpython.

It's available on PyPi, Conda and GitHub under BSD license.

For the curious reader, the Changelog is reproduced below.

It's a megablast!

----

2018-04-23 Serge Guelton <serge.guelton at telecom-bretagne.eu>

 - numpy.fft support (thanks to Jean Laroche)
 - Faster generalized expression
 - Faster numpy.transpose, numpy.argmax, numpy reduction
 - Sphinx-compatible generated docstring (thanks to Pierre Augier)
 - Python output through -P (thanks to Pierre Augier)
 - Many bugfixes and numpy improvements (thanks to Yann Diorecet and Jean Laroche)



More information about the SciPy-Dev mailing list