python-ldap
Python modules for implementing LDAP clients
What it is and what it does
python-ldap is a wrapper around OpenLDAP client libraries that exposes LDAP directory operations through Python objects. It lets you connect to LDAP servers, authenticate users, search directory entries, and process LDAP-related data formats like LDIF and schema definitions. The package is built on compiled C extensions, so it depends on system-level OpenLDAP libraries being present.
The library is used primarily for authentication and directory lookups in enterprise environments. It handles the low-level protocol details and connection management, letting you focus on directory queries and user management logic. Runtime dependencies are pyasn1 and pyasn1_modules for ASN.1 encoding, but the installation itself requires C compilation and OpenLDAP headers.
Use it for:
- Authenticate users against an LDAP server in a web application or service.
- Search and retrieve user or group information from a directory for provisioning workflows.
- Process LDIF files for directory data import or export.
- Validate LDAP schema and parse LDAPv3 controls and extended operations.
- Build directory-aware applications that need to query organizational structure or user attributes.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides an object-oriented Python API to connect to and query LDAP directory servers, wrapping OpenLDAP client libraries and offering utilities for LDIF processing, LDAP URLs, and schema handling.
Yes, if you need LDAP directory integration and can meet the system dependency requirements. The package is stable, actively maintained, has no known vulnerabilities, and is widely used in enterprise Python applications. The main barrier is high install friction—you must have OpenLDAP development libraries available on your system. If you're working with corporate LDAP servers, this is the standard choice; if you don't need LDAP, the system dependency overhead makes it not worth installing.
Install
python-ldap on PyPI
pip
pip install python-ldapuv
uv add python-ldappoetry
poetry add python-ldapInstalling python-ldap
Before you install
High install friction due to compiled C extension wrapping OpenLDAP libraries; requires system-level LDAP development headers. Maintenance is active with recent releases and no known vulnerabilities.
License in practice
Licensed under a permissive Python-style license; contributions since July 2021 are under MIT. License text preservation is required but imposes minimal restrictions on use or distribution.
Quickstart
import ldap
l = ldap.initialize("ldap://my_ldap_server.my_domain")
l.simple_bind_s("", "")
l.search_s("o=My Organisation, c=AU", ldap.SCOPE_SUBTREE, "objectclass=*")
Requires OpenLDAP client libraries and development headers installed on the system; not a pure-Python package.
Verify before relying
- Whether the package's C extension compiles cleanly on all supported platforms.
- Performance characteristics and scalability limits for large directory queries.
- Current state of SASL support and any known limitations with modern LDAP servers.
Package facts
| License | python-ldap (permissive) |
| Python support | supports the current Python release (>=3.6) |
| Install friction | high — source build required |
| Runtime dependencies | 2 — pyasn1, pyasn1_modules |
| Maintenance | actively maintained — 86 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 4,423,726/month — #2,307 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: python_ldap-3.4.7.tar.gz
Keywords: ldap, directory, authentication
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
django-auth-ldapProvides a Django authentication backend that…
permissive · top 15,000 on PyPI
ldaptorLdaptor is a pure-Python LDAP client library…
permissive · top 5,000 on PyPI
python3-ldapThis package is a redirect to ldap3—a pure…
copyleft · top 15,000 on PyPI
msldapmsldap is a Python library for querying and…
permissive · top 15,000 on PyPI
ldap3ldap3 is a pure Python LDAP V3 client library…
copyleft · top 5,000 on PyPI
python-active-directoryAn Active Directory client library for Python…
permissive · top 15,000 on PyPI
ldapdomaindumpCollects and exports Active Directory…
permissive · top 15,000 on PyPI
ZODBZODB is an object-oriented database for Python…
unclear · top 15,000 on PyPI
pyobjc-framework-OpenDirectoryProvides Python bindings to macOS's…
permissive · top 15,000 on PyPI
requests-oauthAdds OAuth 1.0 authentication support to the…
permissive · top 5,000 on PyPI