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.0.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.0-cp39-abi3-win_amd64.whl (1.9 MB view details)

Uploaded CPython 3.9+Windows x86-64

carp_cli-0.2.0-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.0-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.0-cp39-abi3-macosx_11_0_arm64.whl (1.8 MB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

carp_cli-0.2.0-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.0.tar.gz.

File metadata

  • Download URL: carp_cli-0.2.0.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.0.tar.gz
Algorithm Hash digest
SHA256 9e0f63f4d6a26cccef8eb95d3e6483c45e1ef75ef1efa3f0deb12e4afa321d6f
MD5 e13efbabb462b738e66ed08601218e68
BLAKE2b-256 a003b824a02d4c2f81a954676da48032b2e9b59e1bebe1fc5c32c15bc7e7f67c

See more details on using hashes here.

Provenance

The following attestation bundles were made for carp_cli-0.2.0.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.0-cp39-abi3-win_amd64.whl.

File metadata

  • Download URL: carp_cli-0.2.0-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.0-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 73e9b17025dc434c1648053eae9fb8d0f163c53202b77ddbe6eaf326c3d30e55
MD5 39b057d6bb63887ab671c5abe825473f
BLAKE2b-256 d98fac6f5bc10f552cd83ed3e2c1a27000a53163c5276186e74c46905c670cf8

See more details on using hashes here.

Provenance

The following attestation bundles were made for carp_cli-0.2.0-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.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for carp_cli-0.2.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 88443a0e2131979ad5c7488464439b576104be333524b0b9592ac1189e2e062a
MD5 9e7dd94dcea224437f84d33925a5032a
BLAKE2b-256 2800d0b5197ca42fb96b1b9b8513d2f802e188862f17773e4bdaf67b21339b6e

See more details on using hashes here.

Provenance

The following attestation bundles were made for carp_cli-0.2.0-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.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for carp_cli-0.2.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 3552e44cfa9ddfb48999f7c099311f2f7b1266149078d729cd54ae05f0fe4aad
MD5 7f3cacc6247e238badd8bc05d4e761be
BLAKE2b-256 7e3b071bb8f23d8c6c907dd10eb05bd6df962f11eba32cd2f528bbf4bf5a2c54

See more details on using hashes here.

Provenance

The following attestation bundles were made for carp_cli-0.2.0-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.0-cp39-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for carp_cli-0.2.0-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5e7d761718c95892792e556b1117cd95071dde78dcac1fd5ceb9029237e3d00d
MD5 9140729faf779e5ebf7cf1bb952325f1
BLAKE2b-256 82f96140c49aa7781d6797e0cd7b399d10a09be9e0e963420f472b5cb309cf27

See more details on using hashes here.

Provenance

The following attestation bundles were made for carp_cli-0.2.0-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.0-cp39-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for carp_cli-0.2.0-cp39-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 c9346783c539eb7242e93edb300c9eaa512f31b65efac598901c1d4f1069e4ec
MD5 3bed968e09736633bdb9dea5556b4adf
BLAKE2b-256 62143521878d6dcbc433d7ab509e7156172c238449d1e7ac373cd2b7f701d252

See more details on using hashes here.

Provenance

The following attestation bundles were made for carp_cli-0.2.0-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