Skip to main content

Crazyflie Python Library

Rust-powered Python library for Crazyflie quadcopters

This library is a ground-up rewrite with breaking changes from the original cflib. The API is async-first, powered by Rust via PyO3, and is not yet stable. Expect breaking changes.


Quick Start

import asyncio
from cflib2 import Crazyflie, LinkContext

async def main():
    context = LinkContext()

    # Scan for Crazyflies
    uris = await context.scan(address=list(bytes.fromhex("E7E7E7E7E7")))
    print(f"Found: {uris}")

    # Connect and read a parameter
    cf = await Crazyflie.connect_from_uri(context, "radio://0/80/2M/E7E7E7E7E7")
    param = cf.param()
    value = await param.get("pm.lowVoltage")
    print(f"Low voltage threshold: {value}V")
    await cf.disconnect()

asyncio.run(main())

See the examples/ directory for more.


Development Setup

Prerequisites

  • Rust toolchain (cargo)
  • uv package manager

Initial Setup

  1. Install dependencies (including dev tools):

    uv sync --group dev
    

    This installs the dev dependency group which provides maturin, pre-commit, pytest, and other development tools. Commands prefixed with uv run below require this group.

  2. Install pre-commit hooks:

    uv run pre-commit install
    
  3. Build the project:

    cargo build --lib --manifest-path rust/Cargo.toml && \
    uv run maturin develop && \
    uv sync && \
    uvx ruff check . && \
    uvx ruff format .
    

Development Workflow

After making changes to Rust code, rebuild with:

cargo build --lib --manifest-path rust/Cargo.toml && \
uv run maturin develop && \
uv sync && \
uvx ruff check . && \
uvx ruff format .

This uses debug mode for faster compilation during development.

Performance Testing During Development

To benchmark or test performance locally with optimizations enabled:

cargo build --release --lib --manifest-path rust/Cargo.toml && \
uv run maturin develop --release

Note: When users pip install your package (from git or PyPI), maturin automatically builds in release mode. This section is only for testing optimized performance during local development.

Regenerating Python Stubs

To regenerate cflib2/_rust.pyi after changing the Rust API:

cargo run --bin stub_gen --manifest-path rust/Cargo.toml --no-default-features && \
uv run scripts/fix_stubs.py cflib2/_rust.pyi && uvx ruff format .

The --no-default-features flag is required because the default extension-module feature tells PyO3 not to link against libpython (extension modules get those symbols from the Python interpreter). The stub generator is a standalone binary, so it needs libpython linked directly.

The fix_stubs.py script converts Coroutine[Any, Any, T] return types to async def ... -> T, which is needed because our async methods use pyo3-async-runtimes (not native async fn) and pyo3_stub_gen can't detect them as async.

Pre-commit hooks will automatically run linting and formatting on commit.


License

GPLv3+ - see LICENSE

Metadata

Release files for cflib2 0.1.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 cflib2 0.1.0
File Size Uploaded Provenance
cflib2-0.1.0.tar.gz 69.5 kB With provenance Details

Built distributions (wheels)

Table of built distributions (wheels) for cflib2 0.1.0
File
cflib2-0.1.0-cp311-abi3-win_amd64.whl CPython 3.11 abi3 Windows x86-64 Details
cflib2-0.1.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.11 abi3 Linux glibc 2.17+ x86-64 Details
cflib2-0.1.0-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.11 abi3 Linux glibc 2.17+ ARM64 Details
cflib2-0.1.0-cp311-abi3-macosx_11_0_arm64.whl CPython 3.11 abi3 macOS 11.0+ ARM64 Details
cflib2-0.1.0-cp311-abi3-macosx_10_12_x86_64.whl CPython 3.11 abi3 macOS 10.12+ x86-64 Details

Total release size: 10.8 MB

Release files / cflib2-0.1.0.tar.gz

Download URL cflib2-0.1.0.tar.gz
Size 69.5 kB
Tags Source
SHA-256 checksum
How to use checksums
9cae5e07f3688d5e3773eed650e9fa6f96210e646845ff49ab1bf2ab3361ae32
BLAKE2b-256 checksum
How to use checksums
8d446157c2a4a0f0604c6a9dd4407f2cfd510689459aeaf8d6f9b2e8123e964e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 Jul 17, 2026.

Transparency log

Release files / cflib2-0.1.0-cp311-abi3-win_amd64.whl

Download URL cflib2-0.1.0-cp311-abi3-win_amd64.whl
Size 2.1 MB
Tags CPython 3.11 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
30b7ba49be859feb086b38ef9fb7a04bd9c77dffeeec92ad525ae8ddadd9bd55
BLAKE2b-256 checksum
How to use checksums
f3e8926d1cb4fb58ce7fa38cea01d2175cbb4a33f05a666ea969c5778b3a3cb5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 Jul 17, 2026.

Transparency log

Release files / cflib2-0.1.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL cflib2-0.1.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 2.2 MB
Tags CPython 3.11 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
a779289bf0cffad5308f250f9a7430077993dbaa0c414580edb00bb617b00f0c
BLAKE2b-256 checksum
How to use checksums
1edae1a62da57394d09267d6a82a76a1c846ed8b40a9730955a67b908ba2b63c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 Jul 17, 2026.

Transparency log

Release files / cflib2-0.1.0-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL cflib2-0.1.0-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 2.4 MB
Tags CPython 3.11 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
8b7a66df180a54488ebd94603dba381de18fc424759d23a428e398b6e2c0179f
BLAKE2b-256 checksum
How to use checksums
9a27d1aebb749543793a214f47094372d28c41cfe734c4922a0212665e828fd4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 Jul 17, 2026.

Transparency log

Release files / cflib2-0.1.0-cp311-abi3-macosx_11_0_arm64.whl

Download URL cflib2-0.1.0-cp311-abi3-macosx_11_0_arm64.whl
Size 2.0 MB
Tags CPython 3.11 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
ade6be6599ea234e9d033a1085d392c077f991cab07c76242b3c277fedc78bcf
BLAKE2b-256 checksum
How to use checksums
ca33c60c267080b830d669fdf9848d059369aed241a44693037d6b3bd74883d6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 Jul 17, 2026.

Transparency log

Release files / cflib2-0.1.0-cp311-abi3-macosx_10_12_x86_64.whl

Download URL cflib2-0.1.0-cp311-abi3-macosx_10_12_x86_64.whl
Size 2.0 MB
Tags CPython 3.11 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
4780612bc7c8eff1aa83d7f9bd3d63ab8e6bb3d1695de4ca05529e01123ace9b
BLAKE2b-256 checksum
How to use checksums
ada2423195ffbde50477a5019368edb516cd69adda0a51573146f1a344d4ae79
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 Jul 17, 2026.

Transparency log

Security for cflib2 0.1.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 cflib2-0.1.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 Jul 17, 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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

6 release files Full provenance

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