--- id: pykeepass version: "4.2.0" license: GPL-3.0 license_treatment: copyleft maintenance: active --- # pykeepass — Python library to interact with keepass databases (supports KDBX3 and KDBX4) License: copyleft · Maintenance: active · Downloads: 291.2K/mo ## What it is and what it does PyKeePass is a Python library for reading and writing KeePass password database files in KDBX3 and KDBX4 formats. It provides an object-oriented interface to load a database, query entries and groups by name or regex, retrieve passwords and OTP codes, and modify the database structure—adding or deleting entries and groups, managing attachments, and updating metadata like creation and modification times. The library handles the cryptographic details of KeePass database encryption and decryption internally, relying on pycryptodomex for symmetric encryption, argon2_cffi for key derivation, and lxml for XML parsing. It's designed for automation scenarios where you need programmatic access to KeePass data—such as credential provisioning, backup scripts, or integration with other tools—rather than interactive password management. Use it for: - Automate credential retrieval in deployment or CI/CD pipelines by querying a KeePass database for usernames and passwords. - Bulk import or export credentials to/from a KeePass database as part of a migration or backup workflow. - Generate and store one-time passwords (OTP) by parsing otpauth URIs stored in KeePass entries. - Programmatically organize credentials by creating groups and entries in a KeePass database from external data sources. - Attach files (certificates, keys, documents) to KeePass entries and retrieve them programmatically. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Read, write, and manipulate KeePass password database files (KDBX3 and KDBX4 formats) programmatically, including entries, groups, attachments, and OTP codes. Yes, with conditions. Install if you need programmatic access to KeePass databases and can accept the GPL-3.0 copyleft constraint. The library is actively maintained, has low install friction, carries no known vulnerabilities, and covers the core KeePass operations. Avoid if your project is proprietary or closed-source, or if you need features beyond KDBX3/KDBX4 support. ## Install pip install pykeepass uv add pykeepass poetry add pykeepass ## Installing pykeepass Before you install: Low friction installation with a pure-Python wheel. Actively maintained with a recent release (5 days old) and steady development activity. Depends on six runtime libraries including cryptography (pycryptodomex, argon2_cffi) and XML parsing (lxml), all standard choices for this use case. License in practice: GPL-3.0 copyleft license means any code that uses this library must also be released under GPL-3.0 or a compatible license. Not suitable for proprietary or closed-source projects without explicit license negotiation. Quickstart: from pykeepass import PyKeePass kp = PyKeePass('db.kdbx', password='somePassw0rd') entry = kp.find_entries(title='facebook', first=True) print(entry.password) kp.save() Requires lxml system library (e.g., `apt install python3-lxml` on Debian/Ubuntu) before pip install. Verify before relying: - Whether the library supports all KeePass 2.x database variants beyond KDBX3 and KDBX4. - Performance characteristics when working with large databases (entry/group count limits). - Thread safety of concurrent read/write operations on the same database file. ## Package facts - License: GPL-3.0 (copyleft) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 291.2K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags keepass database python, kdbx file manipulation, password manager library, keepass entry management, read write keepass, kdbx parser, password vault access, password-management, keepass, cryptography [View on SkillFed](https://skillfed.io/packages/pykeepass) · [View on PyPI](https://pypi.org/project/pykeepass/)