Skip to main content

documentation git sources on codeberg on PyPI CI status coverage report following OpenSSF Best Practices

aiocoap – The Python CoAP library

The aiocoap package is an implementation of CoAP, the Constrained Application Protocol. It facilitates writing applications that talk to network enabled embedded (“IoT” / “Internet of Things”) devices.

It is written in Python 3 using its native asyncio methods to facilitate concurrent operations while maintaining an easy to use interface.

Usage

For how to use the aiocoap library, have a look at the guidedtour, or at the examples and tools provided.

A full reference is available in the API documentation.

All examples can be run directly from a source code copy. If you prefer to install it, the usual Python mechanisms apply (see installation).

Features / Standards

This library supports the following standards in full or partially:

  • RFC7252 (CoAP): Supported for clients and servers. Multicast is supported on the server side, and partially for clients. DTLS is supported but experimental, and lacking some security properties. No caching is done inside the library.

  • RFC7641 (Observe): Basic support for clients and servers. Reordering, re-registration, and active cancellation are missing.

  • RFC7959 (Blockwise): Supported both for atomic and random access.

  • RFC8323 (TCP, WebSockets): Supports CoAP over TCP, TLS, and WebSockets (both over HTTP and HTTPS). The TLS parts are server-certificate only; preshared, raw public keys and client certificates are not supported yet.

  • RFC7967 (No-Response): Supported.

  • RFC8132 (PATCH/FETCH): Types and codes known, FETCH observation supported.

  • RFC9176: A standalone resource directory server is provided along with a library function to register at one. They lack support for groups and security considerations, and are generally rather simplistic.

  • RFC8613 (OSCORE): Full support client-side; protected servers can be implemented based on it but are not automatic yet.

  • draft-ietf-core-oscore-groupcomm-23 (Group OSCORE): Supported for both group and pairwise mode in groups that are fully known. (The lack of an implemented joining or persistence mechanism makes this impractical for anything but experimentation.)

  • RFC9528 (EDHOC): Experimental and rudimentary support for configured peers using the lakers implementation.

If something described by one of the standards but not implemented, it is considered a bug; please file at the github issue tracker. (If it’s not on the list or in the excluded items, file a wishlist item at the same location).

Dependencies

Basic aiocoap works out of the box on Python 3.10 or newer (also works on PyPy3). For full support (DTLS, OSCORE and link-format handling) follow the installation instructions as these require additional libraries.

aiocoap provides different network backends for different platforms. The most featureful backend is available for Linux, but most operations work on BSDs, Windows and macOS as well. See the FAQ for more details.

If your library depends on aiocoap, it should pick the required extras (as per installation) and declare a dependency like aiocoap[linkheader,oscore] >= 0.4b2.

Development

aiocoap tries to stay close to PEP8 recommendations and general best practice, and should thus be easy to contribute to.

Bugs (ranging from “design goal” and “wishlist” to typos) are currently tracked in the github issue tracker. Pull requests are welcome there; if you start working on larger changes, please coordinate on the issue tracker.

Security critical bugs may instead be reported in private to <chrysn@fsfe.org> (PGP key) for coordinated disclosure; the maintainer reserves the right to publish fixes ahead of a planned embargo time at he deems suitable.

Documentation is built using sphinx with python3 -m sphinx doc/ ${TARGET}; hacks used there are described in ./doc/README.doc.

Unit tests are implemented in the ./tests/ directory and easiest run using tox (but also available through python3 -m unittest to test the local environment); complete test coverage is aimed for, but not yet complete (and might never be, as the error handling for pathological network partners is hard to trigger with a library designed not to misbehave). The tests are regularly run at the CI suite at codeberg, from where coverage reports are available.

Relevant URLs

Licensing

aiocoap is published under the MIT License, and follows the best practice of reuse.software. Files in aiocoap/util/vendored/ may have different (but compatible and OSI approved) licenses.

When using aiocoap for a publication, please cite it according to CITATION.cff.

Copyright Christian Amsüss and the aiocoap contributors.

aiocoap was originally based on txThings by Maciej Wasilak. The full list of aiocoap contributors can be obtained from the version control history.

Release files for aiocoap 0.4.17

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

Source distribution (sdist)

Source distribution for aiocoap 0.4.17
File Size Uploaded
aiocoap-0.4.17.tar.gz 313.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for aiocoap 0.4.17
File Interpreter ABI Platform
aiocoap-0.4.17-py3-none-any.whl Python 3 none any Details

Total release size: 560.9 kB

Release files / aiocoap-0.4.17.tar.gz

Download URL aiocoap-0.4.17.tar.gz
Size 313.5 kB
Tags Source
SHA-256 checksum
How to use checksums
464c8d2b85ec1ef435dabeaa3fb6c8256b40fadfe6ce4ca83b93acb8d555f436
BLAKE2b-256 checksum
How to use checksums
1d7c10483df04d7910e21d55d47ab7c014fb02644b5b58ba741161360f8e9e8d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.5

Release files / aiocoap-0.4.17-py3-none-any.whl

Download URL aiocoap-0.4.17-py3-none-any.whl
Size 247.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9f8f5f09e8f2666b635d7f9c45db5d1d0e38d41479b2d83878678a9cdb5a8f3c
BLAKE2b-256 checksum
How to use checksums
6c43aa24717e6a12dd00e0a9bee405ef8d3b9643edac23876e949f23f46b55ff
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.5

Release history Release notifications | RSS feed

This release

0.4.17 This release

2 release files

0.4.16

2 release files

0.4.15

2 release files

0.4.14

2 release files

0.4.13

2 release files

0.4.12

2 release files

0.4.10

2 release files

0.4.9

2 release files

0.4.8

2 release files

0.4.7

2 release files

0.4.5

2 release files

0.4.4

2 release files

0.4.3

2 release files

0.4.2

2 release files

0.4.1

1 release file

0.4

1 release file

0.3

1 release file

0.2

1 release file

0.1

1 release file

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