[Cython] finding the Cython version (was: Cython 0.21 released)

Stefan Behnel stefan_ml at behnel.de
Thu Sep 11 14:02:49 CEST 2014


Alex K schrieb am 11.09.2014 um 13:49:
> tables 3.0.0 (maybe later version too) fails to install with `pip install 
> tables==3.0.0` due to changes in naming. PyTables's build script expects 
> Cython.Compiler.Main.Version, and gives an error when it doesn't find it. 
> Cython 0.21 provides Cython.Compiler.Main.version.

The right way to check for the Cython version is

    Cython.__version__

as with most Python packages. For backwards compatibility with old Cython
versions that didn't have it yet, you can use

    Cython.Compiler.Version.version

Relying on a re-exported import like "Cython.Compiler.Main.Version" is like
asking for "os.sys" to work because the "os" module happens to do "import sys".

Stefan



More information about the cython-devel mailing list