Cython 0.25 released

240 views
Skip to first unread message

Robert Bradshaw

unread,
Oct 25, 2016, 4:34:55 PM10/25/16
to Core developer mailing list of the Cython compiler, cython...@googlegroups.com, python-ann...@python.org
I'm happy to announce the release of Cython 0.25 which has numerous
new features and bug fixes. It is available at
https://pypi.python.org/pypi/Cython

We have also moved bug tracking from trac.cython.org to github issues.
However, user support still remains at cython-users@, please refrain
from filing issues until you have confirmed an actual bug.

- Robert


Features added
--------------

* def/cpdef methods of cdef classes benefit from Cython's internal function
implementation, which enables introspection and line profiling for them.
Implementation sponsored by Turbostream (www.turbostream-cfd.com).

* The distutils extension ``Cython.Distutils.build_ext`` has now been updated
to use cythonize which properly handles dependencies. The old extension can
still be found in ``Cython.Distutils.old_build_ext`` and is now deprecated.

* Calls to Python functions are faster, following the recent "FastCall"
optimisations that Victor Stinner implemented for CPython 3.6.
See https://bugs.python.org/issue27128 and related issues.

* The new METH_FASTCALL calling convention for PyCFunctions is supported
in CPython 3.6. See https://bugs.python.org/issue27810

* C++ classes can now have typedef members. STL containers updated with
value_type.

* Support for bazel using a the pyx_library rule in //Tools:rules.bzl.

* Initial support for using Cython modules in Pyston. Patch by Daetalus.

* Dynamic Python attributes are allowed on cdef classes if an attribute
``cdef dict __dict__`` is declared in the class. Patch by empyrical.

* Cython implemented C++ classes can make direct calls to base class methods.
Patch by empyrical.

* New directive ``cython.no_gc`` to fully disable GC for a cdef class.
Patch by Claudio Freire.

* Buffer variables are no longer excluded from ``locals()``.
Patch by da-woods.

* Building f-strings is faster, especially when formatting C integers.

* for-loop iteration over "std::string".

* ``libc/math.pxd`` provides ``e`` and ``pi`` as alias constants to simplify
usage as a drop-in replacement for Python's math module.

* Speed up cython.inline().

* Binary lshift operations with small constant Python integers are faster.

* Some integer operations on Python long objects are faster in Python 2.7.

* Support for the C++ ``typeid`` operator.

Significant Bugs fixed
----------------------

* Division of complex numbers avoids overflow by using Smith's method.

* Some function signatures in ``libc.math`` and ``numpy.pxd`` were incorrect.
Patch by Michael Seifert.

Other changes
-------------

* The "%%cython" IPython/jupyter magic now defaults to the language level of
the current jupyter kernel. The language level can be set explicitly with
"%%cython -2" or "%%cython -3".

Hildingur Mahanti

unread,
Oct 26, 2016, 12:56:11 AM10/26/16
to cython-users, cython...@python.org, python-ann...@python.org
Hi Robert,

Something seems to be wrong with Cython 0.25. It is breaking pandas installation via pip in a virtual env. I am not sure if this is a pandas issue or a numpy relying on some undocumented cython behavior which changed. 
I am a Java guy dabbling around in python, so I will not attempt to diagnose the problem - I will just show you the steps to reproduce the issue are below:

#Create a virtual Env:
hildingur@xps12:~/cython_test$ virtualenv cythontest
New python executable in cythontest/bin/python
Installing setuptools, pip...done.

#Activate the virtual Env:
hildingur@xps12:~/cython_test/cythontest$ source bin/activate

#Install the latest version of cython:
(cythontest)hildingur@xps12:~/cython_test/cythontest$ pip install cython
Downloading/unpacking cython
  Downloading Cython-0.25.tar.gz (1.7MB): 1.7MB downloaded
...
...
Successfully installed cython
Cleaning up...

#verify the cython version is 0.25:
(cythontest)hildingur@xps12:~/cython_test/cythontest$ cython -V
Cython version 0.25

#install numpy (this is not the issue, but it is a pre-req for pandas):
(cythontest)hildingur@xps12:~/cython_test/cythontest$ pip install numpy
...
Successfully installed numpy
Cleaning up...

#install pandas (there seems to be a cython issue here):
(cythontest)hildingur@xps12:~/cython_test/cythontest$ pip install pandas
Downloading/unpacking pandas
  Downloading pandas-0.19.0.tar.gz (8.3MB): 8.3MB downloaded
...
  File "/home/hildingur/cython_test/cythontest/local/lib/python2.7/site-packages/Cython/Compiler/Errors.py", line 177, in error

    raise InternalError(message)

Cython.Compiler.Errors.InternalError: Internal compiler error: 'algos_common_helper.pxi' not found

----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /home/hildingur/cython_test/cythontest/build/pandas
Storing debug log for failure in /home/hildingur/.pip/pip.log

#rolling back the cython version to 0.24, first uninstalling 0.25:
(cythontest)hildingur@xps12:~/cython_test/cythontest$ pip uninstall cython
Uninstalling Cython:
...
  /home/hildingur/cython_test/cythontest/lib/python2.7/site-packages/pyximport/pyximport.pyc
Proceed (y/n)? Y
  Successfully uninstalled Cython

#rolling back the cython version to 0.24, now installing 0.24:
(cythontest)hildingur@xps12:~/cython_test/cythontest$ pip install cython==0.24
Downloading/unpacking cython==0.24
  Downloading Cython-0.24.tar.gz (1.7MB): 1.7MB downloaded
...
Successfully installed cython
Cleaning up...

#verify the cython version is 0.24:
(cythontest)hildingur@xps12:~/cython_test/cythontest$ cython -V
Cython version 0.24

#Install pandas with old cython - it works now:
(cythontest)hildingur@xps12:~/cython_test/cythontest$ pip install pandas
Downloading/unpacking pandas
  Downloading pandas-0.19.0.tar.gz (8.3MB): 8.3MB downloaded
...
Successfully installed pandas python-dateutil pytz six
Cleaning up...
(cythontest)hildingur@xps12:~/cython_test/cythontest$ 


Hope this helps. Thanks for developing all this great software.

Hildingur.

Robert Bradshaw

unread,
Oct 26, 2016, 2:01:51 AM10/26/16
to cython...@googlegroups.com
On Tue, Oct 25, 2016 at 8:15 PM, Hildingur Mahanti <deinesh...@gmail.com> wrote:
Hi Robert,

Something seems to be wrong with Cython 0.25. It is breaking pandas installation via pip in a virtual env. I am not sure if this is a pandas issue or a numpy relying on some undocumented cython behavior which changed. 

This is documented behavior that changed, namely the change in Cython.Distutils.build_ext.

 

--

---
You received this message because you are subscribed to the Google Groups "cython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cython-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Robert Bradshaw

unread,
Oct 26, 2016, 5:06:26 PM10/26/16
to Core developer mailing list of the Cython compiler, cython...@googlegroups.com
I plan on releasing

https://github.com/cython/cython/archive/0.25.1b1.tar.gz

later today. I'd like to figure out the CentOS issue, but can't
reproduce. (To reiterate, if you were broken by this release, this is
what prereleases are for :).



Bugs fixed
----------

* Fixes a bug with ``isinstance(o, Exception)`` (Github issue #1496).

* Fixes bug with ``cython.view.array`` missing utility code in some cases
(Github issue #1502).

Other changes
-------------

* The distutils extension ``Cython.Distutils.build_ext`` has been reverted,
temporarily, to be ``old_build_ext`` to give projects time to migrate.
The new build_ext is available as ``new_build_ext``.

On Wed, Oct 26, 2016 at 9:15 AM, Robert Bradshaw <robe...@gmail.com> wrote:
> I'm having trouble reproducing this on any of my setups though. Let's follow
> up on https://github.com/cython/cython/issues/1499
>
> On Wed, Oct 26, 2016 at 2:11 AM, Antoine Martin <ant...@nagafix.co.uk>
> wrote:
>>
>> On 26/10/16 03:34, Robert Bradshaw wrote:
>> > I'm happy to announce the release of Cython 0.25 which has numerous
>> > new features and bug fixes. It is available at
>> > https://pypi.python.org/pypi/Cython
>> >
>> > We have also moved bug tracking from trac.cython.org to github issues.
>> > However, user support still remains at cython-users@, please refrain
>> > from filing issues until you have confirmed an actual bug.
>>
>> 0.25 does not build on any CentOS 6.x:
>> wget
>>
>> "https://pypi.python.org/packages/f8/2e/5898046f8089205981447c23ebb8fe02cd9d66939cd74338aa4872853d8e/Cython-0.25.tar.gz#md5=1b61433b8410ac382ac9b248b42466fd"
>> tar -zxf Cython-0.25.tar.gz
>> cd Cython-0.25
>> python ./setup.py build
>> (..)
>> building 'Cython.Runtime.refnanny' extension
>> creating
>> build/temp.linux-x86_64-2.6/home/centos/Cython-0.25/Cython/Runtime
>> gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall
>> -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector
>> --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC
>> -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions
>> -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic
>> -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/usr/include/python2.6 -c
>> /home/centos/Cython-0.25/Cython/Runtime/refnanny.c -o
>>
>> build/temp.linux-x86_64-2.6/home/centos/Cython-0.25/Cython/Runtime/refnanny.o
>> gcc: /home/centos/Cython-0.25/Cython/Runtime/refnanny.c: No such file or
>> directory
>> gcc: no input files
>> error: command 'gcc' failed with exit status 1
>>
>> If I just run:
>> cythonize /home/centos/Cython-0.25/Cython/Runtime/refnanny.pyx
>> Then the build succeeds.
>>
>> Cheers
>> Antoine
>> > _______________________________________________
>> > cython-devel mailing list
>> > cython...@python.org
>> > https://mail.python.org/mailman/listinfo/cython-devel
>> >
>>
>> _______________________________________________
>> cython-devel mailing list
>> cython...@python.org
>> https://mail.python.org/mailman/listinfo/cython-devel
>
>
Reply all
Reply to author
Forward
0 new messages