Skip to main content

PK-DB Python client

PyPI Python versions

Prepare, validate, query, and upload pharmacokinetic studies with the same scientific validation engine used by the PK-DB server. Python 3.14 and 3.15 are supported on Linux, macOS, and Windows.

Install pkdb from PyPI with python -m pip install pkdb. For source installation, see Development.

Existing pkdb_data study folders work directly:

pkdb prepare studies/ExampleStudy
pkdb validate studies/ExampleStudy --offline
export PKDB_ENDPOINT=https://beta.pk-db.com
pkdb upload studies/ExampleStudy

Preparation and validation work offline using the bundled vocabulary. Upload validates locally first and then the server validates the original files again. Set PKDB_API_KEY for authenticated operations, PKDB_ENDPOINT for the default endpoint, and optionally PKDB_USER for the expected account of the key; --endpoint and --user override them. pkdb updates itself from PyPI when a newer release exists; run pkdb update manually or disable it with PKDB_NO_UPDATE=1.

from pkdb import prepare

prepared = prepare("studies/ExampleStudy")
print(prepared.study.sid)

See the client documentation for vocabulary snapshots, structured reports, authentication, queries, and downloads.

Parallel batch uploads and recovery

# PKDB_API_KEY is read from the environment, never written to reports.
# PKDB_ENDPOINT selects the server, e.g. http://localhost:18083 for local testing.
pkdb upload ./studies --jobs 4 --report ./batch.json
pkdb upload ./studies --jobs 4 --resume ./batch.json

--jobs defaults to 1. Larger values use spawned processes, each with its own reusable HTTP client and one private source snapshot at a time. Preparation and transfers overlap; server validation remains independent. Duplicate study SIDs and shared reference ownership are rejected before submission. JSON results are emitted as tasks complete; report results retain discovery order.

Reports checkpoint queued, preparing, submitting, confirmed, failed, and unknown states. The parent saves the submitting state before allowing a worker to send a PUT. --fail-fast stops new work after an error; already submitted requests may still commit. Authentication, compatibility, rate-limit, server and uncertain write failures stop new submissions automatically. Interrupts allow ten seconds for active requests to finish; outstanding writes are recorded as unknown. A report-write failure also stops new submissions.

Resume requires the same endpoint, folder list and processing/vocabulary identity. It compares saved source file hashes and rechecks server publication state. Matching publications are skipped. Unknown writes with different or missing publications require explicit resolution and are never automatically replayed. Changed sources for previous successful or unknown writes are rejected; resolve those outcomes before starting a new report. Reports from the older version-2 sequential format are not resumable. Keep reports outside source folders.

For Python callers, pkdb.upload_many() accepts a list of folders, endpoint, API key, vocabulary, and pkdb.batch.BatchOptions. Progress and result callbacks run in the parent. Guard process-based calls with if __name__ == "__main__":. The existing Client.upload(prepared) mutation checks remain unchanged.

Client jobs and API worker processes are separate settings. Begin by measuring 1, 2, 4 and 8 client jobs on a disposable endpoint; four is a trial setting, not a measured deployment recommendation. Budget memory and temporary disk for each active snapshot, and database connections across API workers. Use scripts/benchmark_batch_upload.py with --endpoint, --vocabulary, and a new --reports directory. Run each first-import measurement on a fresh test database; subsequent runs against the same endpoint measure replacement. Reports include client stage durations and, with an updated server, validation, attachment staging and publication durations in server_report.timings. Publication time includes lock waits. Monitor server CPU, connection use, database waits, peak RSS and snapshot disk use alongside throughput. No full-corpus speedup is assumed.

Metadata

Release files for pkdb 0.12.15

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

Source distribution (sdist)

Source distribution for pkdb 0.12.15
File Size Uploaded
pkdb-0.12.15.tar.gz 5.8 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for pkdb 0.12.15
File Interpreter ABI Platform
pkdb-0.12.15-py3-none-any.whl Python 3 none any Details

Total release size: 11.4 MB

Release files / pkdb-0.12.15.tar.gz

Download URL pkdb-0.12.15.tar.gz
Size 5.8 MB
Tags Source
SHA-256 checksum
How to use checksums
70b20bcfd0533b2a558ada25f1394a8c9e834ecdfb1365c24721be3c301eeef8
BLAKE2b-256 checksum
How to use checksums
bd2115424a233ccc86610c45121eff4cf3558f4bc94655f2c219ec8aa7a90e49
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 16, 2026.

Transparency log

Release files / pkdb-0.12.15-py3-none-any.whl

Download URL pkdb-0.12.15-py3-none-any.whl
Size 5.6 MB
Tags Python 3
SHA-256 checksum
How to use checksums
4a35b1b8280cec783ed222db61775254901f3be2186fff3bced777738c6b2bc6
BLAKE2b-256 checksum
How to use checksums
58490b37501fdbd599c332e628581aa08e962e555064b303d9004cba879eddc0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 16, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.12.15 This release

2 release files

0.12.9

2 release files

0.12.8

2 release files

0.12.7

2 release files

0.12.6

2 release files

0.12.5

2 release files

0.12.4

2 release files

0.12.3

2 release files

0.12.2

2 release files

0.12.1

2 release files

0.11.1

2 release files

0.11.0

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