Skip to main content

carp-cli

Read Copenhagen Research Platform study data from Python.

This is the same client the carp command line uses, exposed as a module, so the two share a session: sign in once and either can use it.

pip install carp-cli
pip install 'carp-cli[pandas]'   # adds to_pandas()

Installed as carp-cli, imported as carp. PyPI's carp was claimed in 2012 by an unrelated package that has not been touched since; a distribution name has never had to match what you import.

import carp

client = carp.Client(env="production")
client.login()                       # opens a browser, once

for study in client.studies():
    print(study["studyId"], study["name"])

Getting data out

data_stream returns one dictionary per measurement, with the stream it came from folded into each — the shape a DataFrame wants:

rows = client.data_stream(
    deployment="df98d925-3ab4-4b78-8139-fea86d809dc5",
    device="Primary Phone",
    data_type="dk.cachet.carp.heartrate",
    start="7d",
)

frame = carp.to_pandas(rows)         # pip install 'carp-cli[pandas]'

Windows are written the way you would say them — "7d", "36h", "2026-08-01", "2026-08-01T09:30:00Z", or None for now.

For the bulk of a study, ask for an export and download the archive:

client.create_export(STUDY)                       # packaged in the background
[export] = [e for e in client.exports(STUDY) if e["status"] == "AVAILABLE"]
path = client.download_export(STUDY, export["id"])

Sessions

The session lives in the same file carp auth login writes, keyed by the deployment's host. So:

  • carp auth login --env test in a terminal, then carp.Client(env="test") in a notebook, needs no second login
  • client.login() in a notebook signs the terminal in too
  • each deployment keeps its own session; moving between them signs you out of neither

Exceptions

carp.CarpAuthError no session, or the server rejected it — call login()
carp.CarpNotFoundError no such study, deployment, export or file
carp.CarpForbiddenError signed in, but not allowed to see it
carp.CarpError anything else; the base of the three above

Building it

pip install maturin
maturin develop            # into the active virtualenv
maturin build --release    # a wheel, in target/wheels/

Metadata

Release files for carp-cli 0.2.1

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

Source distribution (sdist)

Source distribution for carp-cli 0.2.1
File Size Uploaded
carp_cli-0.2.1.tar.gz 179.8 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for carp-cli 0.2.1
File
carp_cli-0.2.1-cp39-abi3-win_amd64.whl CPython 3.9 abi3 Windows x86-64 Details
carp_cli-0.2.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.9 abi3 Linux glibc 2.17+ x86-64 Details
carp_cli-0.2.1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.9 abi3 Linux glibc 2.17+ ARM64 Details
carp_cli-0.2.1-cp39-abi3-macosx_11_0_arm64.whl CPython 3.9 abi3 macOS 11.0+ ARM64 Details
carp_cli-0.2.1-cp39-abi3-macosx_10_12_x86_64.whl CPython 3.9 abi3 macOS 10.12+ x86-64 Details

Total release size: 9.6 MB

Release files / carp_cli-0.2.1.tar.gz

Download URL carp_cli-0.2.1.tar.gz
Size 179.8 kB
Tags Source
SHA-256 checksum
How to use checksums
e4955f943a7cb1dff6b2f10939ad9fc19e4b232edadcd3e27f475c43b2410e68
BLAKE2b-256 checksum
How to use checksums
b687b905f351c542f7651007452d0fc1909c75c35f86fe3efb14619bdc4fc18d
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 Aug 17, 2026.

Transparency log

Release files / carp_cli-0.2.1-cp39-abi3-win_amd64.whl

Download URL carp_cli-0.2.1-cp39-abi3-win_amd64.whl
Size 1.9 MB
Tags CPython 3.9 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
0fcd782c7094f019b7974d8b08e79aa0b04c50007091670e2481ace84e6b28c0
BLAKE2b-256 checksum
How to use checksums
615f705e10d539e3b3da55320290f5b6593ae4eef6266973791a27454a743f2f
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 Aug 17, 2026.

Transparency log

Release files / carp_cli-0.2.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL carp_cli-0.2.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 2.0 MB
Tags CPython 3.9 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
533597b8f7e81729601f6011a212ce662f807a445ed2ca355917e3c39c0c1159
BLAKE2b-256 checksum
How to use checksums
faa1f5275b987b91d1f1f1a5947babf482bcdebe5c1c7825a1ea414fc1fd4f1c
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 Aug 17, 2026.

Transparency log

Release files / carp_cli-0.2.1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL carp_cli-0.2.1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 1.9 MB
Tags CPython 3.9 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
c427357662484455d266e1ce1f0b642fa3273478dff052a8945ebf97d2bfd36e
BLAKE2b-256 checksum
How to use checksums
319c46eeac8224d09e19481d8c310a20893ce005eee89749459ffefc08f63145
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 Aug 17, 2026.

Transparency log

Release files / carp_cli-0.2.1-cp39-abi3-macosx_11_0_arm64.whl

Download URL carp_cli-0.2.1-cp39-abi3-macosx_11_0_arm64.whl
Size 1.8 MB
Tags CPython 3.9 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
fb7b213ee38fcd182dc4727af1407a4038263b8e90a2e71b4eb4b786e80933d7
BLAKE2b-256 checksum
How to use checksums
e0ab6b9277acd458837504a936340bab69d54d4a2a2ddc0e3496a2d725a91175
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 Aug 17, 2026.

Transparency log

Release files / carp_cli-0.2.1-cp39-abi3-macosx_10_12_x86_64.whl

Download URL carp_cli-0.2.1-cp39-abi3-macosx_10_12_x86_64.whl
Size 1.9 MB
Tags CPython 3.9 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
75e000a341555c4b7246b6b6e1cd94233edfa17fe8b3e5bb687676a24171a9a6
BLAKE2b-256 checksum
How to use checksums
2cba3770a6c69365c9eefc35c24979fadbc874f251462338516b8fa0206df20c
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 Aug 17, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.1 This release

6 release files

0.2.0

6 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