Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

windows package within requirements.txt #1133

Open
ThePirateWhoSmellsOfSunflowers opened this issue Mar 21, 2024 · 3 comments
Open

windows package within requirements.txt #1133

ThePirateWhoSmellsOfSunflowers opened this issue Mar 21, 2024 · 3 comments

Comments

@ThePirateWhoSmellsOfSunflowers
Copy link
Contributor

Hello @cannatag!

Since 5c10be6 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?

🌻

@exploide
Copy link
Contributor

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.

@ThePirateWhoSmellsOfSunflowers
Copy link
Contributor Author

TIL platform_system==, obviously a better solution than mine 👍

@exploide
Copy link
Contributor

exploide commented Mar 21, 2024

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!

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants