Skip to main content

pykeepass_cache

pykeepass_cache is a support library for pykeepass. It is a drop-in replacement for pykeepass.PyKeePass which caches databases in a background process to make database access faster.

This is useful in situations where the program is terminated between invocations (e.g. CLI scripts). The background process will automatically shut down after 300 seconds.

Usage

Install

pip install pykeepass-cache

Use as a drop-in replacement for pykeepass.PyKeePass:

>>> from pykeepass_cache import PyKeePass
>>> kp = PyKeePass('test.kdbx', 'password', 'keyfile.key')

Significant speedup on database open times:

# initial open.  database decryption takes a long time
>>> timeit.timeit('from pykeepass_cache import PyKeePass;PyKeePass(\'test3.kdbx\', \'password\', \'test3.key\')', number=1)
1.2734863759251311

# database is now cached in background process and opening is nearly instantaneous
>>> timeit.timeit('from pykeepass_cache import PyKeePass;PyKeePass(\'test3.kdbx\', \'password\', \'test3.key\')', number=1)
0.006465494981966913

Configure background server timeout, socket path:

>>> kp = PyKeePass('test.kdbx', 'password', 'keyfile.key', timeout=60, socket_path='/tmp/pykeepass.sock)

Get a dictionary of currently cached databases:

>>> from pykeepass_cache import PyKeePass, cached_databases
>>> kp = PyKeePass('test.kdbx', 'password', 'keyfile.key')
>>> cached_databases()
{'/home/evan/resources/pykeepass_cache/tests/test.kdbx': <pykeepass.pykeepass.PyKeePass object at 0x7f4b85678dd8>}

Manually kill the server

>>> from pykeepass_cache import close
>>> close()

Tests

python tests/tests.py

Metadata

Release files for pykeepass-cache 2.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pykeepass-cache 2.0.3
File Size Uploaded
pykeepass-cache-2.0.3.tar.gz 4.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pykeepass-cache 2.0.3
File Interpreter ABI Platform
pykeepass_cache-2.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 21.0 kB

Release files / pykeepass-cache-2.0.3.tar.gz

Download URL pykeepass-cache-2.0.3.tar.gz
Size 4.2 kB
Tags Source
SHA-256 checksum
How to use checksums
7f36fea82f1d0023ebf95df50d5e741251f321e3dd5cc5fa4ed7a94d8e9f61e8
BLAKE2b-256 checksum
How to use checksums
4855463eb873b9ef80fc8309d1683ab01d1d8fb896b2631550e83e26d7e88dae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.20.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.1

Release files / pykeepass_cache-2.0.3-py3-none-any.whl

Download URL pykeepass_cache-2.0.3-py3-none-any.whl
Size 16.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
776649aa6a29802a8aa75d707b183878f151670ef6295079e7eb92b85dc74311
BLAKE2b-256 checksum
How to use checksums
a7fa592b9435cdfd60d3a9a0b4c451d1dd6f99636b88244ce34ccdf975390387
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.20.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.1

Release history Release notifications | RSS feed

This release

2.0.3 This release

2 release files

2.0.2

2 release files

2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page