BradRuderman/pyhs2

Feature request: install sasl as an optional extra

Opened this issue · 2 comments

The sasl module is completely unsupported on Windows; I've tried finding a workaround for some time and no joy (I'm running a Mac laptop and Linux servers, but some of my users who would like to run Hive queries through python are on Windows).

The sasl module is only needed for some authentication methods. pyhs2 setup.py could provide a sasl extra, which users only install on request if they know they need SASL-backed auth. For instance, in setup.py:

setup(...
      install_requires=['thrift'],
      extras_require={'sasl': ['sasl']},
      ...)

Users can choose to install pyhs2 with sasl or not by executing:

pip install pyhs2
pip install pyhs2[sasl]

connections.py could be modified to:

try:
    import sasl
    sasl_available = True
except ImportError:
   sasl_available = False
# ... in __init__ else clause for sasl:
    else:
        if not sasl_available:
            raise ImportError('sasl module required for this auth mechanism, install with pip install pyhs2[sasl]')
        sasl_mech = 'PLAIN'
        # ...

If you're interested in pursuing this, I'd be more than happy to submit a PR.

+1

+1