Skip to content

Missing dependency when importing heartpy #113

@glopesdev

Description

@glopesdev

The below import creates a missing dependency from pkg_resources which is not declared in the heartpy package itself.

from pkg_resources import resource_filename

The below is enough to reproduce:

pip install heartpy
python -c "import heartpy"

This will throw the following stacktrace:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\dev\python\heartpy\.venv\lib\site-packages\heartpy\__init__.py", line 1, in <module>
    from .heartpy import *
  File "C:\dev\python\heartpy\.venv\lib\site-packages\heartpy\heartpy.py", line 15, in <module>
    from .datautils import get_data, get_samplerate_mstimer, get_samplerate_datetime,\
  File "C:\dev\python\heartpy\.venv\lib\site-packages\heartpy\datautils.py", line 6, in <module>
    from pkg_resources import resource_filename
ModuleNotFoundError: No module named 'pkg_resources'

In the documentation it is stated:

For this we use pkg_resources for automated testing purposes, you don't need
this when using the function.

Sadly, the above import makes this statement incorrect, as pkg_resources is imported no matter what at the top of the file. Even worse, this dependency is not declared at the level of the wheel package, so simply installing heartpy is not enough to have a working environment.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions