kirbyju / tcia_utils

A package to simplify common tasks one might perform when interacting with The Cancer Imaging Archive (TCIA) via Jupyter/Python.
Apache License 2.0
14 stars 4 forks source link

Protect dataframe instantiation in downloadSeries #10

Closed zjp closed 1 year ago

zjp commented 1 year ago

The pandas dependency is mostly guarded in this function as-is, except for the dataframe at the very top of the function. This PR puts it under the same if...s as other usages of pandas later on.

kirbyju commented 1 year ago

This is the only change you all need? Will the attempt to import pandas cause you trouble? Or the fact that pandas is currently listed as a dependency in the pyproject.toml?

zjp commented 1 year ago

We regularly patch libraries that we use at install-time, but those patches are rarely of the scope to be upstreamed. In this case my patch just puts the pandas import in a try block that catches and ignores ModuleNotFoundError and ImportError. Another one moves the ipykernel import down into the viewSeries function.

This probably isn't the last PR related to pandas, it's just a quick one that'll reduce the complexity of the patch when it makes it to PyPI.

kirbyju commented 1 year ago

Got it. I pushed out a new release yesterday that includes these things.