truenas / py-SMART

Wrapper for smartctl (smartmontools)
GNU Lesser General Public License v2.1
79 stars 35 forks source link

Fixed missing interface subpackage in build #67

Closed dpeukert closed 1 year ago

dpeukert commented 1 year ago

Hi, I'm the maintainer of the python-pysmart package in the Arch User Repository. While updating it to 1.2.4, I've noticed that the new PEP 517-based build flow doesn't seem to include the interface subpackage in the resulting wheel file:

>>> from pySMART import Device
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.10/site-packages/pySMART/__init__.py", line 150, in <module>
    from .device_list import DeviceList
  File "/usr/lib/python3.10/site-packages/pySMART/device_list.py", line 31, in <module>
    from .device import Device
  File "/usr/lib/python3.10/site-packages/pySMART/device.py", line 40, in <module>
    from .interface import *
ModuleNotFoundError: No module named 'pySMART.interface'

This PR explicity adds it to the list of packages, which causes it to be included in the wheel file:

>>> from pySMART import Device
>>> Device('/dev/nvme0n1')
<NVME device on /dev/nvme0n1 mod:XPG GAMMIX S11 Pro sn:2L012L1H9AK2>
ralequi commented 1 year ago

Hi @dpeukert !

First of all thanks for your PR and for sharing this project on arch!

In the other hand, I don't understand why you are experiencing that behaviour. I mean, I checked on pypi because that might be a BIG mistake from my side but everything looks nice (both source code and wheel):

image

Of course I won't strongly disagree that may be an error somewhere but I wish to understand it first (and try to prevent it in the future). ¿How have you installed the package? ¿Does it happens only with some python versions?

I checked your PKGBUILD and run exactly the same command (under python 3.11) and got this:

(I had to zip it, so github allows me to upload it). It looks ok to me pySMART-1.2.4-py3-none-any.whl.zip

ralequi commented 1 year ago

Also tested on python3.10 using their official docker image... everything worked:

# docker run -it python:3.10 /bin/bash
root@4558cb7c4e7d:/# pip install pysmart
Collecting pysmart
  Downloading pySMART-1.2.4-py3-none-any.whl (56 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 56.8/56.8 kB 3.3 MB/s eta 0:00:00
Collecting humanfriendly
  Downloading humanfriendly-10.0-py2.py3-none-any.whl (86 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 86.8/86.8 kB 6.1 MB/s eta 0:00:00
Installing collected packages: humanfriendly, pysmart
Successfully installed humanfriendly-10.0 pysmart-1.2.4
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
root@4558cb7c4e7d:/# python
Python 3.10.11 (main, Apr 12 2023, 14:46:22) [GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from pySMART import Device
>>> 
ralequi commented 1 year ago

Hi again @dpeukert

I have pushed a little edit (on this PR). I feel more comfortable with this rather than directly write each subpackage.

Please, check when you are able that this fixes your build too

dpeukert commented 1 year ago

Hi, sorry about the delay, your last release fixed the issue on my side and everything is working as it should. Still not sure what caused the differing behaviour between our environments, but I'm glad you found a solution that seems to work for both of us.

Thanks and sorry once again for the delay in getting back to you