purepng
purepng copied to clipboard
purepng 0.2.0 outputs confusing errors
If Cython is not installed when installing purepng, the Cythonized extension is not installed and the following errors are output:
ERROR:root:Error during import of compiled filters!
ERROR:root:No module named 'png.pngfilters'
ERROR:root:Fallback to pure python mode!
There's no option to suppress these errors. This is very confusing when purepng is being used as a dependency in another application (such as rinoh). "ERROR" makes users think that things are going wrong, where in fact there is not really a problem since rinohtype doesn't even make use of the filters.
If I try to reinstall purepng after installing Cython, the errors will persist. This is because recent pip versions build wheels during installation and cache them, and thus the Cythonized extension will not be installed. This can be sidestepped by passing the --no-cache-dir
option to pip install
.
You could perhaps not output these error messages and define extras_require
in setup.py
. This way, projects depending on purepng can ensure that the cythonized extension is installed. For example add to setup.py
: extras_require = {'accelerated': ['Cython']}
. With this in place, specifying 'purepng>=0.2.0'
in another project's install_requires
will not install Cython. Specifying 'purepng[accelerated]>=0.2.0'
will.
On a sidenote, I realize that packaging extensions is a PITA, so I'm considering shipping a bare-bones version of png.py with rinohtype. That will avoid any problems with purepng installation. What do you think?