nucleic / kiwi

Efficient C++ implementation of the Cassowary constraint solving algorithm
https://kiwisolver.readthedocs.io/en/latest/
Other
692 stars 88 forks source link

1.4.3 has no attribute __version__ #148

Closed brobr closed 2 years ago

brobr commented 2 years ago

Hi thanks for kiwi-solver; it has been working impeccably for years but today I've run into a problem after upgrading to version 1.4.3.

When running a program depending on matplotlib-3.5.2 (and therefore kiwi-solver), it stalls on not finding __version__:

File "/usr/lib64/python3.9/site-packages/matplotlib/init.py", line 203, in _check_versions if parseversion(module.__version_\) < parseversion(minver): AttributeError: module 'kiwisolver' has no attribute '__version_\'

or when directly asking for it in ipython:

In [1]: import kiwisolver In [2]: kiwisolver.__version__ AttributeError Traceback (most recent call last) Input In [2], in <cell line: 1>() ----> 1 kiwisolver.__version__

AttributeError: module 'kiwisolver' has no attribute '__version__'

Downgrading to 1.4.2 restores function. This is built with exactly the same script as used for 1.4.3.

This is on Slackware64-15.0+ (current) with python-3.9.13; python-setuptools-57.5; Cython-0.29.28

FYI, a python slackware package gets built via a script usually calling setup.py:

# Workaround - ensure egg.info folder is named kiwisolver-1.4.3-py3.9-egg. sed -i "/setup(/a \ \ name=\'kiwisolver\'," setup.py

python3 setup.py install --root $PKG

brobr commented 2 years ago

The maintainer of the slackbuild metioned this:

From kiwisolver 1.4.2 to 1.4.3, these 2 lines were removed from the upstream setup.py, under setup(): package_dir={"": "py"}, packages=["kiwisolver"],

The removal of these 2 lines caused the problem you mentioned.

It is solved at our end by

Therefore, please add the following line to kiwisolver.SlackBuild (just before python3 setup.py install --root $PKG): sed -i "/name='$SRCNAM',/a \   \ package_dir={\'\': \'py\'},\n    packages=[\'$SRCNAM\']," setup.py

MatthieuDartiailh commented 2 years ago

The central reason for the breakage is that kiwi moved fully to a PEP 517 based installation process meaning that setup.py should not be invoked directly anymore. It was kept to preserve editable installs even thought the are of little interest for kiwi.

Also as listed in pyproject the minimal setuptools version is 61.2.