ldap3 icon indicating copy to clipboard operation
ldap3 copied to clipboard

windows package within requirements.txt

Open ThePirateWhoSmellsOfSunflowers opened this issue 11 months ago • 3 comments

Hello @cannatag!

Since 5c10be6641e44cde3936b75ae7d4c0f97113cdc3 it is no longer possible to install ldap3 via pip install -r requirements.txt on linux because of the winkerberos package. Is it possible to revert the change or split requirements.txt in two files?

:sunflower:

I also stumbled upon this yesterday. But I don't think splitting requirements.txt is appropriate. You would also have this problem when installing ldap3 as a package via setup.py.

Instead it is possible to change the line in requirements.txt to winkerberos; platform_system=='Windows' to make the dependency conditional for Windows.

However, the current code in kerberos.py could then lead to the LDAPPackageUnavailableError('package gssapi (or winkerberos) missing') exception. This happens when the gssapi package also isn't available, which is likely the case since it is not currently listed as a dependency. It could however be added as gssapi; platform_system!='Windows' or =='Linux'. But then it requires the system's Kerberos packages being installed as far as I see.

I haven't looked deeply into kerberos.py and don't know whether all this is optional. Probably not, so listing gssapi as an additional dependency might be the correct solution. But I'm not sure yet.

exploide avatar Mar 21 '24 10:03 exploide

TIL platform_system==, obviously a better solution than mine :+1:

Ok I had a look on kerberos.py. Either winkerberos or gssapi is required for it to do anything useful. So if Kerberos support is meant to be available on all ldap3 installations, then both of the packages should be added to requirements.txt with the respective platform_system conditionals I mentioned before.

The only drawback would be that Linux users of ldap3 need a working Kerberos system package (either MIT or Heimdal) Otherwise installing the Python package gssapi will abort with an error. I don't know if this is appropriate. Maybe some users want to use ldap3 without Kerberos support and are annoyed when they need to install a system package.

Alternatively, an extras_require configuration could be added to setup.py to make the installation of Kerberos support optional. (The following is untested).

extras_require={
    "kerberos": [
        "winkerberos; platform_system=='Windows'",
        "gssapi; platform_system!='Windows'",
    ],
},

Those who need Kerberos support could then pip install ldap3[kerberos].

Probably the kerberos.py module would need to be slightly patched to not error out when ldap3 loads due to missing imports.

Just wanted to point out the solutions I see. Someone, probably @cannatag, needs to decide how the ldap3 package should behave. This needs testing in any case!

exploide avatar Mar 21 '24 18:03 exploide