skillfed

ldaptor

A Pure-Python Twisted library for LDAP

ldaptor v21.2.0 1.9M downloads/30d#3,432 on PyPI167
Permissive license MIT Active released

What it is and what it does

Ldaptor is a pure-Python LDAP client library that runs on top of Twisted, providing asynchronous access to LDAP directory services. It handles the full LDAP protocol stack—client connections, authentication, directory searches, and filter parsing—without requiring compiled C extensions. The library also includes utilities for LDIF format generation, Samba password operations, and command-line tools.

You use it when you need to query or authenticate against LDAP directories from Python, particularly in applications already built on Twisted or where async I/O is desired. It parses LDAP filters from text, generates protocol messages, and manages the connection lifecycle through Twisted's deferred-based concurrency model. Dependencies are all pure-Python (Twisted, pyparsing, passlib, six, zope.interface), so installation is straightforward.

Use it for:

  • Authenticate users against an LDAP directory in a Twisted-based web or network service.
  • Query LDAP directory entries (users, groups, organizational units) and export results as LDIF.
  • Implement Samba password changes programmatically from a Python application.
  • Build LDAP client tools or utilities that need to parse and generate LDAP protocol messages.
  • Integrate directory lookups into async Python applications without blocking the event loop.

Worth the install?

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

Ldaptor is a pure-Python LDAP client library built on Twisted that handles LDAP protocol operations, filter parsing, and directory queries without compiled dependencies.

Yes, if you are building on Twisted or need async LDAP operations. The library is stable (Production/Stable status), has no known vulnerabilities, and low install friction. The gap between the latest release (2021-02-28) and active repo commits (2026-05-25) suggests development may outpace PyPI releases; verify current Python version support before adopting in new projects. Suitable for established LDAP integration tasks.

Install

ldaptor on PyPI

pip

pip install ldaptor

uv

uv add ldaptor

poetry

poetry add ldaptor

Installing ldaptor

Before you install

Low install friction; ships as a wheel. Maintenance is active with recent commits (2026-05-25), though the latest PyPI release is from 2021-02-28. Depends on Twisted and four other pure-Python libraries, all widely available.

License in practice

MIT license (permissive) places no restrictions on use, modification, or distribution in proprietary or open-source projects.

Quickstart

pip install ldaptor

from twisted.internet import reactor, defer
from ldaptor.protocols.ldap import ldapclient, ldapconnector

@defer.inlineCallbacks
def query():
    c = ldapconnector.LDAPClientCreator(reactor, ldapclient.LDAPClient)
    client = yield c.connect(b'dc=example,dc=com')
    yield client.bind(b'user@example.com', b'password')
    # perform search or other operations

reactor.callWhenRunning(query)
reactor.run()

Requires Twisted reactor event loop; LDAP operations are async/deferred-based, not blocking calls.

Verify before relying

  • Whether the 2021-02-28 release date reflects actual maintenance lag or if PyPI metadata is stale relative to active development.
  • Compatibility with Python versions beyond 3.9 (classifiers list up to 3.9; current support unclear).

Package facts

License MIT (permissive)
Python support supports the current Python release (~=3.5)
Install friction low — pure-Python wheel
Runtime dependencies 5 — passlib, Twisted, pyparsing, six, zope.interface
Maintenance actively maintained — 1,993 days since the last release
Last repo commit
First released
Downloads 1,917,769/month — #3,432 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: ldaptor-21.2.0-py2.py3-none-any.whl

Development Status :: 5 - Production/StableFramework :: TwistedIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.5Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Software Development :: Libraries :: Python ModulesTopic :: System :: Systems Administration :: Authentication/Directory :: LDAP

Tags

LDAP client library Pythondirectory authentication queriesLDAP protocol implementationpure Python LDAPTwisted LDAPLDIF generationSamba password changing
ldap-clienttwisted-asyncdirectory-auth

More Python Modules packages