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/

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

carp_cli-0.2.1.tar.gz (179.8 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

carp_cli-0.2.1-cp39-abi3-win_amd64.whl (1.9 MB view details)

Uploaded CPython 3.9+Windows x86-64

carp_cli-0.2.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.0 MB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ x86-64

carp_cli-0.2.1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.9 MB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ ARM64

carp_cli-0.2.1-cp39-abi3-macosx_11_0_arm64.whl (1.8 MB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

carp_cli-0.2.1-cp39-abi3-macosx_10_12_x86_64.whl (1.9 MB view details)

Uploaded CPython 3.9+macOS 10.12+ x86-64

File details

Details for the file carp_cli-0.2.1.tar.gz.

File metadata

  • Download URL: carp_cli-0.2.1.tar.gz
  • Upload date:
  • Size: 179.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for carp_cli-0.2.1.tar.gz
Algorithm Hash digest
SHA256 e4955f943a7cb1dff6b2f10939ad9fc19e4b232edadcd3e27f475c43b2410e68
MD5 99ed6f221a0a62404984af3e5505527b
BLAKE2b-256 b687b905f351c542f7651007452d0fc1909c75c35f86fe3efb14619bdc4fc18d

See more details on using hashes here.

Provenance

The following attestation bundles were made for carp_cli-0.2.1.tar.gz:

Publisher: release.yml on carp-dk/carp-cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file carp_cli-0.2.1-cp39-abi3-win_amd64.whl.

File metadata

  • Download URL: carp_cli-0.2.1-cp39-abi3-win_amd64.whl
  • Upload date:
  • Size: 1.9 MB
  • Tags: CPython 3.9+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for carp_cli-0.2.1-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 0fcd782c7094f019b7974d8b08e79aa0b04c50007091670e2481ace84e6b28c0
MD5 0732fa3eacbca27bd640b5f21f8303c2
BLAKE2b-256 615f705e10d539e3b3da55320290f5b6593ae4eef6266973791a27454a743f2f

See more details on using hashes here.

Provenance

The following attestation bundles were made for carp_cli-0.2.1-cp39-abi3-win_amd64.whl:

Publisher: release.yml on carp-dk/carp-cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file carp_cli-0.2.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for carp_cli-0.2.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 533597b8f7e81729601f6011a212ce662f807a445ed2ca355917e3c39c0c1159
MD5 3c2ef3ad04c4ef83e037928e8de711eb
BLAKE2b-256 faa1f5275b987b91d1f1f1a5947babf482bcdebe5c1c7825a1ea414fc1fd4f1c

See more details on using hashes here.

Provenance

The following attestation bundles were made for carp_cli-0.2.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on carp-dk/carp-cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file carp_cli-0.2.1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for carp_cli-0.2.1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 c427357662484455d266e1ce1f0b642fa3273478dff052a8945ebf97d2bfd36e
MD5 913e6a7f5874b55053553b3671c8ca2c
BLAKE2b-256 319c46eeac8224d09e19481d8c310a20893ce005eee89749459ffefc08f63145

See more details on using hashes here.

Provenance

The following attestation bundles were made for carp_cli-0.2.1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release.yml on carp-dk/carp-cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file carp_cli-0.2.1-cp39-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for carp_cli-0.2.1-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 fb7b213ee38fcd182dc4727af1407a4038263b8e90a2e71b4eb4b786e80933d7
MD5 8dd0601c84ee46f301dda5451ef7dcc7
BLAKE2b-256 e0ab6b9277acd458837504a936340bab69d54d4a2a2ddc0e3496a2d725a91175

See more details on using hashes here.

Provenance

The following attestation bundles were made for carp_cli-0.2.1-cp39-abi3-macosx_11_0_arm64.whl:

Publisher: release.yml on carp-dk/carp-cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file carp_cli-0.2.1-cp39-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for carp_cli-0.2.1-cp39-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 75e000a341555c4b7246b6b6e1cd94233edfa17fe8b3e5bb687676a24171a9a6
MD5 ffb7790963392fded9fe3ccbdd055745
BLAKE2b-256 2cba3770a6c69365c9eefc35c24979fadbc874f251462338516b8fa0206df20c

See more details on using hashes here.

Provenance

The following attestation bundles were made for carp_cli-0.2.1-cp39-abi3-macosx_10_12_x86_64.whl:

Publisher: release.yml on carp-dk/carp-cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page