skillfed

ldap3

A strictly RFC 4510 conforming LDAP V3 pure Python client library

ldap3 v2.9.1 18.9M downloads/30d#1,076 on PyPI937
Copyleft license LGPL v3 Active released

What it is and what it does

ldap3 is a pure Python LDAP V3 client that runs on Python 2, Python 3, PyPy, and PyPy3. It provides RFC 4510-conforming LDAP operations with both a low-level API for direct LDAP commands and a higher-level Abstraction Layer for more pythonic directory interactions. The library includes thread-safe connection strategies (SAFE_SYNC, SAFE_RESTARTABLE, and ASYNC) to handle multithreaded scenarios, each returning a tuple of status, result, response, and request.

The package depends only on pyasn1 for ASN.1 encoding/decoding and installs with minimal friction. It is designed for applications that need to authenticate users, query directory services, or perform LDAP operations against Active Directory, OpenLDAP, or other LDAP-compliant servers. The Abstraction Layer abstracts away the complexity of raw LDAP protocol details, making directory operations more accessible to Python developers.

Use it for:

  • Authenticate users against Active Directory or OpenLDAP in web applications or services
  • Query LDAP directory servers to retrieve user attributes, group memberships, or organizational structure
  • Build user provisioning or account management tools that interact with enterprise directory services
  • Implement single sign-on (SSO) systems that validate credentials against LDAP backends
  • Automate directory operations in multithreaded applications using SAFE_SYNC or ASYNC strategies

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

ldap3 is a pure Python LDAP V3 client library that implements RFC 4510, providing both low-level LDAP operations and a high-level abstraction layer for directory queries and authentication.

Yes. ldap3 is a stable, actively maintained library with no known vulnerabilities, low install friction, and broad Python version support. It is the standard choice for LDAP operations in Python. The LGPL v3 license requires disclosure but permits use in proprietary applications. Install it if you need to authenticate against or query LDAP directories.

Install

ldap3 on PyPI

pip

pip install ldap3

uv

uv add ldap3

poetry

poetry add ldap3

Installing ldap3

Before you install

Low install friction with a single pure-Python runtime dependency (pyasn1). The package is actively maintained as of 2026-04-18 with no known vulnerabilities, though the latest release is from 2021-07-18.

License in practice

Released under LGPL v3 (copyleft). Any derivative work or modification must be released under the same license; proprietary applications can use it as a library but must disclose the license terms.

Quickstart

pip install ldap3

from ldap3 import Server, Connection, SAFE_SYNC
server = Server('my_server')
conn = Connection(server, 'my_user', 'my_password', client_strategy=SAFE_SYNC, auto_bind=True)
status, result, response, _ = conn.search('o=test', '(objectclass=*)')

Verify before relying

  • Whether the Abstract Layer is thread-safe in current versions (description notes it is NOT thread safe as of documentation time)
  • Current maintenance status beyond the 2026-04-18 last commit date and whether Python 2 support is still active

Package facts

License LGPL v3 (copyleft)
Python support not specified
Install friction low — pure-Python wheel
Runtime dependencies 1 — pyasn1
Maintenance actively maintained — 1,853 days since the last release
Last repo commit
First released
Downloads 18,857,053/month — #1,076 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: ldap3-2.9.1-py2.py3-none-any.whl

Keywords: python3, python2, ldap

Development Status :: 5 - Production/StableIntended Audience :: DevelopersIntended Audience :: System AdministratorsLicense :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)Operating System :: MacOS :: MacOS XOperating System :: Microsoft :: WindowsOperating System :: POSIX :: LinuxProgramming Language :: PythonProgramming Language :: Python :: 2Programming Language :: Python :: 3Topic :: Software Development :: Libraries :: Python ModulesTopic :: System :: Systems Administration :: Authentication/Directory :: LDAP

Tags

ldap client library pythonactive directory authenticationldap directory searchrfc 4510 ldappython ldap operationsldap user authenticationdirectory services client
ldapauthenticationdirectory-services

More Python Modules packages