Registry / type-stubs / types-ldap3

types-ldap3

JSON →
library2.9.13.20260518pypypiunverified

types-ldap3 provides type hinting stubs for the popular `ldap3` library, enabling static type checkers like MyPy to validate `ldap3` code. It is part of the Python typeshed project, ensuring up-to-date and high-quality type definitions. This package does not provide any runtime functionality itself but enhances developer experience by catching type-related errors early. It is actively maintained and updated regularly as part of typeshed.

pip install types-ldap3 ldap3
INSTALL
IMPORT
SIG · TYPES-LDAP3
T
types-ldap3
type-stubspythonv2.9.13.20260518
Install
1.7s avg
Import
260ms
Disk
22MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v2.9.13.20260518 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.10–3.940 runs
installs and imports cleanly · install 0.0s · import 0.264s · 23.8MB
glibc
py 3.10–3.940 runs
installs and imports cleanly · install 1.7s · import 0.255s · 24MB
22MB installed
● package 22MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Server, Connection
✓ from ldap3 import Server, Connection
`types-ldap3` does not provide any runtime imports; it only adds type information to the `ldap3` library. All imports should be directly from `ldap3`.

This quickstart demonstrates a basic LDAP connection and search using the `ldap3` library. By installing `types-ldap3`, type checkers like MyPy can now provide accurate type suggestions and detect errors in this code, enhancing development quality without changing the runtime behavior.

import os from ldap3 import Server, Connection, AUTH_SIMPLE, STRATEGY_SYNC # Configure LDAP connection details (replace with your server/credentials) LDAP_SERVER = os.environ.get('LDAP_SERVER', 'ldap.forumsys.com') # Example public LDAP server LDAP_PORT = int(os.environ.get('LDAP_PORT', '389')) LDAP_USER = os.environ.get('LDAP_USER', 'cn=read-only-admin,dc=example,dc=com') LDAP_PASSWORD = os.environ.get('LDAP_PASSWORD', 'password') try: # Initialize LDAP server and connection server = Server(LDAP_SERVER, port=LDAP_PORT) conn = Connection(server, user=LDAP_USER, password=LDAP_PASSWORD, authentication=AUTH_SIMPLE, strategy=STRATEGY_SYNC) # Bind to the server if not conn.bind(): print(f"LDAP bind failed: {conn.result}") exit(1) print(f"Successfully connected to LDAP server: {LDAP_SERVER}") # Example: Perform a search operation search_base = 'dc=example,dc=com' search_filter = '(objectClass=person)' conn.search(search_base, search_filter, attributes=['cn', 'mail']) print(f"Found {len(conn.entries)} entries:") for entry in conn.entries: print(f" CN: {entry.cn}, Mail: {entry.mail}") # Unbind from the server conn.unbind() print("Connection unbound.") except Exception as e: print(f"An error occurred: {e}")
Debug
Known issues
gotcha`types-ldap3` provides only type stubs and no runtime functionality. You must install the actual `ldap3` library for your application to run.
fix
Ensure `ldap3` is installed via `pip install ldap3` in addition to `pip install types-ldap3`.
affects: All versions
gotchaType checking issues can arise if the version of `types-ldap3` does not match the installed `ldap3` library version, especially after significant API changes in `ldap3`.
fix
Ideally, use the `types-ldap3` version that most closely corresponds to your `ldap3` version. `typeshed` aims to keep stubs up-to-date with recent `ldap3` releases. If issues persist, check the `typeshed` GitHub for specific version compatibility notes or `ldap3` changelogs.
affects: All versions
gotchaInstalling `types-ldap3` alone will not resolve `ModuleNotFoundError: No module named 'ldap3'` at runtime. Stubs are for static analysis, not runtime dependencies.
fix
Install the `ldap3` library: `pip install ldap3`.
affects: All versions
Upgrade
Version history
2.9.13.20260518latest on PyPI · released May 18, 2026
Audit
Dependencies
ldap3requiredThis package provides type stubs for the `ldap3` library; `ldap3` itself is required for runtime functionality.
Agent activity
25 hits · last 30 days
node
22
Amazon
1
OpenAI (training)
1
Resources
types-ldap3 — pip install types-ldap3 · libregistry