Skip to main content

pkpdutils-core

The compiled non-compartmental analysis kernel of pkpdutils, as a python extension module.

This distribution is not a library to program against. It is the compiled engine of pkpdutils, which will take it as a dependency and send it the batches this build can analyse; install pkpdutils rather than this package. Its two functions take and return the shapes pkpdutils already holds in memory. The source is in pkpdutils-core, a rust workspace, and the numbers it computes are held to Phoenix WinNonlin, PKNCA and NonCompart at a relative 1e-8 by the oracle gates of that repository.

import pkpdutils_core

# the version of the crate this wheel was built from
version = pkpdutils_core.__version__
# None when this build would analyse the batch, the reason as a string when it would not
reason = pkpdutils_core.is_supported(batch, options)
result = pkpdutils_core.analyze_batch(batch, options, n_workers=None)

batch and options are plain dicts of numpy arrays, numbers and strings, one key per field of the batch/1 contract and of version 1 of the serialized options; the result is a dict of numpy arrays. Both are described in the rust documentation of the crate, and both are the internals of pkpdutils rather than a public interface of this package: they change with the contract version and with nothing else.

What this build does not carry

analyze_batch is the non-compartmental analysis of a batch, single dose and multiple dose (a protocol of more than one dose, or an explicit tau). An analysis which is well formed and which this build does not carry raises pkpdutils_core.UnsupportedError, a subclass of ValueError, and that one exception is what a host answers by analysing the batch its own way. Every other failure keeps its natural type: a KeyError, a TypeError or a ValueError naming a key means the caller and this build disagree about the contract, which is a defect and never a reason to take another path. A RuntimeError is the answer a host reports rather than handles, and it has three sources: a panic of the kernel, a result the binding cannot read, and a result the kernel itself refuses to hand over. All three are a bug of this build and no answer to the request, so the message carries where to report it and a caller which catches ValueError as bad input catches none of them. The last of the three is the Internal class of KernelError::class in the kernel, where every error the kernel can report is classified as a refusal, a malformed request or a bug of the build under a match with no wildcard arm, so a failure a later release adds arrives in the binding already carrying the answer it asks of a host. is_supported asks the same question without raising and returns the reason as a string, and a host asks it first.

Not carried today: the analysis of an effect curve, the acceptance criteria, the named partial areas, the propagation of the uncertainty of a group curve and the unit conversion of a result. One more is not carried and is_supported does not report it: a unit string the curated unit registry of this build cannot read. That registry is narrower than pint, deliberately, so it refuses a time in week, month or year, a concentration in U/l, a prefixed kilohour, pint's implicit product mg l and its fractional exponent hr ** 0.5, and it also refuses a spelling pint over-forgives, such as mg//l, which pint reads as mg / l. What this build reads is a property of this build, so every one of them is an UnsupportedError and a host whose own engine reads the string analyses the batch there. Answering it means deriving the unit of every parameter of the result, which is the analysis itself, so analyze_batch is what reports it and a host which routes on the type rather than on the predicate takes its own path for it as for any other refusal.

Threads, and a warning about fork

The wheels are built with the parallel feature of the kernel, so the row loop of a large batch is cut into contiguous shards which run on a rayon thread pool. The shard plan is n_workers: None lets the kernel plan it for the shape of the batch, 1 runs every row in the calling thread, and any other number is the most stretches the run may be cut into. The numbers are identical for every plan, down to the bit. The analysis releases the interpreter while it runs, so the threads of the caller run with it.

That pool is why a process forked after an analysis must not be expected to work. os.fork, and a multiprocessing context or a pool with the fork start method, copy the parent's memory without its threads, so the rayon workers do not exist in the child while every lock they held is still locked there. A child which then analyses a batch can deadlock. Use the forkserver or the spawn start method and the question does not arise; pkpdutils already starts its own process pools that way (PROCESS_START_METHOD of pkpdutils.parallel), to keep its own threads out of a fork. A child which never calls into this module is unaffected.

Requirements

Python 3.13 or newer and numpy 2.2.2 or newer. One wheel per platform serves every python from 3.13 on: the extension is built against the stable ABI (abi3), so a new python release needs no new wheel.

License

MIT, see LICENSE in the repository.

Metadata

Release files for pkpdutils-core 0.6.0

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

Source distribution (sdist)

Source distribution for pkpdutils-core 0.6.0
File Size Uploaded Provenance Actions
pkpdutils_core-0.6.0.tar.gz 504.3 kB With provenance Details for pkpdutils_core-0.6.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for pkpdutils-core 0.6.0
File Actions
pkpdutils_core-0.6.0-cp313-abi3-win_amd64.whl CPython 3.13 abi3 Windows x86-64 Details for pkpdutils_core-0.6.0-cp313-abi3-win_amd64.whl
pkpdutils_core-0.6.0-cp313-abi3-manylinux_2_28_aarch64.whl CPython 3.13 abi3 Linux glibc 2.28+ ARM64 Details for pkpdutils_core-0.6.0-cp313-abi3-manylinux_2_28_aarch64.whl
pkpdutils_core-0.6.0-cp313-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.13 abi3 Linux glibc 2.17+ x86-64 Details for pkpdutils_core-0.6.0-cp313-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
pkpdutils_core-0.6.0-cp313-abi3-macosx_11_0_arm64.whl CPython 3.13 abi3 macOS 11.0+ ARM64 Details for pkpdutils_core-0.6.0-cp313-abi3-macosx_11_0_arm64.whl
pkpdutils_core-0.6.0-cp313-abi3-macosx_10_12_x86_64.whl CPython 3.13 abi3 macOS 10.12+ x86-64 Details for pkpdutils_core-0.6.0-cp313-abi3-macosx_10_12_x86_64.whl

Total release size: 3.7 MB

Release files / pkpdutils_core-0.6.0.tar.gz

Download URL pkpdutils_core-0.6.0.tar.gz
Size 504.3 kB
Tags Source
SHA-256 checksum
How to use checksums
034a8a0f02944e2375725719f0d69e9cdec7b8e608eb444dc9ee75e8055cdc28
BLAKE2b-256 checksum
How to use checksums
7ded023e9638cbe14c4e2b6e5ea578abf3a1412c25430b1fac409bd651f881fd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 18, 2026.

Transparency log

Release files / pkpdutils_core-0.6.0-cp313-abi3-win_amd64.whl

Download URL pkpdutils_core-0.6.0-cp313-abi3-win_amd64.whl
Size 546.4 kB
Tags CPython 3.13 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
b0212d9fd32ea13e28d81a2ab9e4510ddb6306d6f726bcaf4d8e1b97ff94b4db
BLAKE2b-256 checksum
How to use checksums
cb85787ecc2ee45ababeee5400e0eca460ed14772f05ade25f237ec31b65665d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 18, 2026.

Transparency log

Release files / pkpdutils_core-0.6.0-cp313-abi3-manylinux_2_28_aarch64.whl

Download URL pkpdutils_core-0.6.0-cp313-abi3-manylinux_2_28_aarch64.whl
Size 715.6 kB
Tags CPython 3.13 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
d55ea1b72d31c1bb4867686d51a0fa623e80c7a3674740d04c141d4f33efa223
BLAKE2b-256 checksum
How to use checksums
fdcd5f3c22a0830333f5abf11b8ed09f2dc5992f314d0e9d0329651cea0ed68a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 18, 2026.

Transparency log

Release files / pkpdutils_core-0.6.0-cp313-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL pkpdutils_core-0.6.0-cp313-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 741.3 kB
Tags CPython 3.13 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
b5de2dc29ca99492f14a54fff70a5a690574c89290b64019355c2aa511dd68f1
BLAKE2b-256 checksum
How to use checksums
76de1d8ed7dc9c4d27ae936d1ed3cc37c6917ea15e07534b36b283216b5e58f7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 18, 2026.

Transparency log

Release files / pkpdutils_core-0.6.0-cp313-abi3-macosx_11_0_arm64.whl

Download URL pkpdutils_core-0.6.0-cp313-abi3-macosx_11_0_arm64.whl
Size 591.1 kB
Tags CPython 3.13 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
87e6d3593b91268377f07ebeb32f86d78cfb7e875ac29de51d80e60f9b643ac8
BLAKE2b-256 checksum
How to use checksums
b56986efc852048e3d4f48291d76865d880bd7bbfc3f3196f3599707041bbb47
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 18, 2026.

Transparency log

Release files / pkpdutils_core-0.6.0-cp313-abi3-macosx_10_12_x86_64.whl

Download URL pkpdutils_core-0.6.0-cp313-abi3-macosx_10_12_x86_64.whl
Size 614.5 kB
Tags CPython 3.13 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
9d6c3353f73d5c96456de109355464604fc22e17ae9beac443f046f99f7ab795
BLAKE2b-256 checksum
How to use checksums
4d666ba1a29bcc6d88e226e5676d7c765bcf1066cbada6bed324d0587c6abb2a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 18, 2026.

Transparency log

Security for pkpdutils-core 0.6.0

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.

Full provenance

All 6 files in this release have been uploaded with provenance metadata.

Select from 6 files

Attestation for pkpdutils_core-0.6.0.tar.gz

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 Nov 18, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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