petl-developers/petl

Unavoidable warning if fsspec is not installed

Closed this issue · 4 comments

Minimal, reproducible code sample, a copy-pastable example if possible

python -c "import petl"
# Missing fsspec package. Install with: pip install fsspec

Problem description

It is not possible to use petl without this warning, even if no remote I/O is used or intended.

Version and installation information

  • Value of petl.__version__: "1.6.0"
  • Version of Python interpreter: 3.8.3
  • Operating system (Linux/Windows/Mac): Windows
  • How petl was installed: pip in venv

@chrullrich ,

  • You should use pet without fsspec without problems.
  • This message can be safely ignored if you are not using remote I/O.
  • Also using URIs like http://, ftp:// and smb:// as parameters for to...() and from..() functions should work without fsspec.

Please let me know:

  • There is any breakage in your code?
  • How exactly this message impacts?

The message causes no breakage, although an easy situation to imagine is where petl is used in a subprocess, and the warning shows up in stderr unexpectedly, or even causes the parent to consider the subprocess failed because it produced any output on stderr at all.

The impact is that the absence of an optional dependency causes a warning; I don't think this is how it should be.

A better way to solve this (other than adding it as a required dependency) is to use extras_require and let others depend on petl[remote] if they plan to use it. If fsspec is then only imported once it is actually needed, anyone who tries to use remote I/O without declaring that intention gets an ImportError, which is no more than they deserve.

@chrullrich,

Looks like a good approach to me.
I'll try to silence the warning soon.

Merged a fix in a6d791d of #501

Scheduled for release v1.6.1:

In the case there are remaining issues left please tell us again.