levitsky / pyteomics

Pyteomics is a collection of lightweight and handy tools for Python that help to handle various sorts of proteomics data. Pyteomics provides a growing set of modules to facilitate the most common tasks in proteomics data analysis.
http://pyteomics.readthedocs.io
Apache License 2.0
105 stars 34 forks source link

Pandas is now a hard requirement #119

Closed mobiusklein closed 10 months ago

mobiusklein commented 10 months ago

The fix to #118 made pandas a hard requirement, no longer optional behind the DF feature. Is this desirable? I don't use the DF feature myself, but it clearly has uses. It also makes numpy a mandatory dependency too, but there's no getting around that.

The net result is that if you install pyteomics without the DF feature enabled in a fresh virtual environment, it will not install pandas and then importing pyteomics modules that depend upon pyteomics.auxiliary.target_decoy the program crashes.

levitsky commented 10 months ago

Thank you for catching this.

Looks like I missed the fact that the patch import not only patched the method but also handled a possible ImportError. Should I just add a try/except in target_decoy.py around the pandas import?

I'm not sure what you refer to about numpy, did I change something with it as well?

mobiusklein commented 10 months ago

Apologies for the terseness of the post. Catching the import error around the import pandas line and setting pd = None should be enough, thank you.

What I meant about numpy is that if it was your intent to make pandas a hard requirement, then it would also mean we would remove the numpy optional feature too. But since numpy is so ubiquitous it's been ported to several other Python implementations.

levitsky commented 10 months ago

Thank you. As far as I understand, this should now be fixed.